/* ==========================================================================
   Modern Header & Navigation — Target Pipeline v2
   Based on style_guide.md
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---------- Header Container ---------- */
header {
    background: linear-gradient(180deg, #1e3a5f 0%, #152a45 100%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 60px;
}

header .wrapper {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 60px;
}

/* ---------- Logo ---------- */
header .logo {
    height: 32px;
    width: auto;
    transition: opacity 0.2s ease;
}

header .logo:hover {
    opacity: 0.85;
}

/* ---------- Navigation Menu ---------- */
#nav_menu {
    flex: 1;
    margin: 0 24px;
}

#nav_menu ul {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

#nav_menu ul li a {
    display: block;
    padding: 10px 18px;
    color: rgba(255, 255, 255, 0.75);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

#nav_menu ul li a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

#nav_menu ul li a.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

/* ---------- Right Section (Search + User) ---------- */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

/* ---------- Search Input ---------- */
.header-search {
    position: relative;
    z-index: 10001;
}

.header-search input {
    width: 220px;
    padding: 8px 14px 8px 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    transition: all 0.2s ease;
}

.header-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.header-search input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    width: 280px;
    color: #ffffff;
}

.header-search:focus-within > i {
    display: none;
}

.header-search:focus-within input {
    padding-left: 14px;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

/* ---------- User Menu ---------- */
.user-menu-wrapper {
    position: relative;
}

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
}

.user-avatar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
}

.user-avatar-btn .fa-chevron-down {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.7;
}

/* ---------- User Dropdown ---------- */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
    z-index: 1001;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.user-dropdown-header .user-name {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.user-dropdown-header .user-email {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.user-dropdown-menu {
    padding: 6px;
}

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #475569;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.user-dropdown-menu a:hover {
    background: #f8fafc;
    color: #1e293b;
}

.user-dropdown-menu a i {
    width: 18px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

.user-dropdown-menu .divider {
    height: 1px;
    background: #f1f5f9;
    margin: 4px 0;
}

.user-dropdown-menu a.switch-view {
    color: #3b82f6;
}

.user-dropdown-menu a.switch-view i {
    color: #3b82f6;
}

.user-dropdown-menu a.logout {
    color: #dc2626;
}

.user-dropdown-menu a.logout i {
    color: #dc2626;
}

/* ---------- Admin Viewer Banner ---------- */
.admin-viewer-banner {
    background: #f59e0b;
    padding: 8px 24px;
    color: #1e293b;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-viewer-banner a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.admin-viewer-banner a:hover {
    text-decoration: underline;
}

/* ---------- Search Results Dropdown ---------- */
#results_search {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 420px;
    max-width: 90vw;
    max-height: 60vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    z-index: 10000;
    display: none;
}

#results_search .section-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 20px;
}

#results_search ul,
#results_search li {
    list-style: none;
    margin: 0;
    padding: 0;
}

#results_search li a {
    display: block;
    padding: 14px 20px;
    color: #334155;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

#results_search li:hover {
    background: #f8fafc;
}

#results_search b {
    color: #10b981;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    #nav_menu ul li a {
        padding: 10px 12px;
        font-size: 13px;
    }

    .header-search input {
        width: 180px;
    }

    .header-search input:focus {
        width: 220px;
    }
}

@media (max-width: 992px) {
    header {
        height: auto;
    }

    header .wrapper {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
    }

    #nav_menu {
        order: 3;
        width: 100%;
        margin: 12px 0 0 0;
    }

    #nav_menu ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-search {
        order: 2;
    }
}

@media (max-width: 768px) {
    #nav_menu ul li a {
        padding: 8px 10px;
        font-size: 12px;
    }

    .header-search input {
        width: 150px;
    }

    .user-avatar-btn .user-display-name {
        display: none;
    }
}
