/* ============================================================
 * SKY EDU - Shared Navbar Styles
 * ------------------------------------------------------------
 * Component được render bởi assets/js/navbar.js
 * Style bổ sung cho: user-dropdown, responsive menu,
 * light-premium mode, khoảng cách an toàn khi navbar fixed.
 * ============================================================ */

/* ============================
   NAVBAR CONTAINER & CONTENT
   ============================ */
.navbar-content {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 100% !important;
    width: 100% !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 0 24px !important;
    box-sizing: border-box !important;
    flex: 1 !important;
}

/* Logo */
.logo-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, #60A5FA 0%, #00D4FF 50%, #A78BFA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.logo-subtitle {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 9px;
    color: #94A3B8;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Nav Center */
.nav-center {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

/* Nav Actions */
.nav-actions {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
}

/* Auth buttons */
.btn-ghost {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #94A3B8;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.btn-primary-sm {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    color: #0A1426;
    text-decoration: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #00D4FF, #3B82F6);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.25);
    transition: all 0.2s ease;
}

.btn-primary-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 191, 255, 0.35);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.mobile-menu-btn span {
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

/* ============================
   USER DROPDOWN
   ============================ */
.user-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    max-width: 200px;
    padding: 8px 14px;
    background: rgba(0, 212, 255, 0.10);
    border: 1px solid rgba(0, 212, 255, 0.22);
    border-radius: 12px;
    color: #00D4FF;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;
}

.user-dropdown-btn:hover {
    background: rgba(0, 212, 255, 0.18);
    border-color: rgba(0, 212, 255, 0.45);
    transform: translateY(-1px);
}

.user-dropdown-btn:focus-visible,
.dropdown-item:focus-visible,
.mobile-menu-btn:focus-visible,
.notif-bell-btn:focus-visible,
.notif-mark-all:focus-visible {
    outline: 3px solid #00D4FF;
    outline-offset: 3px;
}

/* ============================
   USER CARD (non-interactive)
   Dùng cho các trang KHÔNG có dropdown.
   Giữ nguyên giao diện, chỉ bỏ hành vi mở menu.
   ============================ */
.user-card-static .user-dropdown-btn {
    cursor: default;
}

.user-card-static .user-dropdown-btn:focus-visible {
    outline: none;
}

.user-dropdown-btn iconify-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.user-dropdown-btn .chev {
    transition: transform 0.25s ease;
}

.user-dropdown.open .user-dropdown-btn .chev {
    transform: rotate(180deg);
}

.user-dropdown-name {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 8px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 212, 255, 0.06);
    z-index: 1100;
    animation: navDropdownFade 0.18s ease;
}

