/*
 * YupSelf Design System — Premium Black & Gold
 * Manrope font, glass morphism, pill buttons, aurora background
 */

/* ── Цвета ────────────────────────────────────────────────────────── */
:root {
    --bg: #080808;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --surface-glass: rgba(10, 10, 10, 0.7);
    --accent-1: #D4AF37;
    --accent-2: #C5A028;
    --accent-3: #b8860b;
    --text-primary: #f1f5f9;
    --text-secondary: #8a8a8a;
    --border: rgba(212, 175, 55, 0.15);
    --border-bright: rgba(212, 175, 55, 0.3);
    --glow: rgba(212, 175, 55, 0.25);
}

/* ── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Page Layout ──────────────────────────────────────────────────── */
.page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 20px 60px;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
}

/* ── Glass Panel ──────────────────────────────────────────────────── */
.glass {
    width: 100%;
    max-width: 820px;
    background: var(--surface-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-bright);
    border-radius: 28px;
    padding: 36px;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.03) inset,
        0 30px 80px -20px rgba(0, 0, 0, 0.7),
        0 0 40px -10px var(--glow);
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    border-radius: 9999px;
    border: none;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    color: #080808;
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(212, 175, 55, 0.45);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 9999px;
    border: 1px solid var(--accent-1);
    background: transparent;
    color: var(--accent-1);
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
}
.btn-secondary:hover { background: rgba(212, 175, 55, 0.1); }

.btn-action {
    flex: 1;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-secondary);
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-action:hover { background: var(--surface-hover); color: white; }
.btn-action.accent {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    color: #080808;
    border-color: transparent;
}

.btn-small {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 9999px;
    border: none;
    background: var(--accent-1);
    color: #080808;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-small:hover { opacity: 0.85; }

.btn-login {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 9999px;
    border: none;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    color: #080808;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}
.btn-login:hover { transform: translateY(-2px); }

/* ── Chips ────────────────────────────────────────────────────────── */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}
.chip {
    padding: 7px 14px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: #94a3b8;
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.chip:hover {
    background: var(--surface-hover);
    color: #e2e8f0;
    transform: translateY(-1px);
}
.chip.active, .chip.on {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    color: #080808;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

/* ── Badge ────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    color: #080808;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

/* ── Section Label ────────────────────────────────────────────────── */
.label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 10px;
}

/* ── Textarea ─────────────────────────────────────────────────────── */
.textarea {
    width: 100%;
    min-height: 110px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    color: var(--text-primary);
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.textarea::placeholder { color: var(--text-secondary); }
.textarea:focus {
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 0 3px var(--glow), 0 0 20px var(--glow);
}

/* ── Input ────────────────────────────────────────────────────────── */
.input {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.input:focus {
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 0 3px var(--glow);
}
.input::placeholder { color: var(--text-secondary); }

/* ── Select ───────────────────────────────────────────────────────── */
.select {
    padding: 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    outline: none;
}

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
    padding: 14px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.card-number { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.card-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.card-balance {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(212,175,55,0.1), rgba(184,134,11,0.05));
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 20px;
}
.card-balance-number { font-size: 36px; font-weight: 800; color: var(--accent-1); }
.card-balance-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.card-referral {
    padding: 14px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-referral-code {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    font-family: monospace;
    word-break: break-all;
}

.card-package {
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}
.card-package:hover { border-color: var(--accent-1); }

/* ── Upload Zone ──────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.upload-zone:hover { border-color: var(--accent-1); }
.upload-zone.has-files { border-color: var(--accent-1); border-style: solid; }
.upload-zone-label { color: var(--text-secondary); font-size: 13px; }
.upload-zone-label b { color: var(--accent-1); }

.thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
}

/* ── Grids ────────────────────────────────────────────────────────── */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.grid-item {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    cursor: pointer;
}
.grid-item:hover { border-color: var(--accent-1); }
.grid-item img { width: 100%; height: 100%; object-fit: cover; }

/* ── Avatar ───────────────────────────────────────────────────────── */
.avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #080808;
    flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ── Bottom Navigation ────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: flex;
    z-index: 100;
    background: rgba(8, 8, 8, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 8px 0 env(safe-area-inset-bottom, 8px);
}
.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 4px;
    color: var(--text-secondary);
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.2s;
}
.nav-tab.active { color: var(--accent-1); }
.nav-tab svg { width: 22px; height: 22px; }

/* ── Result Image ─────────────────────────────────────────────────── */
.result-image {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px var(--glow);
}

/* ── Loading ──────────────────────────────────────────────────────── */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px 0;
}
.loading-orb {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
    animation: ds-orb-spin 2s linear infinite, ds-orb-pulse 1.5s ease-in-out infinite;
}
.loading-text { color: var(--text-secondary); font-size: 14px; }
.loading-dots { display: flex; gap: 6px; }
.loading-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent-1);
    opacity: 0.3;
}
.loading-dot.done { opacity: 1; }

@keyframes ds-orb-spin { to { transform: rotate(360deg); } }
@keyframes ds-orb-pulse {
    0%, 100% { box-shadow: 0 0 20px var(--glow); }
    50% { box-shadow: 0 0 50px rgba(212, 175, 55, 0.4); }
}

/* ── Aurora Background ────────────────────────────────────────────── */
.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.aurora-blob {
    position: absolute;
    border-radius: 50%;
    /* blur(120px) + infinite animation на трёх блобах давало постоянную
       GPU-нагрузку и "мерцание" на Android (Алина, Алекс, Настя в чате).
       Сократили radius, добавили will-change для layer promotion,
       на мобильных отключаем анимацию совсем. */
    filter: blur(80px);
    opacity: 0.15;
    will-change: transform;
    animation: ds-aurora-drift 20s ease-in-out infinite alternate;
}
.aurora-blob:nth-child(1) {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #D4AF37, transparent 70%);
    top: -200px; left: -100px;
    animation-duration: 25s;
}
.aurora-blob:nth-child(2) {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #b8860b, transparent 70%);
    top: 30%; right: -150px;
    animation-duration: 18s; animation-delay: -5s;
}
.aurora-blob:nth-child(3) {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #C5A028, transparent 70%);
    bottom: -100px; left: 30%;
    animation-duration: 22s; animation-delay: -10s;
}
@keyframes ds-aurora-drift {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(60px, -40px) scale(1.1); }
    66%  { transform: translate(-40px, 30px) scale(0.95); }
    100% { transform: translate(20px, -20px) scale(1.05); }
}

