:root {
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 82, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    --accent: #0052FF;
    --accent-glow: rgba(0, 82, 255, 0.15);
    --text-primary: #050505;
    --text-secondary: #6B7280;
    --bg-main: #FFFFFF;
}

/* Animations */
@keyframes meshGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pulseGlowBlue {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* ====================
   Auth Layout 
==================== */
.modern-auth-body {
    background: var(--bg-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(0, 82, 255, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 82, 255, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modern-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 40px 32px;
    box-shadow: var(--glass-shadow);
    animation: fadeInScale 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.modern-logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.modern-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -1px;
    text-align: center;
}

.modern-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    text-align: center;
    line-height: 1.6;
}

.modern-form-group {
    margin-bottom: 24px;
}

.modern-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    margin-left: 4px;
}

.modern-input {
    width: 100%;
    background: #f8f9ff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px 20px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(0, 82, 255, 0.1);
    transform: translateY(-1px);
}

.modern-btn {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 10px;
    box-shadow: 0 10px 30px rgba(0, 82, 255, 0.2);
}

.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 82, 255, 0.3);
    filter: brightness(1.05);
}

.modern-btn:active {
    transform: scale(0.96) translateY(0);
}

.modern-link-container {
    text-align: center;
    margin-top: 30px;
}

.modern-link-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.modern-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    margin-left: 5px;
}

