/* =====================================================================
   iOSSpecialist Expert — Header CSS
   Floating Glassmorphism Navbar · Dark Mode · SF Pro
   ===================================================================== */

/* --- Main Header --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Floating pill container */
.header-nav-wrapper {
    margin: 12px 20px;
    background: rgba(10, 10, 15, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 32px;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.07);
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    z-index: 1001; /* Fixes overlap over search bar */
}

.main-header.scrolled .header-nav-wrapper {
    background: rgba(10, 10, 15, 0.88);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,122,255,0.08), inset 0 1px 0 rgba(255,255,255,0.07);
}

/* --- Brand Logo --- */
.navbar-brand {
    font-family: 'SF Pro Display', -apple-system, sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff !important;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    text-decoration: none;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #007AFF, #5AC8FA);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,122,255,0.4);
}

.brand-dot {
    width: 6px;
    height: 6px;
    background: #007AFF;
    border-radius: 50%;
    display: inline-block;
    margin-left: 2px;
    box-shadow: 0 0 8px #007AFF;
    animation: blink-dot 2s ease-in-out infinite;
}

@keyframes blink-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px #007AFF; }
    50%       { opacity: 0.4; box-shadow: 0 0 4px #007AFF; }
}

/* --- Desktop Navigation --- */
.navbar-nav-desktop {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item { position: relative; }

.nav-link {
    font-family: 'SF Pro Text', -apple-system, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255,255,255,0.72) !important;
    padding: 8px 14px !important;
    border-radius: 20px;
    transition: all 200ms ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    cursor: pointer;
}

.nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.07);
}

.nav-link.active {
    color: #007AFF !important;
    background: rgba(0,122,255,0.1);
}

/* Dropdown arrow */
.nav-link.dropdown-toggle::after {
    border: none;
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    margin-left: 2px;
    transition: transform 200ms ease;
}
.nav-link.dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    background: rgba(28, 28, 40, 0.92) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06) !important;
    backdrop-filter: blur(20px) !important;
    padding: 8px !important;
    min-width: 200px;
    margin-top: 8px !important;
}

.dropdown-item {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255,255,255,0.72) !important;
    padding: 10px 14px;
    border-radius: 10px;
    transition: all 150ms ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    opacity: 0.6;
}

.dropdown-item:hover {
    background: rgba(0,122,255,0.12) !important;
    color: #007AFF !important;
}
.dropdown-item:hover i { opacity: 1; }

.dropdown-item.text-danger {
    color: #FF3B30 !important;
}
.dropdown-item.text-danger:hover {
    background: rgba(255,59,48,0.1) !important;
    color: #FF3B30 !important;
}

.dropdown-divider {
    border-color: rgba(255,255,255,0.07) !important;
    margin: 4px 0 !important;
}

/* --- Right Side Actions --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Login Button */
.btn-header-login {
    font-family: 'SF Pro Text', -apple-system, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: #007AFF;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 4px 16px rgba(0,122,255,0.35);
}
.btn-header-login:hover {
    background: #40a9ff;
    color: #fff;
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0,122,255,0.45);
}

/* Profile Dropdown */
.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px 6px 6px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 200ms ease;
    background: rgba(255,255,255,0.05);
}
.profile-trigger:hover {
    border-color: rgba(0,122,255,0.3);
    background: rgba(0,122,255,0.06);
}

.profile-avatar-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0,122,255,0.4);
}

.profile-info-text {
    display: none;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .profile-info-text { display: flex; }
}

.profile-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.profile-balance {
    font-size: 0.7rem;
    color: #007AFF;
    font-weight: 600;
    line-height: 1.2;
}

/* --- Header Bottom Search Bar --- */
.header-search-bar {
    background: rgba(20, 20, 30, 0.7);
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 10px 44px;
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 1000;
}

.search-input-wrap {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-input-wrap input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 20px;
    color: #fff;
    font-family: 'SF Pro Text', -apple-system, sans-serif;
    font-size: 0.875rem;
    padding: 9px 18px 9px 38px;
    transition: all 200ms ease;
    outline: none;
}

