/*
 * Modern Header V2 - Complete Redesign
 * Clean, professional, and contemporary
 * Author: Claude Code
 * Date: 2025
 */

/* ============================================
   MODERN HEADER V2 - BASE STYLES
   ============================================ */
.modern-header-v2 {
    background: #ffffff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.modern-header-v2 .container {
    max-width: 1400px;
}

.modern-header-v2 .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 32px;
}

/* ============================================
   MOBILE MENU TOGGLE
   ============================================ */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: #1e293b;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover span {
    background: #667eea;
}

/* ============================================
   LOGO
   ============================================ */
.header-logo a {
    display: block;
}

.header-logo img {
    height: 45px;
    width: auto;
    transition: all 0.3s ease;
}

.header-logo .logo-small {
    display: none;
}

.header-logo:hover img {
    transform: scale(1.05);
}

/* ============================================
   MAIN NAVIGATION
   ============================================ */
.header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-header-mobile {
    display: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: #334155;
    font-weight: 500;
    font-size: 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.08);
    color: #667eea;
    text-decoration: none;
}

.nav-link i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.nav-item.has-dropdown:hover > .nav-link i {
    transform: rotate(180deg);
}

.nav-item.mobile-only {
    display: none;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 8px;
    min-width: 220px;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    list-style: none;
}

.nav-item.has-dropdown:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 10px 14px;
    color: #475569;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    text-decoration: none;
    transform: translateX(4px);
}

/* ============================================
   HEADER ACTIONS
   ============================================ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-action-item {
    position: relative;
}

/* Action Buttons */
.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn i {
    font-size: 18px;
}

.action-btn:hover {
    background: #f8fafc;
    color: #667eea;
}

/* Primary Action Button */
.btn-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff !important;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.btn-primary-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    text-decoration: none;
}

/* Secondary Action Button */
.btn-secondary-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    color: #334155;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.btn-secondary-action:hover {
    background: #f8fafc;
    border-color: #667eea;
    color: #667eea;
}

/* Badge Count */
.badge-count {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border-radius: 12px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    border: 2px solid #ffffff;
}

/* Currency Selector */
.currency-select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.currency-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* User Avatar */
.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    background: none;
}

.user-avatar:hover {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   DROPDOWNS (Notifications, Chat, User)
   ============================================ */
.notification-dropdown,
.chat-dropdown,
.user-dropdown,
.register-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    min-width: 360px;
    max-height: 500px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid #f1f5f9;
}

.show .notification-dropdown,
.show .chat-dropdown,
.show .user-dropdown,
.show .register-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Header */
.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.clear-all {
    color: #667eea;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-all:hover {
    color: #764ba2;
}

/* Dropdown Body */
.dropdown-body {
    max-height: 360px;
    overflow-y: auto;
}

/* Notification/Chat Items */
.notification-item-link,
.chat-item-link {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    transition: all 0.2s ease;
    color: inherit;
}

.notification-item-link:hover,
.chat-item-link:hover {
    background: #f8fafc;
    text-decoration: none;
}

.notification-avatar,
.chat-avatar {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
}

.notification-avatar img,
.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notification-content,
.chat-content {
    flex: 1;
    min-width: 0;
}

.notification-text,
.chat-content h5 {
    margin: 0 0 4px;
    font-size: 14px;
    color: #334155;
    font-weight: 500;
}

.chat-content p {
    margin: 4px 0;
    font-size: 13px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-time,
.chat-time {
    font-size: 12px;
    color: #94a3b8;
}

/* Empty State */
.empty-state {
    padding: 40px 20px;
    text-align: center;
}

.empty-state p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0;
}

/* Dropdown Footer */
.dropdown-footer {
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}

.dropdown-footer a {
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-footer a:hover {
    color: #764ba2;
    text-decoration: none;
}

/* User Dropdown Specific */
.user-dropdown {
    min-width: 280px;
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.user-avatar-large {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.user-info p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.user-dropdown-body {
    padding: 8px;
}

.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #475569;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.user-dropdown .dropdown-item i {
    width: 20px;
    text-align: center;
    color: #667eea;
}

.user-dropdown .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    text-decoration: none;
}

.user-dropdown .dropdown-item.logout {
    color: #ef4444;
}

.user-dropdown .dropdown-item.logout i {
    color: #ef4444;
}

.user-dropdown .dropdown-divider {
    margin: 8px 0;
    border-top: 1px solid #f1f5f9;
}

/* Register Dropdown */
.register-dropdown {
    min-width: 250px;
}

.register-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #475569;
    font-size: 14px;
    transition: all 0.2s ease;
}

.register-dropdown .dropdown-item i {
    color: #667eea;
}

.register-dropdown .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    text-decoration: none;
}

/* Language Dropdown */
.lang-selector .dropdown-menu {
    min-width: 180px;
}

.lang-selector .dropdown-item {
    padding: 12px 16px;
    color: #475569;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.lang-selector .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    text-decoration: none;
}

/* ============================================
   MOBILE OVERLAY
   ============================================ */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
    .nav-link {
        padding: 10px 14px;
        font-size: 14px;
    }

    .header-actions {
        gap: 8px;
    }
}

