/* ==========================================================================
   MAIN FEED & NAVIGATION STYLES (feed.css)
   ========================================================================== */
body {
    background-color: #F8FAFB;
    margin: 0;
    color: #1E293B;
    font-family: 'Inter', sans-serif;
}

/* ══════════════════════════════════════════════════════════
   NAVBAR — professional 3-zone layout
   Zone 1: Logo (fixed width)
   Zone 2: Search (flex grow, centred)
   Zone 3: Actions (fixed width, right-aligned)
   ══════════════════════════════════════════════════════════ */
.navbar {
    background: #003366;
    border-bottom: 2px solid rgba(255, 195, 37, 0.35);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.18);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}

/* Zone 1 — Logo */
.nav-brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.nav-brand a { display: flex; align-items: center; text-decoration: none; }
.nav-logo-custom {
    height: 90px !important;
    width: auto !important;
    object-fit: contain;
    margin-top: 8px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
    transition: transform 0.2s ease;
}
.nav-brand a:hover .nav-logo-custom { transform: scale(1.05); }

/* Zone 2 — Search */
.nav-search-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 12px;
    min-width: 0;
    max-width: 360px;   /* cap it so it doesn't eat all the space */
    margin: 0 auto;
}
.nav-search-form {
    width: 100%;
    position: relative;
}
.nav-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    pointer-events: none;
}
.nav-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 14px 7px 34px;
    background: rgba(255,255,255,0.1);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 7px;
    font-size: 13px;
    color: white;
    outline: none;
    transition: background 0.2s, border-color 0.2s;
    font-family: 'Inter', sans-serif;
}
.nav-search-input::placeholder { color: rgba(255,255,255,0.38); }
.nav-search-input:focus {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,195,37,0.55);
    box-shadow: 0 0 0 3px rgba(255,195,37,0.08);
}

