/* YumoVPN — Premium Light Theme (matched to TWA) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f2f2f7;
    --bg-white: #ffffff;
    --accent: #4f8cff;
    --accent-hover: #3b7af0;
    --accent-light: #eef4ff;
    --text: #1c1c1e;
    --text-secondary: #6b6b78;
    --text-tertiary: #aeaeb2;
    --border: #e5e5ea;
    --danger: #ff3b30;
    --danger-hover: #e0312a;
    --success: #34c759;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.04), 0 0 1px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
    background: #ffffff;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════ APP CONTAINER ═══════════════════════ */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 40px;
    background: var(--bg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

/* ═══════════════════════ HEADER ═══════════════════════ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    position: sticky;
    top: 0;
    background: rgba(242, 242, 247, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.header-left { display: flex; align-items: center; gap: 8px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.3px;
}

.logo-slogan {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.3px;
    margin-top: -2px;
}

.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
}

/* Back button (pill) */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    padding: 8px 14px 8px 10px;
    border-radius: 10px;
    background: var(--accent-light);
    transition: all 0.15s;
}
.back-btn:hover { background: rgba(79,140,255,0.15); }
.back-btn svg { transition: transform 0.15s; }
.back-btn:hover svg { transform: translateX(-2px); }

/* Balance badge in header */
.balance-badge { text-align: right; }
.balance-label {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}
.balance-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

/* ═══════════════════════ CONTENT ═══════════════════════ */
.content { padding: 0 16px; animation: fadeIn 0.3s ease; }

.section { margin-top: 28px; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 0 4px;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ═══════════════════════ HERO (new user) ═══════════════════════ */
.hero-section { text-align: center; padding-top: 32px; }
.hero-title { font-size: 26px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.5px; }
.hero-subtitle { font-size: 17px; color: var(--accent); font-weight: 600; }

.features { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.feature-item {
    font-size: 15px; font-weight: 500; padding: 14px 18px;
    background: var(--bg-white); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}

/* ═══════════════════════ BALANCE ═══════════════════════ */
.balance-section { text-align: center; padding: 32px 0 8px; }

.balance-big {
    font-size: 52px; font-weight: 800;
    letter-spacing: -2px; color: var(--text);
}

.balance-days {
    color: var(--text-secondary); font-size: 14px;
    margin-top: 4px; font-weight: 500;
}

.balance-actions {
    display: flex; gap: 10px;
    justify-content: center; margin-top: 20px;
}

/* ═══════════════════════ BUTTONS ═══════════════════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 22px; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 600; text-decoration: none;
    border: none; cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #5a9aff 0%, #3b7af0 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(59,122,240,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(59,122,240,0.35); }

.btn-outline {
    background: var(--bg-white); color: var(--text);
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.btn-outline:hover { background: var(--bg); }

.btn-ghost {
    background: transparent; color: var(--text-secondary);
    border: none; font-size: 14px;
}
.btn-ghost:hover { color: var(--accent); }

.btn-danger {
    background: #fff2f0; color: var(--danger);
    border: 1px solid rgba(255,59,48,0.15);
}
.btn-danger:hover { background: #ffe5e2; }

.btn-lg {
    padding: 16px 24px; font-size: 17px; font-weight: 700;
    border-radius: var(--radius); width: 100%;
}

.btn-sm { padding: 8px 16px; font-size: 13px; }

/* Icon buttons in balance-actions */
.btn-icon-col {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    flex: 1; padding: 16px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    cursor: pointer; text-decoration: none;
    color: var(--text); font-size: 14px; font-weight: 600;
    transition: all 0.2s;
}
.btn-icon-col:hover { background: var(--bg); transform: translateY(-1px); }
.btn-icon-col svg { color: var(--accent); }

/* ═══════════════════════ CARDS ═══════════════════════ */
.card {
    background: var(--bg-white); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow); border: none;
}
.card-danger { background: #fff8f7; border: 1px solid rgba(255,59,48,0.1); }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

/* ═══════════════════════ DEVICE CARDS ═══════════════════════ */
.device-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-white); border: none;
    border-radius: var(--radius); padding: 16px 18px;
    margin-bottom: 10px; text-decoration: none; color: var(--text);
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.35s ease both;
}
.device-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.device-card:nth-child(1) { animation-delay: 0.05s; }
.device-card:nth-child(2) { animation-delay: 0.1s; }
.device-card:nth-child(3) { animation-delay: 0.15s; }
.device-card:nth-child(4) { animation-delay: 0.2s; }

.device-icon {
    font-size: 24px; flex-shrink: 0;
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent);
    box-shadow: 0 3px 10px rgba(79,140,255,0.25);
}
.device-icon img { width: 28px; height: 28px; filter: invert(1) brightness(2); }
.device-icon-lg { font-size: 32px; }

