/* Earnovastation - Design tokens (light + dark) */

:root[data-theme="light"] {
    --bg: #f6f8fb;
    --bg-deep: #eef2f7;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --surface-3: #e2e8f0;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #475569;
    --text-soft: #64748b;
    --primary: #059669;
    --primary-600: #047857;
    --primary-700: #065f46;
    --primary-50: #ecfdf5;
    --accent: #f59e0b;
    --accent-600: #d97706;
    --danger: #e11d48;
    --info: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --shadow-lg: 0 20px 60px -20px rgba(15, 23, 42, .25);
    --gradient-hero: linear-gradient(135deg, #059669 0%, #047857 60%, #064e3b 100%);
    --gradient-balance: linear-gradient(135deg, rgba(5, 150, 105, .1), rgba(245, 158, 11, .08));
    --code-bg: #f1f5f9;
}

:root[data-theme="dark"] {
    --bg: #0b1220;
    --bg-deep: #060b15;
    --surface: #0f1a2e;
    --surface-2: #111c33;
    --surface-3: #1a2845;
    --border: #1e293b;
    --border-strong: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-soft: #64748b;
    --primary: #10b981;
    --primary-600: #34d399;
    --primary-700: #6ee7b7;
    --primary-50: rgba(16, 185, 129, .12);
    --accent: #fbbf24;
    --accent-600: #f59e0b;
    --danger: #fb7185;
    --info: #38bdf8;
    --success: #34d399;
    --warning: #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8);
    --gradient-hero: linear-gradient(135deg, #064e3b 0%, #0f1a2e 50%, #1e1b4b 100%);
    --gradient-balance: linear-gradient(135deg, rgba(16, 185, 129, .18), rgba(251, 191, 36, .08));
    --code-bg: #0a1226;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, h4, h5 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    margin: 0;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.2; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 .5rem; color: var(--text-muted); }
a  { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary); }

.muted { color: var(--text-muted); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-2xl { font-size: 28px; }
.text-3xl { font-size: 36px; }

.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s ease;
    white-space: nowrap;
    line-height: 1;
    background: var(--surface-2);
    color: var(--text);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }

.btn-accent {
    background: var(--accent);
    color: #1f1300;
    border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-600); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 9px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* Cards & surfaces */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
    box-shadow: var(--shadow-sm);
}
.card-pad-sm { padding: 14px; }
.card-pad-lg { padding: 28px; }

/* Form fields */
.field {
    display: block;
    margin-bottom: 14px;
}
.field span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.field input, .field select, .field textarea, input.input, select.input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, input.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Brand */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-700));
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -.05em;
    box-shadow: 0 4px 14px rgba(16, 185, 129, .35);
}
.brand-name { font-family: 'Space Grotesk', sans-serif; font-size: 17px; letter-spacing: -.01em; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    text-decoration: none;
    transition: all .15s;
}
.theme-toggle:hover { background: var(--surface-3); }

/* Flash */
.flash {
    position: fixed; top: 16px; right: 16px;
    padding: 12px 18px; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); box-shadow: var(--shadow-lg); z-index: 200;
    font-size: 14px; max-width: 360px;
    animation: flashIn .3s ease;
}
.flash-success { border-left: 4px solid var(--success); }
.flash-error   { border-left: 4px solid var(--danger); }
.flash-info    { border-left: 4px solid var(--info); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(2, 6, 16, .65);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-backdrop.is-open { display: flex; animation: fadeIn .2s ease; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: scaleIn .2s ease;
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-family: 'Space Grotesk'; font-size: 18px; }
.modal-close {
    background: transparent; border: 0; color: var(--text-muted);
    font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-body { padding: 22px; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96) } to { opacity: 1; transform: scale(1) } }

/* Segmented control */
.seg {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 18px;
}
.seg-btn {
    background: transparent; border: 0; padding: 8px 14px;
    color: var(--text-muted); cursor: pointer; border-radius: 8px;
    font-weight: 500; font-size: 13px;
}
.seg-btn.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.pay-pane { display: none; }
.pay-pane.is-active { display: block; animation: fadeIn .2s ease; }

/* Crypto */
.crypto-info {
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    border-radius: 10px; padding: 12px;
    margin-bottom: 12px;
}
.crypto-addr { font-family: 'JetBrains Mono', monospace; font-size: 12px; word-break: break-all; color: var(--text); }

/* Info box */
.info-box {
    background: var(--gradient-balance);
    border: 1px solid var(--border);
    border-radius: 12px; padding: 14px 18px;
    margin-bottom: 16px;
}

/* Avatar */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-700));
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }

/* Pills / badges */
.pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600;
    background: var(--surface-2);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.pill-success { background: rgba(16, 185, 129, .14); color: var(--success); }
.pill-warning { background: rgba(245, 158, 11, .14); color: var(--warning); }
.pill-danger  { background: rgba(225, 29, 72, .14); color: var(--danger); }
.pill-info    { background: rgba(14, 165, 233, .14); color: var(--info); }
.pill-purple  { background: rgba(139, 92, 246, .14); color: #8b5cf6; }
.pill-orange  { background: rgba(249, 115, 22, .14); color: #f97316; }
.pill-pink    { background: rgba(236, 72, 153, .14); color: #ec4899; }
.pill-gray    { background: rgba(100, 116, 139, .14); color: #64748b; }

/* Transaction type specific colors */
.tx-type-deposit { color: var(--success); }
.tx-type-withdrawal { color: var(--warning); }
.tx-type-earning { color: #8b5cf6; }
.tx-type-referral { color: #ec4899; }
.tx-type-purchase { color: var(--danger); }
.tx-type-activation { color: var(--info); }

/* Status indicator backgrounds */
.status-bg-pending { background: rgba(245, 158, 11, .08); }
.status-bg-completed { background: rgba(16, 185, 129, .08); }
.status-bg-rejected { background: rgba(225, 29, 72, .08); }
.status-bg-processing { background: rgba(14, 165, 233, .08); }
.status-bg-active { background: rgba(16, 185, 129, .08); }
.status-bg-inactive { background: rgba(100, 116, 139, .08); }
.status-bg-expired { background: rgba(225, 29, 72, .08); }

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}
table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 14px;
}
table.data th, table.data td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
table.data th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--surface-2); }

/* Code */
code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 13px;
    padding: 2px 6px;
    background: var(--code-bg);
    border-radius: 4px;
    color: var(--text);
}