@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: flex;
        order: -1;
    }

    .header-logo {
        order: 1;
        flex: 1;
        text-align: center;
    }

    .header-logo .logo-full {
        display: none;
    }

    .header-logo .logo-small {
        display: inline-block;
    }

    .header-actions {
        order: 2;
    }

    /* Mobile Navigation */
    .header-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        height: 100vh;
        background: #ffffff;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        overflow-y: auto;
        transition: left 0.4s ease;
        justify-content: flex-start;
        padding: 0;
    }

    .header-nav.active {
        left: 0;
    }

    .nav-header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid #f1f5f9;
        position: sticky;
        top: 0;
        background: #ffffff;
        z-index: 10;
    }

    .nav-mobile-logo {
        height: 35px;
    }

    .nav-close {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f8fafc;
        border-radius: 8px;
        border: none;
        color: #334155;
        font-size: 20px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .nav-close:hover {
        background: #ef4444;
        color: #ffffff;
    }

    .nav-menu {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 4px;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        justify-content: space-between;
        padding: 14px 16px;
    }

    .nav-item.mobile-only {
        display: block;
    }

    .nav-item.desktop-only {
        display: none;
    }

    /* Mobile Dropdown */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f8fafc;
        margin-top: 8px;
        margin-left: 16px;
        display: none;
    }

    .nav-item.has-dropdown.active > .dropdown-menu {
        display: block;
    }

    .desktop-only {
        display: none !important;
    }

    .header-action-item.desktop-only {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .modern-header-v2 .header-content {
        padding: 12px 0;
    }

    .header-logo img {
        height: 35px;
    }

    .btn-primary-action,
    .btn-secondary-action {
        padding: 10px 18px;
        font-size: 13px;
    }

    .notification-dropdown,
    .chat-dropdown,
    .user-dropdown {
        min-width: 300px;
        max-width: calc(100vw - 40px);
    }

    .header-nav {
        width: 280px;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
.dropdown-body::-webkit-scrollbar,
.header-nav::-webkit-scrollbar {
    width: 6px;
}

.dropdown-body::-webkit-scrollbar-track,
.header-nav::-webkit-scrollbar-track {
    background: #f8fafc;
}

.dropdown-body::-webkit-scrollbar-thumb,
.header-nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dropdown-body::-webkit-scrollbar-thumb:hover,
.header-nav::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   HEADER SCROLL EFFECT
   ============================================ */
.modern-header-v2.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

.modern-header-v2.scrolled .header-content {
    padding: 12px 0;
}

/* ============================================
   ACCESSIBILITY - FOCUS INDICATORS
   ============================================ */
.nav-link:focus,
.action-btn:focus,
.btn-primary-action:focus,
.btn-secondary-action:focus,
.user-avatar:focus {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    z-index: 10000;
    transition: top 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.skip-to-content:focus {
    top: 20px;
    color: white;
}

/* ============================================
   ENHANCED ANIMATIONS
   ============================================ */
/* Logo subtle rotation */
.header-logo:hover img {
    transform: scale(1.05) rotate(2deg);
}

/* Notification bell shake */
.notification-item .action-btn:hover i,
.chat-item .action-btn:hover i {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-5deg); }
    20%, 40%, 60%, 80% { transform: rotate(5deg); }
}

/* User avatar enhanced hover */
.user-avatar:hover {
    animation: borderPulse 1.5s ease-in-out;
}

@keyframes borderPulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0.15);
    }
}

/* Badge pulse animation */
.badge-count {
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ============================================
   DROPDOWN FIX - Ensure Bootstrap Dropdowns Work
   ============================================ */

/* Make sure dropdown menus are positioned correctly */
.header-action-item {
    position: relative;
}

.header-action-item .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    left: auto !important;
    right: 0 !important;
    z-index: 1050 !important;
    display: none;
    min-width: 200px;
    margin-top: 8px;
}

/* Show dropdown when active */
.header-action-item.show .dropdown-menu,
.header-action-item .dropdown-menu.show {
    display: block !important;
}

/* Dropdown toggle button */
.header-action-item .dropdown-toggle {
    cursor: pointer;
    position: relative;
}

/* Ensure dropdown items are clickable */
.dropdown-menu .dropdown-item {
    cursor: pointer;
    display: block;
    width: 100%;
    padding: 10px 20px;
    clear: both;
    font-weight: 400;
    color: #222;
    text-align: left;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    transition: all 0.2s ease;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    background-color: #f7f7f7;
    color: #667eea;
    text-decoration: none;
}

/* Mobile dropdown */
.nav-item.has-dropdown {
    position: relative;
}

.nav-item.has-dropdown .dropdown-menu {
    position: static;
    display: none;
    background: #f7f7f7;
    border: none;
    box-shadow: none;
    padding: 8px 0;
}

.nav-item.has-dropdown.show .dropdown-menu {
    display: block;
}

/* ==================================================
   CRITICAL DROPDOWN VISIBILITY FIX
   ================================================== */

/* Force dropdown menus to be visible when show class is active */
.header-action-item.show .dropdown-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.nav-item.has-dropdown.show .dropdown-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure dropdown is hidden by default */
.header-action-item .dropdown-menu,
.nav-item.has-dropdown .dropdown-menu {
    display: none;
    visibility: hidden;
    opacity: 0;
}

/* Override any conflicting styles */
.dropdown-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
