/* ==========================================
   Header Inline Styles - Optimized & Fixed
   ========================================== */
header.home-header .profile-dropdown,
header.home-header .profile-dropdown * {
    color: #1f2937 !important;
}

header.home-header .profile-dropdown .bg-white,
header.home-header .profile-dropdown [style*="background: #ffffff"] {
    background: #fff !important;
}

header.home-header .profile-dropdown .bg-gray-50,
header.home-header .profile-dropdown [style*="background: #f9fafb"] {
    background: #f9fafb !important;
}

header.home-header .profile-dropdown a,
header.home-header .profile-dropdown button,
header.home-header .profile-dropdown span,
header.home-header .profile-dropdown p {
    color: #111827 !important;
}

header.home-header .profile-dropdown [style*="color: #111827"] { color: #111827 !important; }
header.home-header .profile-dropdown [style*="color: #4b5563"] { color: #4b5563 !important; }
header.home-header .profile-dropdown [style*="color: #dc2626"] { color: #dc2626 !important; }
header.home-header .profile-dropdown [style*="color: #16a34a"] { color: #16a34a !important; }

@media (max-width:1023px) {
    header.home-header .profile-dropdown {
        position: fixed !important;
        top: 60px !important;
        right: 1rem !important;
        left: auto !important;
        width: calc(100vw - 2rem) !important;
        max-width: 320px !important;
        margin-top: .5rem !important;
        z-index: 9999 !important;
    }
}

[x-cloak] { display: none !important; }

header.home-header .profile-dropdown > div {
    background: #fff !important;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,.1),
                0 10px 10px -5px rgba(0,0,0,.04) !important;
    border: 1px solid #e5e7eb !important;
}

@media (max-width:640px) {
    header.home-header .profile-dropdown {
        width: calc(100vw - 1rem) !important;
        max-width: none !important;
        right: .5rem !important;
    }
    header.home-header .profile-dropdown .px-6 { padding-left: 1rem !important; padding-right: 1rem !important; }
    header.home-header .profile-dropdown .px-4 { padding-left: .875rem !important; padding-right: .875rem !important; }
    .header-dropdown-menu { max-width: 90vw; }
    @media (max-width:1024px){.header-dropdown-menu{right:0;left:auto;min-width:200px}}
    @media (max-width:768px){.header-dropdown-menu{position:fixed;top:auto;right:1rem;left:1rem;width:calc(100% - 2rem);max-width:300px}}
}

/* Old floating FAB override — now button is inside mobile header bar */
/* #mobileNavToggleFloat { z-index: 10000 !important; position: fixed !important; } */

/* ==========================================
   Header Logo & Text - Compact Left Alignment
   ========================================== */
.header-logo-img {
    width: auto !important;        /* scale naturally */
    height: 40px !important;       /* reduced height */
    min-height: 40px !important;   /* ensure visible */
    max-height: 40px !important;   /* prevent overflow */
    object-fit: contain !important; /* logo fit without stretching */
    display: block !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

/* Logo for bigger screens */
@media (min-width:640px) {
    .header-logo-img { 
        height: 45px !important; 
        min-height: 45px !important; 
        max-height: 45px !important;
    }
}
@media (min-width:1024px) {
    .header-logo-img { 
        height: 50px !important; 
        min-height: 50px !important;
        max-height: 50px !important;
    }
}

/* Header Row - Compact height */
header.home-header .header-main-row {
    height: auto !important;           
    min-height: 50px !important;       /* reduced height */
    max-height: none !important;
    padding: 4px 0 !important;         /* minimal padding */
    align-items: center !important;
}

/* Logo container - fixed width */
header.home-header a[href*="home"] {
    max-width: fit-content !important;
    width: auto !important;
    flex-shrink: 0 !important;
}

/* Ensure link container doesn't restrict logo size */
header.home-header a[href*="home"],
header.home-header a[href*="home"] img {
    height: auto !important;
    max-height: none !important;
}

/* ==========================================
   Typing Animation - Compact & Left Aligned
   ========================================== */
.typing-animation { 
    display: inline-block; 
    white-space: nowrap; 
    max-width: 200px !important;        /* limit width */
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    font-weight: 900 !important;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2) !important;
    font-size: 0.875rem !important;     /* smaller font */
    line-height: 1.1 !important;
}

.typing-text {
    font-weight: 900 !important;
    font-size: inherit !important;
    background: linear-gradient(90deg, #FF6B6B, #4ECDC4, #45B7D1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: colorCycle 3s ease-in-out infinite;
}

.typing-cursor {
    display: inline-block;
    animation: blinkCursor 1s infinite;
    margin-left: 1px !important;
    font-weight: 900 !important;
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF6347);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 0 4px rgba(255, 165, 0, 0.3) !important;
    font-size: inherit !important;
}

@keyframes blinkCursor { 
    0%,50%{opacity:1} 
    51%,100%{opacity:0} 
}

/* Dynamic color cycling animations */
@keyframes colorCycle {
    0% { 
        background: linear-gradient(90deg, #FF6B6B, #4ECDC4);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    25% { 
        background: linear-gradient(90deg, #45B7D1, #96CEB4);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    50% { 
        background: linear-gradient(90deg, #FFEAA7, #DDA0DD);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    75% { 
        background: linear-gradient(90deg, #98D8C8, #F7DC6F);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    100% { 
        background: linear-gradient(90deg, #FF6B6B, #4ECDC4);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* Responsive text sizing */
@media (max-width: 768px) {
    .typing-animation {
        font-size: 0.75rem !important; /* 12px on mobile */
        max-width: 150px !important;
    }
}

@media (max-width: 640px) {
    .typing-animation {
        font-size: 0.7rem !important; /* 11px on small mobile */
        max-width: 120px !important;
    }
}

/* Global overflow fix */
body {
    overflow-x: hidden;
}

/* ══════════════════════════════════════════════════════
   MOBILE TOP HEADER BAR — Sticky bar for < md screens
   ══════════════════════════════════════════════════════ */
.mobile-top-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.mobile-top-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    max-width: 100%;
    gap: 8px;
}

/* ---- Logo area ---- */
.mobile-top-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    flex-shrink: 1;
    min-width: 0;
}

.mobile-top-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.mobile-top-logo-text {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #fff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    line-height: 1.2;
}

@media (max-width: 360px) {
    .mobile-top-logo-text {
        max-width: 100px;
        font-size: 0.75rem;
    }
    .mobile-top-logo-img {
        height: 28px;
    }
}

/* ---- Right actions ---- */
.mobile-top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Balance pill */
.mobile-top-balance {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399 !important;
    font-size: 0.6875rem;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}
.mobile-top-balance:hover,
.mobile-top-balance:active {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
}
.mobile-top-balance i {
    font-size: 0.625rem;
    color: #34d399 !important;
}

/* User avatar circle */
.mobile-top-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff !important;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none !important;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}
.mobile-top-avatar:hover,
.mobile-top-avatar:active {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.45);
}

/* Login button (guest) */
.mobile-top-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff !important;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: opacity 0.2s;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.mobile-top-login-btn:hover,
.mobile-top-login-btn:active {
    opacity: 0.9;
}
.mobile-top-login-btn i {
    font-size: 0.6875rem;
    color: #fff !important;
}

/* Hamburger menu button */
.mobile-top-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff !important;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.mobile-top-menu-btn:hover,
.mobile-top-menu-btn:active {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.2);
}
.mobile-top-menu-btn i {
    color: #fff !important;
}

/* ── Adjustments when mobile header is present ── */

/* Topbar sits above mobile header naturally (both in DOM flow) */
@media (max-width: 767.98px) {
    /* Make topbar also sticky, stacked above header */
    .homepage-topbar {
        position: sticky !important;
        top: 0 !important;
        z-index: 10000 !important;
    }
    /* Mobile header sticks below topbar */
    .mobile-top-header {
        position: sticky;
        top: 0;
        z-index: 9999;
    }
    /* Body content doesn't need extra padding — both are in normal flow */

    /* Hide the old floating FAB styling if it leaks through */
    #mobileNavToggleFloat.fixed {
        position: static !important;
    }
}

/* ── 480px and below: tighter spacing ── */
@media (max-width: 480px) {
    .mobile-top-header-inner {
        padding: 6px 10px;
    }
    .mobile-top-balance {
        padding: 3px 8px;
        font-size: 0.625rem;
    }
    .mobile-top-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.6875rem;
    }
    .mobile-top-menu-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        font-size: 0.875rem;
    }
}
