/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #5e72e4 0%, #825ee4 100%);
    color: white;
    padding: 12px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
    color: white;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
}

.logo:hover {
    transform: scale(1.05);
    text-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ===== SEARCH ===== */
.search-form {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 380px;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-family: 'Prompt', sans-serif;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
    background: rgba(255,255,255,0.95);
}

.search-input:focus {
    outline: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.search-input::placeholder { color: #999; }

.search-btn {
    padding: 10px 18px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
    white-space: nowrap;
}

.search-btn:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-1px);
}

/* ===== LIVE SEARCH DROPDOWN ===== */
.live-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    z-index: 999;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-top: none;
}

.ls-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: #2d3748;
    transition: background 0.15s;
    border-bottom: 1px solid #f3f4f6;
}

.ls-item:last-child { border-bottom: none; }
.ls-item:hover { background: #f0f4ff; }

.ls-cover {
    width: 42px;
    height: 58px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #f3f4f6;
}

.ls-no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ls-info { flex: 1; min-width: 0; }
.ls-title { font-weight: 600; font-size: 13px; color: #2d3748; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.ls-author { font-size: 11px; color: #888; margin-bottom: 2px; }
.ls-price { font-size: 13px; font-weight: 700; color: #5e72e4; }
.ls-empty { padding: 18px; text-align: center; color: #6b7280; font-size: 13px; }

/* ===== NAV MENU ===== */
.nav-menu {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: nowrap;
    margin-left: auto;
}

.nav-menu > a {
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    position: relative;
    padding: 6px 8px;
    border-radius: 8px;
}

.nav-menu > a:hover {
    background: rgba(255,255,255,0.15);
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ===== NAV ICON LINK ===== */
.nav-icon-link {
    position: relative;
    font-size: 18px;
    padding: 6px !important;
}

.icon-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid rgba(94, 114, 228, 1);
}

/* ===== CART ===== */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid rgba(94, 114, 228, 1);
    animation: notifPulse 2s infinite;
}
@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.notif-bell-link { cursor: pointer; }

.cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cart-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    animation: cartPulse 2s infinite;
}

@keyframes cartPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== LOGIN BUTTON ===== */
.btn-login-header {
    background: rgba(255,255,255,0.2) !important;
    border: 1px solid rgba(255,255,255,0.4) !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
}

.btn-login-header:hover {
    background: rgba(255,255,255,0.3) !important;
}

/* ===== DROPDOWNS ===== */
.category-dropdown,
.profile-dropdown {
    position: relative;
    display: inline-block;
}

.category-toggle,
.profile-name {
    cursor: pointer;
    color: white;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Prompt', sans-serif;
}

.category-toggle:hover,
.profile-name:hover {
    background: rgba(255,255,255,0.15);
}

/* Profile avatar in header */
.profile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
}

.profile-username {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== DROPDOWN CARD ===== */
.dropdown-card {
    position: absolute;
    right: 0;
    top: 120%;
    min-width: 280px;
    background: white;
    color: #333;
    padding: 8px 0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.92);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 999;
    border: 1px solid rgba(0,0,0,0.05);
}

.category-dropdown.active .dropdown-card,
.profile-dropdown.active .dropdown-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-header {
    padding: 12px 20px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7280;
}

/* Profile header in dropdown */
.dropdown-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5e72e4, #825ee4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.dropdown-name {
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
    margin: 0;
}

.dropdown-email {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 6px 0;
}

.dropdown-card a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #2d3748;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.dropdown-card a:hover {
    color: #5e72e4;
    background: rgba(94,114,228,0.06);
    padding-left: 24px;
}

.dropdown-logout {
    color: #f5365c !important;
}

.dropdown-logout:hover {
    color: #d02a4c !important;
    background: rgba(245,54,92,0.06) !important;
}

/* ===== MOBILE MENU BUTTON ===== */
.mobile-menu-btn {
    display: none;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 22px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.mobile-menu-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== MOBILE MENU OVERLAY ===== */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s;
}