@keyframes navDropdownFade {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.user-dropdown.open .user-dropdown-content {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    color: #E2E8F0;
    background: transparent;
    border: 0;
    text-align: left;
    text-decoration: none;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.18s ease;
    cursor: pointer;
    line-height: 1.2;
}

.dropdown-item:hover {
    background: rgba(0, 212, 255, 0.12);
    color: #00D4FF;
}

.dropdown-item iconify-icon {
    font-size: 16px;
    color: #94A3B8;
    flex-shrink: 0;
}

.dropdown-item:hover iconify-icon {
    color: #00D4FF;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 6px 4px;
}

.dropdown-item.logout {
    color: #EF4444;
}
.dropdown-item.logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}
.dropdown-item.logout iconify-icon { color: #EF4444; }

.dropdown-item.admin-only { color: #FACC15; }
.dropdown-item.admin-only iconify-icon { color: #FACC15; }
.dropdown-item.admin-only:hover {
    background: rgba(250, 204, 21, 0.10);
    color: #FACC15;
}

/* Light Premium Mode */
.light-premium-mode .user-dropdown-btn {
    background: rgba(124, 58, 237, 0.10);
    border-color: rgba(124, 58, 237, 0.22);
    color: #7C3AED;
}
.light-premium-mode .user-dropdown-btn:hover {
    background: rgba(124, 58, 237, 0.18);
    border-color: rgba(124, 58, 237, 0.45);
}
.light-premium-mode .user-dropdown-content {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(124, 58, 237, 0.18);
    box-shadow: 0 20px 40px rgba(124, 58, 237, 0.18);
}
.light-premium-mode .dropdown-item { color: #1E293B; }
.light-premium-mode .dropdown-item:hover {
    background: rgba(124, 58, 237, 0.10);
    color: #7C3AED;
}
.light-premium-mode .dropdown-item iconify-icon { color: #94A3B8; }
.light-premium-mode .dropdown-item:hover iconify-icon { color: #7C3AED; }
.light-premium-mode .dropdown-divider { background: rgba(124, 58, 237, 0.12); }
.light-premium-mode .dropdown-item.logout:hover { background: rgba(239, 68, 68, 0.10); }

/* ============================
   RESPONSIVE BREAKPOINTS
   ============================ */

/* Hide user-dropdown-name when name gets long */
@media (max-width: 1100px) {
    .user-dropdown-btn .user-dropdown-name { display: none; }
    .user-dropdown-btn { padding: 8px 12px; }
}

/* Tablet: collapse nav-center, show mobile-menu-btn */
@media (max-width: 1024px) {
    .nav-center { display: none; }
    .mobile-menu-btn { display: inline-flex !important; }
    .nav-auth-btn { display: none !important; }
}

/* Phones: tighten spacing */
@media (max-width: 480px) {
    .navbar-content { padding: 0 12px !important; gap: 8px; }
    .logo-text { display: none; }
    .user-dropdown-content { min-width: 200px; right: -8px; }
    .user-dropdown-btn { padding: 8px 10px; }
}

/* Restore desktop */
@media (min-width: 1025px) {
    .nav-center { display: flex !important; }
    .mobile-menu-btn { display: none !important; }
    .nav-auth-btn { display: inline-flex; }
}

/* ============================
   MOBILE MENU OVERLAY
   ============================ */
.nav-center.active {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 70px 16px 32px;
    background: rgba(5, 11, 26, 0.98);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    z-index: 998;
    flex-direction: column;
    animation: navMenuSlideDown 0.25s ease;
    overflow-y: auto;
}

/* Mobile menu close button */
.mobile-menu-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s ease;
    z-index: 999;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    color: #EF4444;
}

.nav-center.active .mobile-menu-close {
    display: flex;
}

.nav-center.active .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 4px;
    margin-top: 20px;
}

.nav-center.active .nav-links li {
    width: 100%;
}

.nav-center.active .nav-links li a {
    display: block;
    padding: 14px 18px;
    width: 100%;
    font-size: 15px;
    border-radius: 12px;
}

/* Mobile menu footer with auth buttons */
.nav-center.active .mobile-menu-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-center.active .mobile-menu-footer .btn-ghost,
.nav-center.active .mobile-menu-footer .btn-primary-sm {
    display: flex !important;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
}

.light-premium-mode .nav-center.active {
    background: rgba(253, 242, 248, 0.98);
    border-bottom-color: rgba(124, 58, 237, 0.15);
}

/* Hamburger animation */
.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================
   NOTIFICATION BELL (Dashboard)
   ============================ */
.notif-bell { position: relative; display: inline-flex; }
.notif-bell-btn {
    position: relative;
    background: rgba(0,212,255,0.08);
    border: 1px solid rgba(0,212,255,0.22);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #00D4FF;
    transition: all 0.2s ease;
}
.notif-bell-btn:hover {
    background: rgba(0,212,255,0.18);
    border-color: rgba(0,212,255,0.45);
}
.notif-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #EF4444;
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.notif-bell-badge[hidden] { display: none; }
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 24px);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.45);
    z-index: 1100;
    overflow: hidden;
    animation: navDropdownFade 0.18s ease;
}
.notif-bell.open .notif-dropdown { display: block; }
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-weight: 700;
    color: #E2E8F0;
    font-size: 14px;
}
.notif-mark-all {
    background: none;
    border: none;
    color: #00D4FF;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 0;
    font-family: inherit;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-dropdown-body { max-height: 380px; overflow-y: auto; }
.notif-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.notif-item:hover { background: rgba(0,212,255,0.08); }
.notif-item.unread { background: rgba(0,212,255,0.05); }
.notif-item-title {
    font-weight: 700;
    font-size: 13px;
    color: #E2E8F0;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.notif-item-title .dot {
    width: 6px;
    height: 6px;
    background: transparent;
    border-radius: 50%;
    display: inline-block;
}
.notif-item.unread .dot { background: #00D4FF; }
.notif-item-msg {
    font-size: 12px;
    color: #94A3B8;
    line-height: 1.5;
}
.notif-item-time {
    font-size: 11px;
    color: #64748B;
    margin-top: 4px;
}
.notif-empty {
    padding: 24px 16px;
    text-align: center;
    color: #64748B;
    font-size: 13px;
}

/* Light Premium Mode */
.light-premium-mode .notif-bell-btn {
    background: rgba(124,58,237,0.10);
    border-color: rgba(124,58,237,0.22);
    color: #7C3AED;
}
.light-premium-mode .notif-dropdown {
    background: rgba(255,255,255,0.96);
    border-color: rgba(124,58,237,0.18);
    box-shadow: 0 20px 40px rgba(124,58,237,0.18);
}
.light-premium-mode .notif-dropdown-header {
    color: #1E293B;
    border-color: rgba(124,58,237,0.18);
}
.light-premium-mode .notif-item {
    border-color: rgba(124,58,237,0.08);
}
.light-premium-mode .notif-item.unread {
    background: rgba(124,58,237,0.05);
}
.light-premium-mode .notif-item-title {
    color: #1E293B;
}
.light-premium-mode .notif-item-msg {
    color: #475569;
}
.light-premium-mode .notif-mark-all { color: #7C3AED; }

/* ================================================================
   GLOBAL NAVBAR CONSISTENCY FIXES
   ================================================================ */

/* Ensure navbar container is properly sized */
.navbar {
    height: 70px;
    padding: 0;
}

/* Safe area support for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .navbar {
        padding-top: env(safe-area-inset-top);
        height: calc(70px + env(safe-area-inset-top));
    }
}

/* App navbar must be full width */
#app-navbar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Nav center must center vertically */
.nav-center {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
}

/* Ensure nav-actions stays on right */
.nav-actions {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
}

/* Responsive: show mobile menu on smaller screens */
@media (max-width: 1024px) {
    .nav-center {
        display: none !important;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
    .nav-actions .btn-ghost,
    .nav-actions .btn-primary-sm {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .logo-text {
        display: none !important;
    }
    .navbar-content {
        padding: 0 12px !important;
    }
}

/* Force navbar-content to be centered */
.navbar-content {
    width: 100%;
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 0 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
}

/* ================================================================
   RESPONSIVE SAFE AREAS FOR MOBILE
   ================================================================ */
@media (max-width: 768px) {
    .navbar {
        height: 60px;
    }
    
    @supports (padding-top: env(safe-area-inset-top)) {
        .navbar {
            height: calc(60px + env(safe-area-inset-top));
        }
    }
    
    .navbar-content {
        padding: 0 16px !important;
    }
}

@media (max-width: 480px) {
    .navbar {
        height: 56px;
    }
    
    @supports (padding-top: env(safe-area-inset-top)) {
        .navbar {
            height: calc(56px + env(safe-area-inset-top));
        }
    }
    
    .navbar-content {
        padding: 0 12px !important;
    }
}