.modern-error {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

/* ====================
   Global Layout & Theme overrides
==================== */
body.modern-theme {
    background: var(--bg-main) !important;
    background-image:
        radial-gradient(at 0% 0%, rgba(0, 82, 255, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 82, 255, 0.02) 0px, transparent 50%) !important;
    background-attachment: fixed !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

.modern-theme .app-header {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(0, 82, 255, 0.05) !important;
    color: #050505 !important;
}

.modern-theme .app-main {
    background: transparent !important;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.modern-theme .icon-btn {
    color: #050505 !important;
}

.modern-theme .profile-avatar {
    border-color: rgba(0, 82, 255, 0.1) !important;
    background-color: #f8f9ff !important;
    color: #050505 !important;
}

.home-container {
    padding: 20px;
    max-width: 100%;
}

/* ====================
   3D Card Structure
==================== */
.card-container {
    perspective: 1500px;
    width: 100%;
    aspect-ratio: 1.6 / 1;
}

.card-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.card-container.flipped .card-flipper {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 28px;
    overflow: hidden;
}

.card-back {
    transform: rotateY(180deg);
}

.modern-3d-card-face {
    background: #fff;
    border: 1px solid rgba(0, 82, 255, 0.1);
    box-shadow: 0 15px 35px rgba(0, 82, 255, 0.05);
}

.card-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.flip-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #999;
}

/* ====================
   Home Components 
==================== */
.modern-welcome {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 2px;
}

.modern-welcome-sub {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.modern-stat-tray {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modern-stat-box {
    flex: 1;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 22px;
    padding: 16px;
    transition: all 0.3s;
}

.modern-stat-label {
    font-size: 10px;
    font-weight: 700;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.modern-stat-val {
    font-size: 20px;
    font-weight: 800;
}

.modern-stat-sub {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 4px;
}

/* Unified Dashboard Card */
.modern-dashboard-card {
    background: #FFFFFF;
    border: 1px solid rgba(0, 82, 255, 0.08);
    border-radius: 28px;
    padding: 24px;
    margin-bottom: 40px;
    box-shadow: 0 12px 40px rgba(0, 82, 255, 0.04);
}

.dashboard-assets {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #F3F4F6;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.asset-item {
    flex: 1;
    text-align: center;
}

.asset-divider {
    width: 1px;
    height: 40px;
    background: #E5E7EB;
    margin: 0 10px;
}

.dashboard-wallet {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FAFF;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid rgba(0, 82, 255, 0.04);
}

.wallet-info .modern-stat-label {
    margin-bottom: 2px;
}

.wallet-info .modern-stat-val {
    color: var(--accent);
}

.refill-link {
    background: var(--accent);
    color: #fff;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s;
}

.refill-link:active {
    transform: scale(0.95);
}

/* ====================
   Carousel Layout
==================== */
.section-header {
    margin-top: 40px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 800;
}

.carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding: 4px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.product-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
    background: #FFFFFF;
    border: 1px solid #F3F4F6;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 82, 255, 0.03);
}

.product-img {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 12px;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

/* ====================
   Footer Navigation
==================== */
.modern-footer {
    position: fixed;
    bottom: 24px;
    left: 20px;
    right: 20px;
    height: 72px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 82, 255, 0.08);
    border-radius: 24px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 2000;
    box-shadow: 0 15px 40px rgba(0, 82, 255, 0.08);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #9CA3AF;
    transition: all 0.3s;
}

.tab-item.active {
    color: var(--accent);
    transform: translateY(-4px);
}

.modern-footer-label {
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
}

/* ====================
   Desktop Preview Frame 
==================== */
@media (min-width: 1025px) {
    .hide-on-desktop {
        display: none !important;
    }

    .desktop-preview-wrapper {
        position: fixed;
        inset: 0;
        background: radial-gradient(circle at 0% 0%, #f0f4ff 0%, #ffffff 50%, #f8faff 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 99999;
        overflow: hidden;
        padding: 40px;
    }

    .preview-columns {
        display: flex;
        align-items: center;
        gap: 80px;
        max-width: 1200px;
        width: 100%;
        justify-content: center;
    }

    /* Premium iPhone 15 Pro Style Frame */
    .mobile-frame-container {
        position: relative;
        width: 400px;
        height: 820px;
        background: #111;
        border-radius: 60px;
        padding: 14px;
        box-shadow: 
            0 50px 100px -20px rgba(0, 0, 0, 0.25),
            0 30px 60px -30px rgba(0, 0, 0, 0.3),
            inset 0 0 2px 2px rgba(255, 255, 255, 0.1);
        border: 4px solid #333;
    }

    .frame-inner {
        position: relative;
        width: 100%;
        height: 100%;
        background: #fff;
        border-radius: 48px;
        overflow: hidden;
        border: 1px solid #000;
    }

    /* Dynamic Island */
    .dynamic-island {
        position: absolute;
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        width: 120px;
        height: 35px;
        background: #000;
        border-radius: 20px;
        z-index: 100;
    }

    .frame-content {
        width: 100%;
        height: 100%;
        border: none;
        background: #fff;
    }

    /* Side Promotion / QR Section */
    .qr-side-section {
        max-width: 450px;
        animation: fadeInScale 0.8s ease-out;
    }

    .qr-badge {
        display: inline-block;
        background: #0052FF;
        color: #fff;
        padding: 8px 16px;
        border-radius: 100px;
        font-size: 12px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 24px;
    }

    .qr-title {
        font-size: 48px;
        font-weight: 900;
        color: #050505;
        line-height: 1.1;
        margin-bottom: 20px;
        letter-spacing: -2px;
    }

    .qr-desc {
        font-size: 18px;
        color: #666;
        line-height: 1.6;
        margin-bottom: 40px;
    }

    .qr-card {
        background: #fff;
        padding: 30px;
        border-radius: 32px;
        display: inline-block;
        box-shadow: 0 20px 50px rgba(0, 82, 255, 0.1);
        border: 1px solid rgba(0, 82, 255, 0.05);
        text-align: center;
    }

    .qr-container {
        width: 200px;
        height: 200px;
        margin: 0 auto 20px;
        background: #f8f9fa;
        border-radius: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
    }

    .qr-container img {
        max-width: 100%;
        height: auto;
    }

    .qr-footer-text {
        font-size: 14px;
        font-weight: 700;
        color: #050505;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
}

/* Mobile view adjustments */
@media (max-width: 1024px) {
    .desktop-preview-wrapper {
        display: none !important;
    }
}

/* Desktop: Hide normal app shell unless in mobile-mode */
@media (min-width: 1025px) {
    body.modern-theme:not(.mobile-mode) .app-header,
    body.modern-theme:not(.mobile-mode) .app-main,
    body.modern-theme:not(.mobile-mode) .modern-footer,
    body.modern-theme:not(.mobile-mode) #pwa-install-banner,
    body.modern-theme:not(.mobile-mode) #app-preloader:not(.desktop-preview-wrapper *) {
        display: none !important;
    }
}