.mobile-menu-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* ===== MOBILE MENU ===== */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    z-index: 999;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 24px rgba(0,0,0,0.15);
    overflow: hidden;
    visibility: hidden;
}

.mobile-menu.active {
    right: 0 !important;
    visibility: visible !important;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #5e72e4, #825ee4);
    color: white;
}

.mobile-menu-header .dropdown-avatar {
    background: rgba(255,255,255,0.25);
}

.mobile-menu-header .dropdown-name { color: white; }
.mobile-menu-header .dropdown-email { color: rgba(255,255,255,0.7); }

.mobile-menu-close {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.mobile-menu-body a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    color: #2d3748;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.mobile-menu-body a:hover {
    background: rgba(94,114,228,0.06);
    color: #5e72e4;
}

.mobile-sub-item {
    padding-left: 36px !important;
    font-size: 13px !important;
    color: #4b5563 !important;
}

.mobile-divider {
    height: 1px;
    background: #eee;
    margin: 8px 20px;
}

.mobile-logout {
    color: #f5365c !important;
}

.mobile-login-btn {
    color: #5e72e4 !important;
    font-weight: 600 !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header { padding: 10px 0; }
    
    .header-container {
        gap: 10px;
        flex-wrap: wrap;
        padding: 0 12px;
    }

    .logo { font-size: 18px; }

    .search-form {
        flex: 1 1 100%;
        order: 3;
        min-width: 100%;
        margin-top: 8px;
        max-width: 100%;
    }

    .search-input { padding: 8px 12px !important; font-size: 13px !important; }
    .search-btn { padding: 8px 12px !important; }

    .nav-menu { display: none; }
    
    .mobile-menu-btn { display: block; }
}

@media (max-width: 480px) {
    .header-container { flex-direction: row; flex-wrap: wrap; gap: 8px; }
    .logo { font-size: 16px; }
    .search-form { margin-top: 4px; }
    .search-input { padding: 6px 10px !important; font-size: 12px !important; }
    .mobile-menu { width: 280px; }
}

/* ===== DARK MODE ===== */
body.dark-mode .header {
    background: linear-gradient(135deg, #1e3a5f 0%, #3b1f6e 100%);
}
body.dark-mode .search-input {
    background: rgba(0,0,0,0.3);
    color: white;
}
body.dark-mode .search-input::placeholder { color: rgba(255,255,255,0.6); }

body.dark-mode .live-search-dropdown {
    background: #1e293b;
    border-color: #334155;
}
body.dark-mode .search-item {
    color: #e2e8f0;
}
body.dark-mode .search-item:hover {
    background: #334155;
}
body.dark-mode .search-item .item-title {
    color: #e2e8f0;
}
body.dark-mode .search-item .item-author {
    color: #94a3b8;
}

body.dark-mode .dropdown-card {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
body.dark-mode .dropdown-card a {
    color: #e2e8f0;
}
body.dark-mode .dropdown-card a:hover {
    background: #334155;
}
body.dark-mode .dd-user-name { color: #e2e8f0; }
body.dark-mode .dd-user-email { color: #94a3b8; }
body.dark-mode .dd-divider { border-color: #334155; }
body.dark-mode .cat-grid a {
    color: #e2e8f0;
}
body.dark-mode .cat-grid a:hover {
    background: #334155;
    color: #818cf8;
}

body.dark-mode .mobile-menu {
    background: #1e293b;
    box-shadow: -8px 0 24px rgba(0,0,0,0.4);
}
body.dark-mode .mobile-menu-header {
    background: linear-gradient(135deg, #1e3a5f, #3b1f6e);
}
body.dark-mode .mobile-nav a {
    color: #e2e8f0;
    border-bottom-color: #334155;
}
body.dark-mode .mobile-nav a:hover {
    background: #334155;
    color: #818cf8;
}
body.dark-mode .mobile-divider {
    border-color: #334155;
}
body.dark-mode .mobile-login-btn {
    border-color: #818cf8 !important;
    color: #818cf8 !important;
}
body.dark-mode .mobile-menu-overlay {
    background: rgba(0,0,0,0.6);
}
