﻿/* =======================
   🌌 Base Styles - iOS COMPATIBLE
======================= */
* {
    box-sizing: border-box;
}

html {
    /* ✅ CRITICAL: Thêm background ở html để iOS không bị trắng */
    background-color: #0a0e1a;
    min-height: 100%;
}

body {
    font-family: 'Audiowide', sans-serif;
    /* ✅ CRITICAL FIX 1: Đặt background-color TRƯỚC gradient */
    background-color: #0a0e1a !important;
    /* ✅ CRITICAL FIX 2: Thêm background-attachment: fixed */
    background: -webkit-linear-gradient(135deg, #0a0e1a 0%, #1a2332 30%, #0f1419 70%, #050a0f 100%) fixed;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a2332 30%, #0f1419 70%, #050a0f 100%) fixed;
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: #ffffff;
    overflow-x: hidden;
    /* ✅ iOS smooth scrolling */
    -webkit-overflow-scrolling: touch;
}

    /* ✅ CRITICAL FIX 3: Stars layer - Giảm opacity để không che background */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        /* ✅ iOS compatible radial gradients với prefix đầy đủ */
        background-image: -webkit-radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.7), transparent), -webkit-radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.5), transparent), -webkit-radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.8), transparent), -webkit-radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.4), transparent);
        background-image: radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.7), transparent), radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.5), transparent), radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.8), transparent), radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.4), transparent);
        background-repeat: repeat;
        background-size: 400px 300px;
        animation: moveStars 25s linear infinite;
        z-index: -1;
        pointer-events: none;
        /* ✅ iOS performance */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }

@keyframes moveStars {
    0% {
        transform: translateY(0);
        -webkit-transform: translateY(0);
    }

    100% {
        transform: translateY(-300px);
        -webkit-transform: translateY(-300px);
    }
}

/* =======================
   💎 Glass Effects - iOS SAFE
======================= */
.glass-header,
.glass-card,
.glass-footer {
    /* ✅ Prefix đầy đủ cho iOS */
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

/* Header */
.glass-header {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(63, 114, 255, 0.2);
    border-bottom: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Card */
.glass-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(63, 114, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

    .glass-card:hover {
        border-color: rgba(63, 114, 255, 0.5);
        box-shadow: 0 12px 40px rgba(6, 72, 255, 0.2);
    }

/* Footer */
.glass-footer {
    background: rgba(255, 255, 255, 0.04);
    border-top: 1px solid rgba(63, 114, 255, 0.2);
}

/* ✅ Fallback mạnh cho iOS cũ không hỗ trợ backdrop-filter */
@supports not ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
    .glass-header,
    .glass-card,
    .glass-footer {
        background: rgba(15, 20, 25, 0.9);
    }
}

/* =======================
   ✨ Logo
======================= */
.logo-text {
    background: linear-gradient(135deg, #0648FF 0%, #4a90e2 50%, #74b9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(6, 72, 255, 0.4);
    transition: all 0.3s ease;
}

    .logo-text:hover {
        text-shadow: 0 0 30px rgba(6, 72, 255, 0.8);
        transform: scale(1.05);
    }

.logo-container {
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* =======================
   🧭 Navigation
======================= */
.nav-link-modern {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

    .nav-link-modern:hover {
        color: #74b9ff;
        background: rgba(116, 185, 255, 0.1);
        text-shadow: 0 0 10px rgba(116, 185, 255, 0.5);
        transform: translateY(-2px);
    }

/* =======================
   🔘 Buttons
======================= */
.btn-modern {
    background: linear-gradient(135deg, #0648FF 0%, #4a90e2 50%, #0648FF 100%);
    border: none;
    border-radius: 12px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(6, 72, 255, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

    .btn-modern:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(6, 72, 255, 0.4);
    }

.btn-outline-modern {
    background: transparent;
    border: 2px solid rgba(6, 72, 255, 0.6);
    border-radius: 12px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    color: #74b9ff;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

    .btn-outline-modern:hover {
        background: rgba(6, 72, 255, 0.1);
        border-color: #0648FF;
        color: #ffffff;
        transform: translateY(-2px);
    }

/* =======================
   🧾 Inputs
======================= */
.input-modern {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(6, 72, 255, 0.25);
    border-radius: 12px;
    color: #ffffff;
    padding: 0.8rem 1rem;
    transition: all 0.3s ease;
}

    .input-modern:focus {
        background: rgba(255, 255, 255, 0.12);
        border-color: #0648FF;
        box-shadow: 0 0 20px rgba(6, 72, 255, 0.3);
        outline: none;
    }

    .input-modern::placeholder {
        color: rgba(255, 255, 255, 0.6);
    }

/* =======================
   🌠 Twinkling Elements - iOS SAFE (Dùng dot thay emoji)
======================= */
.twinkle {
    position: absolute;
    width: 1.5rem;
    height: 1.5rem;
    pointer-events: none;
    opacity: 0;
    animation: twinkle 2s ease-in-out infinite alternate;
    z-index: 1;
}

    .twinkle::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 8px;
        height: 8px;
        background: #ffffff;
        border-radius: 50%;
        transform: translate(-50%, -50%);
        box-shadow: 0 0 6px rgba(255, 255, 255, 0.9), 0 0 12px rgba(255, 255, 255, 0.5);
    }

@keyframes twinkle {
    0% {
        opacity: 0.2;
        transform: scale(0.6);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* =======================
   🌌 Floating Particles
======================= */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #0648FF, #4a90e2);
    border-radius: 50%;
    animation: float-particle 8s ease-in-out infinite;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(6, 72, 255, 0.6);
    z-index: 1;
    /* ✅ iOS performance */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

@keyframes float-particle {
    0%, 100% {
        transform: translateY(0px) translateX(0px);
        opacity: 0.3;
    }

    50% {
        transform: translateY(-20px) translateX(10px);
        opacity: 1;
    }
}

/* =======================
   ✨ Text Glow
======================= */
.text-primary-glow {
    color: #74b9ff;
    text-shadow: 0 0 15px rgba(116, 185, 255, 0.5);
}

/* =======================
   🎞 Animation
======================= */
.fade-in {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =======================
   📌 Header / Layout
======================= */
.header-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 1rem 0;
}

.main-content {
    padding-top: 100px;
    min-height: calc(100vh - 100px);
}

/* =======================
   📱 Mobile Menu
======================= */
.mobile-menu {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu.show {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.08);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(63, 114, 255, 0.3);
        border-top: none;
        border-radius: 0 0 15px 15px;
        padding: 1rem;
    }
}

/* =======================
   📱 Responsive
======================= */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .main-content {
        padding-top: 80px;
    }

    .glass-card {
        padding: 1.5rem;
    }

    .btn-modern,
    .btn-outline-modern {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }

    .twinkle {
        width: 1rem;
        height: 1rem;
    }

        .twinkle::before {
            width: 6px;
            height: 6px;
        }

    .particle {
        width: 4px;
        height: 4px;
    }
}

/* =======================
   🔧 iOS Specific Fixes
======================= */
@supports (-webkit-touch-callout: none) {
    /* ✅ iOS-only: Force background */
    body {
        background-color: #0a0e1a !important;
        background-attachment: scroll !important;
    }
        /* ✅ iOS-only: Reduce animation complexity */
        body::before {
            animation: moveStars 30s linear infinite;
        }
}

/* ✅ Fix cho iOS Safari khi scroll */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    body {
        background-attachment: scroll;
    }
}
