/* ========================================
   Shared Component Styles
   Extracted from duplicated inline styles across pages.
   Include AFTER style.css and BEFORE page-specific styles.
   ======================================== */

/* ---- Skip-to-content (accessibility) ---- */
.skip-to-content {
    position: fixed;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200000;
    background: #00c9a7;
    color: #000;
    padding: 10px 24px;
    border-radius: 0 0 10px 10px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-to-content:focus {
    top: 0;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ---- Focus-visible ring for keyboard navigation ---- */
*:focus-visible {
    outline: 2px solid #00c9a7;
    outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid #00c9a7;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---- PWA standalone splash / loading screen ---- */
.vs-splash {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #0a0a12;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    transition: opacity 0.4s ease;
}
.vs-splash.hide {
    opacity: 0;
    pointer-events: none;
}
.vs-splash img {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    animation: vs-splash-pulse 1.2s ease-in-out infinite;
}
@keyframes vs-splash-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50%      { transform: scale(1.08); opacity: 1; }
}

/* ---- Header layout: logo-only centered ---- */
.header {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 56px;
    padding: 0.5rem 1rem;
    overflow: visible;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: relative;
}

/* ---- Logo ---- */
.logo-img {
    height: 60px;
    width: auto;
    transition: opacity 0.3s ease;
}

/* ---- Search container ---- */
.search-container input {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    min-width: 180px;
    transition: all 0.3s ease;
}

.search-container input:focus {
    outline: none;
    border-color: #00c9a7;
    box-shadow: 0 0 0 2px rgba(0, 201, 167, 0.2);
}

.search-container input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ---- Mobile search button (hidden by default) ---- */
.mobile-search-btn {
    display: none;
}

/* ---- Settings button & avatar ---- */
.settings-btn {
    background: none;
    border: 2px solid white;
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
}

.settings-btn img,
#headerAvatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    object-fit: cover;
}

/* ---- Notification system ---- */
.notification-wrapper {
    position: relative;
    display: inline-block;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.notification-badge.hidden {
    display: none;
}

.notification-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-width: 320px;
    max-width: 400px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    z-index: 10000;
}

.notification-dropdown.show {
    display: block;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--secondary-bg, #1a1a1a);
}

.notification-header h4 {
    margin: 0;
    font-size: 0.95rem;
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
}

.clear-all-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 0.85rem;
    color: var(--text-color);
    margin: 0;
}

.notification-text strong {
    color: var(--primary-color);
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* ---- Post card base ---- */
.post-card {
    background: var(--post-card-bg, rgba(30, 30, 30, 0.7));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    contain: layout style paint;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.post-author-info {
    flex: 1;
}

.post-content {
    margin: 1rem 0;
    line-height: 1.6;
    word-wrap: break-word;
}

.post-content .hashtag-link {
    color: #00c9a7;
    text-decoration: none;
    font-weight: 500;
}

.post-content .mention-link {
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 500;
}

.post-media {
    margin: 1rem 0;
}

.post-media img,
.post-media video,
.post-media audio {
    max-width: 100%;
    border-radius: 8px;
}

.post-privacy {
    display: inline-block;
    background: rgba(0, 201, 167, 0.1);
    color: #00c9a7;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.post-privacy.friends-only {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

/* ---- Post actions ---- */
.post-actions {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.action-btn.liked {
    color: #ef4444;
}

.action-btn.liked svg {
    fill: #ef4444;
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.action-count {
    font-weight: 500;
}

/* ---- Comments ---- */
.comments-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: none;
}

.comments-section.show {
    display: block;
}

.comment-input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.comment-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    resize: none;
}

.comment-submit-btn {
    padding: 0.75rem 1rem;
    background: #00c9a7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.comment-submit-btn:hover {
    background: #3b8eef;
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.comment-item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #666;
}

.comment-body {
    flex: 1;
}

.comment-author {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.comment-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
}

.comment-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.comment-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.comment-action-btn.edit-comment:hover {
    color: #00c9a7;
}

.comment-action-btn.delete-comment:hover {
    color: #ef4444;
}

/* ---- Report modal ---- */
.report-btn {
    color: #888 !important;
    margin-left: auto;
}

.report-btn:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.report-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.report-modal-overlay.show {
    display: flex;
}

.report-modal {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.report-modal h3 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
}

.report-modal select,
.report-modal textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #2a2a2a;
    color: var(--text-color);
    font-size: 0.95rem;
}

.report-modal textarea {
    min-height: 100px;
    resize: vertical;
}

.report-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.report-modal-actions button {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.report-submit-btn {
    background: #ef4444;
    color: white;
}

.report-submit-btn:hover {
    background: #dc2626;
}

.report-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.report-cancel-btn {
    background: #444;
    color: white;
}

.report-cancel-btn:hover {
    background: #555;
}

/* ---- Share modal ---- */
.share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.share-modal.show {
    display: flex;
}

.share-modal-content {
    background: var(--secondary-bg);
    padding: 1.5rem;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.share-modal h3 {
    margin-bottom: 1rem;
}

.share-url {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    margin-bottom: 1rem;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.share-copy {
    background: #00c9a7;
    color: white;
}

.share-to-profile {
    background: #22c55e;
    color: white;
}

.share-close {
    background: #666;
    color: white;
}

/* ---- Shared post styling ---- */
.shared-post-card {
    position: relative;
}

.shared-by-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.shared-by-header svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.shared-by-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
}

.shared-by-text {
    flex: 1;
    min-width: 0;
}

.shared-original-post {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.shared-original-post .post-header {
    margin-bottom: 0.5rem;
}

.shared-original-post .post-content {
    margin-bottom: 0.5rem;
}

.share-count:not(:empty) {
    margin-right: 0.25rem;
}

/* ---- Scroll to top ---- */
#scrollToTopBtn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: #00c9a7;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 201, 167, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
}

#scrollToTopBtn:hover {
    background: #3b8eef;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 201, 167, 0.6);
}

#scrollToTopBtn.show {
    display: flex;
}

/* ---- Notification mobile override ---- */
@media (max-width: 600px) {
    .notification-dropdown {
        position: fixed;
        right: 10px;
        left: 10px;
        top: 60px;
        min-width: unset;
        max-width: unset;
        width: auto;
    }
}

/* ---- Mobile header adjustments ---- */
@media (max-width: 768px) {
    .logo-img {
        height: 60px !important;
    }
}

/* ---- Desktop header: slightly smaller logo ---- */
@media (min-width: 769px) {
    .header {
        height: 50px;
        padding: 0.25rem 1rem;
    }

    .logo-img {
        height: 54px;
    }

    /* Desktop notification badge on header logo */
    #logoNotifBtn {
        position: relative;
    }

    .mobile-notif-badge {
        position: absolute;
        top: 2px;
        right: -4px;
        background: #ef4444;
        color: white;
        font-size: 0.6rem;
        font-weight: bold;
        min-width: 18px;
        height: 18px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2px;
        z-index: 10;
        pointer-events: none;
    }

    .mobile-notif-badge.hidden {
        display: none;
    }
}

/* ---- Tablet post adjustments ---- */
@media (max-width: 768px) {
    .post-card {
        padding: 1rem;
        border-radius: 8px;
    }

    .post-actions {
        gap: 1rem;
    }

    #scrollToTopBtn {
        width: 44px;
        height: 44px;
        bottom: 1rem;
        right: 1rem;
        font-size: 1.3rem;
    }
}