/* Мобильные и устройства без hover — убираем дорогую анимацию, оставляем статичный фон */
@media (max-width: 768px), (prefers-reduced-motion: reduce), (hover: none) {
    .aurora-blob {
        animation: none;
        filter: blur(60px);
    }
}

/* ── Fade-up Animation ────────────────────────────────────────────── */
.fade-up {
    animation: ds-fade-up 0.6s ease;
}
@keyframes ds-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: none; }
}

/* ── Utility: Action Bar ──────────────────────────────────────────── */
.action-bar {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ── Utility: Flex helpers ────────────────────────────────────────── */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-14 { gap: 14px; }

/* ── Modal Overlay ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-content {
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
    margin-top: 48px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}
.footer a { color: var(--accent-1); text-decoration: none; }

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .page { padding: 16px 8px 80px; }
    .glass {
        padding: 16px 12px;
        border-radius: 18px;
        width: 100%;
        max-width: 100%;
    }
    .btn-primary { padding: 14px; font-size: 15px; }
    .textarea { font-size: 15px; min-height: 80px; padding: 14px; }
    .chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .chips::-webkit-scrollbar { display: none; }
    .chip { flex-shrink: 0; font-size: 11px; padding: 6px 12px; }
    .action-bar { flex-wrap: wrap; }
    .btn-action { flex: 1 1 45%; font-size: 12px; padding: 9px 10px; }
    .loading-orb { width: 48px; height: 48px; }
    .card-balance-number { font-size: 28px; }
    .grid-2 { gap: 6px; }
    .grid-3 { gap: 4px; }
    .bottom-nav { padding: 6px 0 env(safe-area-inset-bottom, 6px); }
}