/* Zone 3 — Actions */
.nav-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Standard nav links */
.nav-link-item {
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.nav-link-item:hover {
    color: #FFC325;
    background: rgba(255,255,255,0.07);
}

/* Future Hub — subtle gold pill, no animation */
.nav-link-future {
    color: rgba(255,195,37,0.85) !important;
    border: 1px solid rgba(255,195,37,0.3);
    padding: 5px 12px !important;
    border-radius: 20px !important;
    font-size: 12.5px;
    font-weight: 600;
    background: rgba(255,195,37,0.04);
}
.nav-link-future:hover {
    color: #FFC325 !important;
    border-color: rgba(255,195,37,0.65) !important;
    background: rgba(255,195,37,0.08) !important;
}

/* Icon-only nav links */
.nav-link-item[title="Leaderboard"],
.nav-link-item[title="Authorities"] {
    font-size: 15px;
    padding: 6px 8px;
}

/* Pills (Admin, Expert) */
.nav-pill {
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    margin-left: 2px;
}
.nav-pill-red  { background: rgba(239,68,68,0.85); color: white; }
.nav-pill-red:hover { background: rgba(239,68,68,1); }
.nav-pill-gold { background: transparent; color: #FFC325; border: 1.5px solid #FFC325; }
.nav-pill-gold:hover { background: rgba(255,195,37,0.1); }

/* CTA button */
.nav-cta {
    background: #FFC325;
    color: #003366;
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(255,195,37,0.25);
    margin-left: 6px;
}
.nav-cta:hover { background: #FFD04A; transform: translateY(-1px); }

/* Bell notification */
.nav-bell {
    position: relative;
    font-size: 18px;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    line-height: 1;
    margin-left: 4px;
}
.nav-bell:hover { background: rgba(255,255,255,0.08); }
.nav-bell-badge {
    position: absolute;
    top: 1px;
    right: 2px;
    background: #E11D48;
    color: white;
    border-radius: 50%;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 800;
    border: 2px solid #003366;
    line-height: 1.4;
}

/* Divider */
.nav-divider {
    width: 1px;
    height: 22px;
    background: rgba(255,255,255,0.18);
    margin: 0 8px;
    flex-shrink: 0;
}

/* Avatar */
.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #FFC325;
    color: #003366;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    text-decoration: none;
    overflow: hidden;
    border: 2px solid rgba(255,195,37,0.5);
    flex-shrink: 0;
    transition: transform 0.15s;
}
.nav-avatar:hover { transform: scale(1.08); }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Logout */
.nav-logout {
    color: rgba(255,153,153,0.85);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 6px;
    transition: color 0.15s;
    margin-left: 2px;
}
.nav-logout:hover { color: #fca5a5; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR — fixed height, no clipping, no scrollbar visible
   ══════════════════════════════════════════════════════════ */
.sidebar {
    position: sticky;
    top: 72px;                      /* navbar height + 8px gap */
    max-height: calc(100vh - 88px); /* never taller than viewport */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;          /* Firefox — hide scrollbar */
    -ms-overflow-style: none;       /* IE */
}
.sidebar::-webkit-scrollbar { display: none; } /* Chrome — hide scrollbar */

@media (max-width: 991px) {
    .sidebar { position: static; max-height: none; overflow: visible; }
}

/* --- Feed Layout Structure --- */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

@media (min-width: 992px) {
    .dashboard-layout { grid-template-columns: 250px 1fr 300px; }
}

/* --- Sidebar Components --- */
.sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

@media (max-width: 991px) {
    .sidebar { position: relative; top: 0; }
}

.sidebar-card, .widget {
    background: white; 
    border-radius: 12px; 
    border: 1px solid #e2e8f0; 
    padding: 20px; 
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.03); 
    margin-bottom: 25px;
}

.sidebar-title, .widget h4 {
    color: #003366; font-size: 13px; text-transform: uppercase; 
    letter-spacing: 0.8px; margin: 0 0 15px 0; font-weight: 800;
    border-bottom: 2px solid #f1f5f9; padding-bottom: 10px;
}

.nav-link {
    text-decoration: none; display: flex; align-items: center; gap: 12px; 
    margin-bottom: 5px; color: #475569; padding: 10px 12px; 
    border-radius: 8px; font-size: 14px; font-weight: 600; 
    transition: all 0.2s ease; border-left: 3px solid transparent;
}

.nav-link:hover {
    background: #f8fafc; color: #003366; 
    border-left: 3px solid #FFC325; 
    transform: translateX(4px);
}

/* --- Prompt Box --- */
.post-prompt-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    border: 1px solid #E2E8F0;
}

.prompt-top-row { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }

.fake-input-link {
    flex-grow: 1;
    background: #F1F5F9;
    padding: 14px 24px;
    border-radius: 100px;
    color: #64748B;
    border: 1px solid transparent;
    font-weight: 500;
    text-decoration: none;
}

.fake-input-link:hover { background: #EAEAEA; border-color: #DDD; }

.prompt-action-bar { display: flex; flex-wrap: wrap; justify-content: space-around; align-items: center; padding-top: 5px; }
.prompt-action-btn { display: flex; align-items: center; gap: 8px; color: #555; text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 15px; border-radius: 5px; transition: background 0.2s; }
.prompt-action-btn:hover { background: #F4F7F6; color: #003366; }
.prompt-action-btn i { font-size: 18px; color: #777; }
.prompt-separator { height: 25px; width: 1px; background-color: #EAEAEA; }

/* --- Post Cards --- */
.post-card {
    background: #FFFFFF;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 51, 102, 0.05), 0 10px 15px -3px rgba(0, 51, 102, 0.1);
    border: 1px solid #F1F5F9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 51, 102, 0.1);
}

.post-header { display: flex; align-items: center; margin-bottom: 15px; }
.user-avatar { width: 45px; height: 45px; background: #003366; color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: bold; margin-right: 15px; overflow: hidden; flex-shrink: 0; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.post-title { font-family: 'Merriweather', serif; font-size: 22px; color: #003366; margin-bottom: 12px; line-height: 1.3; }
.post-content { color: #334155; line-height: 1.7; font-size: 15px; }

/* Interaction Bar */
.interaction-bar {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #F0F0F0;
    flex-wrap: wrap; 
}

.interact-btn { background: none; border: none; color: #666; cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 5px; }
.interact-btn:hover { color: #003366; }

/* --- Comments Section --- */
.comments-container {
    background-color: #F8FAFC;
    border-top: 1px solid #F1F5F9;
    margin-top: 20px;
    padding: 24px;
    border-radius: 0 0 16px 16px;
}

.comment-item { display: flex; gap: 12px; margin-bottom: 15px; }
.comment-avatar { width: 32px; height: 32px; background: #003366; color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 14px; font-weight: bold; flex-shrink: 0; overflow: hidden; }
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.comment-content { background: #FFFFFF; padding: 12px 18px; border-radius: 0 16px 16px 16px; border: 1px solid #E2E8F0; width: 100%; }
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.comment-author-name { font-size: 13px; font-weight: bold; color: #003366; }
.comment-text { font-size: 14px; color: #334155; line-height: 1.4; }

.comment-input-wrapper { display: flex; gap: 12px; margin-top: 20px; align-items: center; }
.comment-input-box { flex: 1; padding: 10px 15px; border: 1px solid #CBD5E1; border-radius: 20px; font-size: 14px; outline: none; }
.comment-input-box:focus { border-color: #003366; }
.comment-submit-btn { background: #FFC325; color: #003366; border: none; padding: 8px 18px; border-radius: 20px; font-weight: bold; cursor: pointer; }

.scrollable-comment-list { max-height: 250px; overflow-y: auto; padding-right: 8px; }
.scrollable-comment-list::-webkit-scrollbar { width: 6px; }
.scrollable-comment-list::-webkit-scrollbar-thumb { background: #FFC325; border-radius: 10px; }
.scrollable-comment-list::-webkit-scrollbar-track { background: #F1F5F9; }

/* --- Top Contributors Styling --- */
.rank-1 { border: 2px solid #FFC325; box-shadow: 0 0 15px rgba(255, 195, 37, 0.4); }
.rank-2 { border: 2px solid #CBD5E1; box-shadow: 0 0 12px rgba(203, 213, 225, 0.3); }
.rank-3 { border: 2px solid #CD7F32; box-shadow: 0 0 10px rgba(205, 127, 50, 0.2); }

.contributor-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px; background: rgba(255, 255, 255, 0.5); border-radius: 14px;
    margin-bottom: 10px; transition: all 0.3s;
}
.contributor-item:hover { transform: scale(1.05) translateX(5px); background: #FFFFFF; }

/* --- Utilities --- */
.flash-container { max-width: 800px; margin: 15px auto 0 auto; }
.flash-message { background-color: #E8F4FD; color: #003366; border-left: 4px solid #3498DB; padding: 12px 20px; border-radius: 4px; font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   MOBILE NAVBAR — Hamburger Menu System
   ═══════════════════════════════════════════════════════════ */

/* Hamburger button — hidden on desktop */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s;
    margin-left: auto;
    position: relative;      /* establishes stacking context */
    z-index: 1001;            /* always above page content */
    -webkit-tap-highlight-color: transparent; /* remove tap flash on iOS */
    touch-action: manipulation;
}
.nav-hamburger:hover { background: rgba(255, 255, 255, 0.14); }
.nav-hamburger:active { background: rgba(255, 255, 255, 0.2); }
.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}
/* Hamburger → X animation */
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer — slides down from navbar */
.nav-mobile-drawer {
    /* Use visibility instead of display:none so CSS transitions work */
    display: block;
    visibility: hidden;
    pointer-events: none;
    position: fixed;
    top: 56px; /* matches mobile navbar height */
    left: 0;
    right: 0;
    background: #002a55;
    border-bottom: 2px solid rgba(255, 195, 37, 0.4);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    z-index: 999;
    padding: 0;
    overflow: hidden;
    transform: translateY(-8px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0.25s; /* delay visibility hide until after transition */
}
.nav-mobile-drawer.open {
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0s; /* show immediately on open */
}

/* Search row inside drawer */
.drawer-search {
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.drawer-search-form {
    position: relative;
    width: 100%;
}
.drawer-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    pointer-events: none;
}
.drawer-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px 10px 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 14px;
    color: white;
    outline: none;
    font-family: 'Inter', sans-serif;
}
.drawer-search-input::placeholder { color: rgba(255, 255, 255, 0.35); }
.drawer-search-input:focus {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 195, 37, 0.55);
}

/* Nav links grid in drawer */
.drawer-nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.drawer-nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
}
.drawer-nav-link:hover, .drawer-nav-link:active {
    background: rgba(255, 255, 255, 0.08);
    color: #FFC325;
}
.drawer-nav-link .drawer-link-icon {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.drawer-nav-link.future-link {
    color: rgba(255, 195, 37, 0.9) !important;
    border: 1px solid rgba(255, 195, 37, 0.2);
    background: rgba(255, 195, 37, 0.04);
}
.drawer-nav-link.future-link:hover {
    background: rgba(255, 195, 37, 0.1) !important;
    border-color: rgba(255, 195, 37, 0.45);
}

/* CTA row in drawer */
.drawer-cta-row {
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.drawer-cta-btn {
    flex: 1;
    background: #FFC325;
    color: #003366;
    text-align: center;
    padding: 11px 16px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    transition: background 0.15s;
}
.drawer-cta-btn:hover { background: #FFD04A; }

/* User row in drawer */
.drawer-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.drawer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #FFC325;
    color: #003366;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
    overflow: hidden;
    border: 2px solid rgba(255, 195, 37, 0.5);
    flex-shrink: 0;
}
.drawer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.drawer-user-name {
    flex: 1;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.drawer-bell {
    position: relative;
    font-size: 20px;
    text-decoration: none;
    padding: 6px;
}
.drawer-logout {
    color: rgba(255, 153, 153, 0.85);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 153, 153, 0.2);
    transition: 0.15s;
}
.drawer-logout:hover { color: #fca5a5; background: rgba(255,100,100,0.08); }

/* Admin/Expert pill in drawer */
.drawer-role-pills {
    display: flex;
    gap: 8px;
    padding: 0 14px 10px;
}

/* Backdrop */
.nav-drawer-backdrop {
    display: block;
    visibility: hidden;
    pointer-events: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 998;
    backdrop-filter: blur(0px);
    transition: background 0.25s ease, backdrop-filter 0.25s ease, visibility 0s linear 0.25s;
}
.nav-drawer-backdrop.open {
    visibility: visible;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    transition: background 0.25s ease, backdrop-filter 0.25s ease, visibility 0s linear 0s;
}

@media (max-width: 768px) {
    /* Hide desktop nav elements on mobile */
    .nav-search-wrap,
    .nav-actions { display: none !important; }

    /* Show hamburger */
    .nav-hamburger { display: flex !important; }

    /* Slim navbar on mobile — MUST be position:relative so z-index works */
    .navbar {
        height: 56px !important;
        padding: 0 16px !important;
        gap: 12px;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        overflow: visible !important; /* don't clip the button */
    }

    .nav-logo-custom {
        height: 72px !important;
        margin-top: 6px;
    }

    /* Drawer sits exactly below the 56px navbar */
    .nav-mobile-drawer {
        display: block;
        top: 56px !important;
    }

    /* Feed layout stacks */
    .prompt-action-bar { flex-direction: column; gap: 10px; align-items: stretch; }
    .prompt-separator { display: none; }
}
/* ═══════════════════════════════════════════════════════
   GLOBAL AVATAR IMAGE FIX
   Ensures ALL circular avatars clip images correctly
   regardless of where they appear in the app.
   ═══════════════════════════════════════════════════════ */
.user-avatar img,
.comment-avatar img,
.nav-avatar img,
.drawer-avatar img,
.user-list-avatar img,
.contributor-avatar img,
.avatar-circle img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 50% !important;
}

/* Ensure the containers themselves always clip */
.user-avatar,
.comment-avatar,
.nav-avatar,
.drawer-avatar,
.user-list-avatar,
.contributor-avatar,
.avatar-circle {
    overflow: hidden !important;
    flex-shrink: 0;
}