/* ---- Mobile post adjustments ---- */
@media (max-width: 480px) {
    .post-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .post-content {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .post-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .action-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

    .action-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Scroll to top offset for mobile bottom nav */
    body.has-mobile-nav #scrollToTopBtn {
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }
}

/* ---- Extra small ---- */
@media (max-width: 360px) {
    .post-card {
        padding: 0.6rem;
        margin-bottom: 0.6rem;
        border-radius: 8px;
    }

    .post-content {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .post-actions {
        gap: 0.35rem;
        padding-top: 0.6rem;
    }

    .action-btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.75rem;
    }

    .action-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ---- Ultra small ---- */
@media (max-width: 320px) {
    .post-card {
        padding: 0.5rem;
    }

    .post-content {
        font-size: 0.85rem;
    }

    .action-btn {
        font-size: 0.7rem;
    }
}

/* ---- Touch targets ---- */
@media (pointer: coarse) {
    .post-author-handle {
        padding: 0.25rem 0;
    }

    .action-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ---- Mobile logo → notification button ---- */
.mobile-notif-badge {
    display: none;
}

.mobile-notif-dropdown {
    display: none;
}

@media (max-width: 768px) {
    .header-center {
        position: relative;
    }

    #logoNotifBtn {
        position: relative;
    }

    .mobile-notif-badge {
        position: absolute;
        top: 5px;
        right: -2px;
        background: #ef4444;
        color: white;
        font-size: 0.6rem;
        font-weight: bold;
        min-width: 18px;
        height: 18px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2px;
        z-index: 10;
        pointer-events: none;
    }

    .mobile-notif-badge.hidden {
        display: none;
    }

    .mobile-notif-backdrop {
        display: none;
    }

    .mobile-notif-backdrop.show {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
    }

    .mobile-notif-dropdown {
        display: none !important;
    }

    .mobile-notif-dropdown.show {
        display: block !important;
        position: fixed;
        left: 10px;
        right: 10px;
        top: 60px;
        background: var(--secondary-bg, #1a1a1a);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        max-height: 70vh;
        overflow-y: auto;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
        z-index: 10000;
    }

    .mobile-notif-close {
        background: none;
        border: none;
        color: var(--text-secondary, #aaa);
        font-size: 1.4rem;
        cursor: pointer;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        line-height: 1;
    }

    .mobile-notif-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary, #fff);
    }
}

/* ---- Video Background Layer ---- */
.video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.video-bg.loaded {
    opacity: 1;
}

/* ---- reCAPTCHA badge — smaller on mobile ---- */
@media (max-width: 768px) {
    .grecaptcha-badge {
        transform: scale(0.65) !important;
        transform-origin: bottom right !important;
    }
}

/* ---- Lazy load performance ---- */
img[loading="lazy"] {
    content-visibility: auto;
}

/* ---- Reduced motion preference ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* JS fallback class for reduced motion */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* ---- Age Verification Modal ---- */
.age-verify-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.age-verify-modal {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.age-verify-modal h3 {
    margin: 0 0 0.5rem 0;
    color: #fff;
    font-size: 1.3rem;
}

.age-verify-modal p {
    color: #a1a1aa;
    font-size: 0.95rem;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.age-verify-modal input[type="date"] {
    width: 100%;
    padding: 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #2a2a2a;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.age-verify-modal input[type="date"]:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.age-verify-btn {
    width: 100%;
    padding: 0.85rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.age-verify-btn:hover {
    opacity: 0.9;
}

.age-verify-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.age-verify-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    min-height: 1.2em;
}

/* Too Young / Blocked Modal */
.age-blocked-modal {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.age-blocked-modal h3 {
    margin: 0 0 0.75rem 0;
    color: #ef4444;
    font-size: 1.4rem;
}

.age-blocked-modal p {
    color: #a1a1aa;
    font-size: 1rem;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.age-blocked-btn {
    padding: 0.85rem 2.5rem;
    border: none;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.age-blocked-btn:hover {
    opacity: 0.9;
}
