/* ========================================
   极连VPN - Design System v2.0
   Responsive: Phone-native + Desktop phone-frame
   Color: Industry-aligned (NordVPN/Surfshark inspired)
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* === CSS Variables === */
:root {
    /* Brand - Deep navy (NordVPN-inspired trust palette) */
    --primary: #4C8BF5;
    --primary-light: #6BA1FF;
    --primary-dark: #3366CC;
    --primary-glow: rgba(76, 139, 245, 0.35);

    /* Connected state - Vibrant teal-green (Surfshark-inspired) */
    --green: #1ED760;
    --green-light: #3FE87A;
    --green-glow: rgba(30, 215, 96, 0.35);
    --green-bg: rgba(30, 215, 96, 0.08);

    /* Accent */
    --gold: #F5A623;
    --gold-glow: rgba(245, 166, 35, 0.3);
    --purple: #8B5CF6;
    --red: #EF4444;
    --orange: #FB923C;
    --cyan: #22D3EE;

    /* Dark surfaces - deep navy (security feel) */
    --bg-body: #080C1A;
    --bg-app: #0B1022;
    --bg-surface: #111830;
    --bg-card: rgba(255, 255, 255, 0.035);
    --bg-card-hover: rgba(255, 255, 255, 0.065);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-glass: rgba(17, 24, 48, 0.85);

    /* Text */
    --text-primary: #EFF3FA;
    --text-secondary: #8E99B0;
    --text-muted: #5A6580;
    --text-dim: #3D4760;

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-active: rgba(76, 139, 245, 0.4);

    /* Gradients */
    --gradient-bg: linear-gradient(170deg, #0B1022 0%, #0D0F2B 40%, #10122A 100%);
    --gradient-primary: linear-gradient(135deg, #4C8BF5, #6366F1);
    --gradient-green: linear-gradient(135deg, #15B853, #1ED760);
    --gradient-gold: linear-gradient(135deg, #F5A623, #E09100);
    --gradient-header: linear-gradient(180deg, rgba(76,139,245,0.08) 0%, transparent 60%);

    /* Sizing / Spacing */
    --app-width: 393px;
    --app-height: 852px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.35);
    --shadow-glow-primary: 0 0 30px rgba(76, 139, 245, 0.2);
    --shadow-glow-green: 0 0 30px rgba(30, 215, 96, 0.2);

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === Reset === */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==============================================
   RESPONSIVE APP CONTAINER
   Desktop: centered phone frame with border
   Mobile: fullscreen native app
   ============================================== */

/* Desktop: center with phone frame */
@media (min-width: 431px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        background:
            radial-gradient(ellipse at 30% 20%, rgba(76, 139, 245, 0.04) 0%, transparent 50%),
            radial-gradient(ellipse at 70% 80%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
            var(--bg-body);
    }

    .app-container {
        width: var(--app-width);
        height: var(--app-height);
        max-height: 95vh;
        border-radius: 44px;
        border: 2.5px solid rgba(255, 255, 255, 0.08);
        overflow: hidden;
        position: relative;
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.02),
            0 25px 80px rgba(0, 0, 0, 0.5),
            0 0 120px rgba(76, 139, 245, 0.03);
    }
}

/* Mobile: fullscreen */
@media (max-width: 430px) {
    body {
        overflow: hidden;
    }

    .app-container {
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* dynamic viewport height for mobile browsers */
        border-radius: 0;
        border: none;
    }
}

.app-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
    position: relative;
}

/* === Status Bar === */
.status-bar {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

@media (max-width: 430px) {
    /* On real phones, the OS provides a status bar, so shrink ours */
    .status-bar {
        height: 20px;
        padding: 0 20px;
        font-size: 0;
        /* We keep a small safe area spacer but hide the fake status content */
    }
    .status-bar * { display: none; }
}

.status-bar .time {
    font-weight: 700;
    font-size: 15px;
}

.status-bar .icons {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 12px;
}

/* === Navigation Bar === */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    position: relative;
    z-index: 50;
    flex-shrink: 0;
}

.nav-bar .back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    color: #fff;
    font-size: 18px;
    text-decoration: none;
}

.nav-bar .back-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.nav-bar .title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.nav-bar .action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    cursor: pointer;
    color: #fff;
    font-size: 18px;
    background: transparent;
    text-decoration: none;
}

/* === Page Content Scroll Area === */
.page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.page-content::-webkit-scrollbar { display: none; }

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin: 0 20px 14px;
    transition: all 0.3s var(--ease);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

/* === Buttons === */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s var(--ease);
    font-family: inherit;
    text-decoration: none;
    width: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-glow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 139, 245, 0.35);
}

.btn-green {
    background: var(--gradient-green);
    color: #fff;
    box-shadow: var(--shadow-glow-green);
}

.btn-gold {
    background: var(--gradient-gold);
    color: #1a1a2e;
    font-weight: 700;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--border-hover);
    background: var(--bg-card);
}

.btn-ghost {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.08);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

/* === Input Fields === */
.input-group {
    margin-bottom: 14px;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s var(--ease);
    outline: none;
}

.input-field:focus {
    border-color: var(--primary);
    background: rgba(76, 139, 245, 0.04);
    box-shadow: 0 0 0 3px rgba(76, 139, 245, 0.08);
}

.input-field::placeholder {
    color: var(--text-dim);
}

/* === Menu Item === */
.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    border-radius: var(--radius-md);
    margin: 2px 0;
}

.menu-item:hover { background: var(--bg-card); }
.menu-item:active { background: var(--bg-card-hover); transform: scale(0.98); }

.menu-item .icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.menu-item .info { flex: 1; }
.menu-item .info .label { font-size: 16px; font-weight: 500; color: var(--text-primary); }
.menu-item .info .desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.menu-item .arrow { color: var(--text-dim); font-size: 16px; }

/* === Divider === */
.divider { height: 1px; background: var(--border); margin: 8px 20px; }

/* === Badge === */
.badge-vip {
    background: linear-gradient(135deg, rgba(245,166,35,0.15), rgba(224,145,0,0.15));
    color: var(--gold);
    border: 1px solid rgba(245,166,35,0.2);
    padding: 3px 10px; border-radius: var(--radius-full);
    font-size: 12px; font-weight: 600;
}

/* === Toggle Switch === */
.toggle-switch {
    width: 52px; height: 30px;
    border-radius: 15px;
    background: #2A3248;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-switch.on { background: var(--green); }

.toggle-switch::after {
    content: '';
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 3px; left: 3px;
    transition: transform 0.3s var(--ease);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch.on::after { transform: translateX(22px); }

/* === Animations === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(30,215,96,0.25); }
    50% { box-shadow: 0 0 45px rgba(30,215,96,0.5); }
}
@keyframes ripple {
    0% { transform: scale(0.85); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}
@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.animate-in { animation: fadeInUp 0.45s var(--ease) both; }
.animate-in:nth-child(1) { animation-delay: 0.04s; }
.animate-in:nth-child(2) { animation-delay: 0.08s; }
.animate-in:nth-child(3) { animation-delay: 0.12s; }
.animate-in:nth-child(4) { animation-delay: 0.16s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }
.animate-in:nth-child(6) { animation-delay: 0.24s; }
.animate-in:nth-child(7) { animation-delay: 0.28s; }
.animate-in:nth-child(8) { animation-delay: 0.32s; }

/* === Home Indicator === */
.home-indicator {
    height: 34px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.home-indicator .bar {
    width: 134px; height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 430px) {
    .home-indicator { height: 16px; }
    .home-indicator .bar { display: none; }
}

/* === Utilities === */
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