.search-input-wrap input::placeholder {
    color: rgba(255,255,255,0.28);
}

.search-input-wrap input:focus {
    border-color: rgba(0,122,255,0.4);
    background: rgba(0,122,255,0.06);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

/* --- Mobile Hamburger --- */
.navbar-toggler-ios {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
}

.navbar-toggler-ios span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,0.75);
    border-radius: 2px;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.navbar-toggler-ios.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.navbar-toggler-ios.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.navbar-toggler-ios.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Mobile Offcanvas --- */
.offcanvas.mobile-menu {
    background: #0a0a0f;
    border-right: 1px solid rgba(255,255,255,0.07);
    width: 300px !important;
}

.mobile-menu-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu-close {
    background: rgba(255,255,255,0.08);
    border: none;
    color: rgba(255,255,255,0.6);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 150ms ease;
}
.mobile-menu-close:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

.mobile-user-card {
    margin: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0,122,255,0.4);
}

.mobile-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.mobile-user-balance {
    font-size: 0.78rem;
    color: #007AFF;
    font-weight: 600;
}

.mobile-nav-list {
    list-style: none;
    padding: 8px 12px;
    margin: 0;
}

.mobile-nav-item a,
.mobile-nav-item button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 150ms ease;
    text-align: left;
}

.mobile-nav-item a:hover,
.mobile-nav-item button:hover {
    background: rgba(0,122,255,0.1);
    color: #007AFF;
}

.mobile-nav-item a i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.7;
}

.mobile-nav-section {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.2);
    padding: 12px 26px 6px;
}

.mobile-auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.07);
}

/* --- Header Top Bar (hidden on mobile) --- */
.header-top-bar {
    display: none;
}
@media (min-width: 992px) {
    .header-top-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 0.78rem;
        padding: 6px 44px;
        background: rgba(5,5,10,0.5);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255,255,255,0.04);
        color: rgba(255,255,255,0.4);
    }
    .header-top-bar a {
        color: rgba(255,255,255,0.4);
        text-decoration: none;
        transition: color 150ms ease;
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }
    .header-top-bar a:hover { color: rgba(255,255,255,0.75); }
}

/* --- Responsive --- */
@media (max-width: 991px) {
    .navbar-nav-desktop { display: none; }
    .header-nav-wrapper {
        margin: 8px 12px;
        padding: 8px 16px;
    }
    .profile-info-text { display: none; }
}

@media (min-width: 992px) {
    .navbar-toggler-ios { display: none; }
}

/* --- Page Skeleton Loader --- */
#page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    z-index: 9999;
    transition: opacity 400ms ease, visibility 400ms ease;
    padding-top: 12px;
}
#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes skeleton-shimmer-anim {
    0% { background-position: -800px 0; }
    100% { background-position: 800px 0; }
}

.skeleton-shimmer {
    background: rgba(255,255,255,0.03);
    background-image: linear-gradient(to right, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.08) 20%, rgba(255,255,255,0.03) 40%, rgba(255,255,255,0.03) 100%);
    background-repeat: no-repeat;
    background-size: 800px 100%;
    animation: skeleton-shimmer-anim 1.5s infinite linear;
    border-radius: var(--radius-md);
}

.skeleton-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 40px;
    margin: 0 20px 20px;
    height: 60px;
    border-radius: 32px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
}
.skeleton-logo { width: 120px; height: 24px; border-radius: 6px; }
.skeleton-nav { display: flex; gap: 16px; flex: 1; justify-content: center; }
.skeleton-nav-item { width: 80px; height: 20px; border-radius: 4px; }
.skeleton-profile { width: 100px; height: 36px; border-radius: 18px; }

.skeleton-content { padding: 0 20px; width: 100%; }
.skeleton-title { width: 200px; height: 32px; border-radius: 8px; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }
.skeleton-table { height: 300px; border-radius: var(--radius-lg); }

@media (max-width: 768px) {
    .skeleton-header { margin: 0 10px 20px; padding: 10px 20px; }
    .skeleton-nav { display: none; }
}
@keyframes loader-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}