.device-info { flex: 1; min-width: 0; }
.device-name { font-weight: 600; font-size: 16px; }
.device-name-lg { font-size: 20px; font-weight: 700; }
.device-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.device-arrow { color: var(--text-tertiary); font-size: 20px; flex-shrink: 0; }

.device-header { display: flex; align-items: center; gap: 14px; margin-top: 16px; }

/* ═══════════════════════ REFERRAL ═══════════════════════ */
.referral-card {
    margin-top: 28px; text-align: center;
    background: var(--bg-white); border-radius: 20px; padding: 28px;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.4s ease 0.15s both;
}
.referral-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.referral-card p { color: var(--accent); font-weight: 600; font-size: 15px; }
.referral-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ═══════════════════════ INPUTS ═══════════════════════ */
.input {
    width: 100%; padding: 14px 18px;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 16px; font-family: inherit; outline: none;
    transition: border-color 0.15s; box-shadow: var(--shadow);
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-tertiary); }

.input-with-suffix { position: relative; }
.input-with-suffix .input { padding-right: 40px; }
.input-suffix {
    position: absolute; right: 16px; top: 50%;
    transform: translateY(-50%); color: var(--text-secondary); font-size: 15px;
}

.rename-form { display: flex; gap: 8px; margin-top: 8px; }
.rename-form .input { flex: 1; }

/* ═══════════════════════ AMOUNT GRID ═══════════════════════ */
.amount-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; margin-top: 14px;
}
.amount-btn {
    padding: 16px; background: var(--bg-white);
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 18px; font-weight: 700;
    cursor: pointer; font-family: inherit; box-shadow: var(--shadow);
    transition: all 0.15s;
}
.amount-btn:hover, .amount-btn.active {
    border-color: var(--accent); background: var(--accent-light);
}

/* ═══════════════════════ COPY BOX ═══════════════════════ */
.copy-box {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px;
    word-break: break-all; font-size: 13px; color: var(--text-secondary);
}

/* ═══════════════════════ DOWNLOADS ═══════════════════════ */
.download-list { margin-top: 8px; }
.download-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; background: var(--bg-white);
    border: none; text-decoration: none; color: var(--text);
    box-shadow: var(--shadow); transition: all 0.15s;
}
.download-card:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.download-card:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.download-card:only-child { border-radius: var(--radius); }
.download-card + .download-card { margin-top: 1px; }
.download-card:hover { background: var(--bg); }
.download-name { font-weight: 600; font-size: 15px; }
.download-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.download-action { color: var(--accent); font-weight: 600; font-size: 14px; }

/* ═══════════════════════ TRANSACTIONS ═══════════════════════ */
.transactions-list { margin-top: 12px; }
.transaction-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.transaction-item:last-child { border-bottom: none; }
.transaction-date { font-size: 12px; color: var(--text-tertiary); }
.transaction-desc { font-size: 14px; font-weight: 500; margin-top: 2px; }
.transaction-amount { font-weight: 700; font-size: 15px; white-space: nowrap; }
.transaction-amount.positive { color: var(--success); }
.transaction-amount.negative { color: var(--danger); }

/* ═══════════════════════ TARIFF ═══════════════════════ */
.tariff-info {
    text-align: center; font-size: 14px; padding: 16px;
    background: var(--bg-white); border-radius: var(--radius);
    box-shadow: var(--shadow); color: var(--text-secondary);
}
.tariff-info strong { color: var(--text); }

/* ═══════════════════════ TIP BANNER ═══════════════════════ */
.tip-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 16px;
    background: var(--accent-light); border: 1px solid rgba(79,140,255,0.2);
    border-radius: var(--radius); margin-top: 16px;
    font-size: 13px; font-weight: 500;
}
.tip-close {
    background: none; border: none; color: var(--text-secondary);
    font-size: 18px; cursor: pointer; padding: 0 4px;
}

/* ═══════════════════════ WARNING BOX ═══════════════════════ */
.warning-box {
    margin-top: 12px; padding: 12px 16px;
    background: #fff2f0; border: 1px solid rgba(255,59,48,0.15);
    border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary);
}

/* ═══════════════════════ INSTRUCTIONS ═══════════════════════ */
.instruction-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; color: var(--text); text-decoration: none;
    font-size: 15px; font-weight: 500;
    background: var(--bg-white); border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.instruction-link:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.instruction-link:last-of-type { border-radius: 0 0 var(--radius) var(--radius); border-bottom: none; }
.instruction-content { padding: 12px 16px 12px 8px; }
.instruction-content ol { padding-left: 20px; }
.instruction-content li {
    margin-bottom: 8px; font-size: 14px;
    color: var(--text-secondary); line-height: 1.5;
}

/* ═══════════════════════ MODAL ═══════════════════════ */
.modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
}
.modal-content {
    position: relative; background: var(--bg-white);
    border-radius: 20px; padding: 24px; max-width: 360px; width: 100%;
    box-shadow: var(--shadow-lg); animation: fadeInUp 0.25s ease;
}
.modal-content h3 { margin-bottom: 8px; font-size: 18px; font-weight: 700; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }

