/**
 * style.css — Единый стиль Almesto (Billing).
 * Тёмная тема, CSS custom properties, Google Fonts Inter.
 */

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

/* ── Токены ──────────────────────────────────────────────────── */
:root {
    --bg-primary: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #252830;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #4ade80;
    --warning: #eab308;
    --danger: #ef4444;
    --muted: #6b7280;
    --border: #2d3140;
    --radius: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Сброс ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }

/* ── Layout ──────────────────────────────────────────────────── */
.layout { display: flex; flex-direction: column; min-height: 100vh; }
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; width: 100%; }
.main-content { flex: 1; padding: 24px 0 48px; }

/* ── Header ──────────────────────────────────────────────────── */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 0;
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(12px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text-primary); }
.logo:hover { color: var(--text-primary); }
.logo-icon { font-size: 20px; }
.logo-sub { font-size: 12px; font-weight: 500; color: var(--accent); background: rgba(59,130,246,.12); padding: 2px 8px; border-radius: 4px; margin-left: 4px; }
.brand-logo-img { width: 16px; height: 16px; object-fit: contain; display: inline-block; vertical-align: -2px; margin-right: 4px; }
.nav { display: flex; align-items: center; gap: 12px; }
.nav-link { color: var(--text-secondary); font-size: 14px; display: flex; align-items: center; gap: 4px; transition: color .2s; }
.nav-link:hover { color: var(--text-primary); }
.nav-user { font-size: 14px; color: var(--text-secondary); }
.nav-divider { width: 1px; height: 20px; background: var(--border); }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb-sep { color: var(--border); }

/* ── Typography ──────────────────────────────────────────────── */
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 20px; }
.text-muted { color: var(--text-muted); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color .2s;
}
.card:hover { border-color: #3a3f50; }
.card-title { font-weight: 600; font-size: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ── Balance ─────────────────────────────────────────────────── */
.balance-card { background: linear-gradient(135deg, #1a1d27 0%, #1e2235 100%); border-color: var(--accent); }
.balance-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.balance-label { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.balance-amount { font-size: 36px; font-weight: 700; color: var(--success); }
.balance-actions { display: flex; gap: 10px; }

/* ── Auth ─────────────────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon { font-size: 40px; }
.auth-logo-title { font-size: 24px; font-weight: 700; margin-top: 8px; }
.auth-logo-sub { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.form-control {
    width: 100%; padding: 10px 14px; font-size: 14px; font-family: var(--font);
    background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius);
    outline: none; transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; font-size: 14px; font-weight: 600; font-family: var(--font);
    border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
    transition: all .2s; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-success { background: #16a34a; color: #fff; }
.btn-warning { background: #ca8a04; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { color: var(--text-primary); border-color: var(--text-muted); }
.btn-full { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-success { background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.3); color: #86efac; }
.alert-warning { background: rgba(234,179,8,.1); border: 1px solid rgba(234,179,8,.3); color: #fde047; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 10px 12px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); font-size: 13px; }
.table td { padding: 10px 12px; border-bottom: 1px solid rgba(45,49,64,.5); }
.table tr:hover td { background: rgba(59,130,246,.03); }

/* ── Status pills ────────────────────────────────────────────── */
.status-pill { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-success { background: rgba(74,222,128,.15); color: var(--success); }
.status-warning { background: rgba(234,179,8,.15); color: var(--warning); }
.status-danger { background: rgba(239,68,68,.15); color: var(--danger); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.pagination-info { font-size: 13px; color: var(--text-muted); }

/* ── Tariff cards ────────────────────────────────────────────── */
.tariff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tariff-card { display: flex; flex-direction: column; text-align: center; padding: 28px 20px; }
.tariff-name { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.tariff-price { font-size: 32px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.tariff-period { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }
.tariff-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

/* ── Amount grid (topup) ─────────────────────────────────────── */
.amount-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.amount-option {
    position: relative; cursor: pointer;
    background: var(--bg-input); border: 2px solid var(--border); border-radius: var(--radius);
    padding: 16px 8px; text-align: center; transition: all .2s;
}
.amount-option input { position: absolute; opacity: 0; }
.amount-option:has(input:checked) { border-color: var(--accent); background: rgba(59,130,246,.08); }
.amount-value { font-size: 18px; font-weight: 700; }
.amount-tag { position: absolute; top: -8px; right: -8px; background: var(--accent); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.popular { border-color: var(--accent); }

/* ── Payment methods ─────────────────────────────────────────── */
.payment-methods { display: flex; gap: 10px; }
.payment-method {
    flex: 1; cursor: pointer;
    background: var(--bg-input); border: 2px solid var(--border); border-radius: var(--radius);
    padding: 14px; text-align: center; transition: all .2s; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.payment-method input { position: absolute; opacity: 0; }
.payment-method.active { border-color: var(--accent); background: rgba(59,130,246,.08); }
.payment-icon { font-size: 24px; }

/* ── Order summary ───────────────────────────────────────────── */
.order-summary { display: flex; flex-direction: column; gap: 12px; }
.order-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(45,49,64,.5); font-size: 14px; }
.order-row span { color: var(--text-secondary); }

/* ── Crypto ───────────────────────────────────────────────────── */
.qr-mock { display: inline-block; padding: 16px; background: var(--bg-input); border-radius: 12px; }
.crypto-address { display: flex; align-items: center; gap: 8px; background: var(--bg-input); padding: 10px 14px; border-radius: var(--radius); font-size: 12px; word-break: break-all; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 32px 16px; }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { color: var(--text-muted); }

/* ── Fade in animation ───────────────────────────────────────── */
.fade-in { animation: fadeIn .4s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
    .header-inner { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 8px; }
    .balance-row { flex-direction: column; align-items: flex-start; }
    .balance-amount { font-size: 28px; }
    .amount-grid { grid-template-columns: repeat(2, 1fr); }
    .payment-methods { flex-direction: column; }
}