/* ═══════════════════════ EMPTY STATE ═══════════════════════ */
.empty-state { text-align: center; padding: 40px 0; }

/* ═══════════════════════ POPUP MENU ═══════════════════════ */
.menu-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg); border: 1px solid var(--border);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; position: relative;
}
.menu-btn:hover { background: var(--accent-light); }

.popup-menu {
    display: none; position: absolute; top: 52px; right: 16px;
    background: var(--bg-white); border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.1);
    min-width: 200px; z-index: 200; overflow: hidden;
    border: 1px solid var(--border);
    animation: slideDown 0.15s ease;
}
.popup-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; color: var(--text); text-decoration: none;
    font-size: 15px; font-weight: 500; transition: background 0.1s;
    cursor: pointer; background: none; border: none; width: 100%; font-family: inherit;
}
.popup-item:hover { background: var(--bg); }
.popup-item svg { flex-shrink: 0; }
.popup-danger { color: var(--danger); }
.popup-divider { height: 1px; background: var(--border); margin: 0; }

/* ═══════════════════════ TOAST ═══════════════════════ */
.toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success); color: #fff;
    padding: 12px 24px; border-radius: 100px;
    font-size: 14px; font-weight: 600; z-index: 2000;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none; box-shadow: 0 4px 20px rgba(52,199,89,0.3);
    white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═══════════════════════ AUTH PAGES ═══════════════════════ */
.page-center {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center; padding: 24px;
    background: var(--bg);
}

.auth-card {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: 24px; padding: 44px 36px;
    max-width: 420px; width: 100%;
    box-shadow: var(--shadow-lg); animation: fadeInUp 0.4s ease;
}

.auth-logo-wrap { text-align: center; margin-bottom: 32px; }
.auth-logo {
    width: 64px; height: 64px; margin: 0 auto 16px;
    border-radius: 16px; box-shadow: var(--shadow-md); display: block;
}
.auth-title {
    font-size: 28px; font-weight: 800;
    color: var(--accent); letter-spacing: -0.5px; margin-bottom: 6px;
}
.auth-subtitle { color: var(--text-secondary); font-size: 14px; line-height: 1.55; }
.auth-subtitle strong { color: var(--text); font-weight: 600; }

.field-label {
    display: block; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-secondary); margin-bottom: 8px; margin-top: 20px;
}

.field-input {
    width: 100%; padding: 15px 16px;
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 16px; font-family: inherit; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,140,255,0.1);
    background: var(--bg-white);
}
.field-input::placeholder { color: var(--text-tertiary); }

.field-input.code-input {
    text-align: center; font-size: 28px; letter-spacing: 14px;
    font-family: "SF Mono", ui-monospace, Menlo, monospace;
    padding-left: 28px; font-weight: 700;
}

.auth-submit {
    width: 100%; padding: 16px; margin-top: 24px;
    background: linear-gradient(135deg, #5a9aff 0%, #3b7af0 100%);
    color: #fff; border: none; border-radius: var(--radius-sm);
    font-size: 16px; font-weight: 700; cursor: pointer;
    font-family: inherit; box-shadow: 0 4px 16px rgba(59,122,240,0.3);
    transition: transform 0.1s, box-shadow 0.15s;
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(59,122,240,0.36); }
.auth-submit:active { transform: scale(0.985); }

.auth-error {
    margin-top: 14px; padding: 12px 15px;
    background: rgba(255,59,48,0.07); border: 1px solid rgba(255,59,48,0.18);
    border-radius: var(--radius-xs); color: #cc2d24;
    font-size: 13.5px; font-weight: 500; line-height: 1.5;
    display: flex; gap: 9px; align-items: flex-start;
}

.auth-hint { margin-top: 18px; text-align: center; color: var(--text-tertiary); font-size: 13px; }
.auth-hint a { color: var(--accent); font-weight: 600; }

/* Success check */
.success-check {
    width: 72px; height: 72px;
    background: rgba(52,199,89,0.13); color: var(--success);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}

/* ═══════════════════════ UTILITY ═══════════════════════ */
.text-secondary { color: var(--text-secondary); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ═══════════════════════ NO TEXT SELECTION ═══════════════════════ */
* {
    -webkit-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
}
input, textarea, .copy-box, .copy-box code, [contenteditable] {
    -webkit-user-select: text; -moz-user-select: text;
    -ms-user-select: text; user-select: text;
}

/* ═══════════════════════ ANIMATIONS ═══════════════════════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.balance-section { animation: fadeInUp 0.4s ease; }
.modal-backdrop { animation: fadeIn 0.2s ease; }

/* ═══════════════════════ DESKTOP ═══════════════════════ */
@media (min-width: 600px) {
    body { background: #f2f2f7; }
    .app { box-shadow: var(--shadow-lg); }
}
