/* ============================================================
   Design tokens
   Subject: SMS/telecom infrastructure — a "signal" motif
   (signal bars, transmission pulse) instead of generic SaaS gradients.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    --ink: #0E1233;
    --ink-soft: #1B2158;
    --ink-softer: #262C6B;
    --paper: #F6F7FB;
    --surface: #FFFFFF;
    --signal: #00D2A0;
    --signal-dark: #00A882;
    --signal-tint: #E3FBF4;
    --amber: #F5A623;
    --amber-tint: #FEF3DE;
    --coral: #FF5C5C;
    --coral-tint: #FFE9E9;
    --text: #171A34;
    --text-muted: #6B7089;
    --border: #E4E6F0;
    --radius: 10px;
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--paper);
    color: var(--text);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-top: 0;
}
h1 { font-size: 24px; }
h2 { font-size: 17px; color: var(--text); }

code, .mono { font-family: 'IBM Plex Mono', monospace; }

a { color: var(--signal-dark); }

/* ============================================================
   App shell — fixed sidebar + main content
   Pages that aren't logged in (login/register/install) simply
   don't include the sidebar, and .wrap centers itself instead.
   ============================================================ */

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--ink);
    color: #C8CBEE;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 28px;
    color: #fff;
    text-decoration: none;
}
.brand-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
}

/* Signature element: signal bars — used as the logomark and as a
   live "connected" indicator wherever a gateway/payment status shows. */
.signal-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.signal-bars .bar { width: 3px; background: var(--signal); border-radius: 1px; animation: pulse-bar 1.6s ease-in-out infinite; }
.signal-bars .bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.signal-bars .bar:nth-child(2) { height: 65%; animation-delay: 0.15s; }
.signal-bars .bar:nth-child(3) { height: 90%; animation-delay: 0.3s; }
.signal-bars .bar:nth-child(4) { height: 55%; animation-delay: 0.45s; }
.signal-bars.static .bar { animation: none; }
.signal-bars.off .bar { background: #4A4F7A; }
@keyframes pulse-bar {
    0%, 100% { opacity: 0.55; transform: scaleY(0.85); }
    50% { opacity: 1; transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
    .signal-bars .bar { animation: none; }
}

.nav-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6E73A8;
    padding: 16px 10px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #C8CBEE;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
}
.nav-link svg { flex-shrink: 0; opacity: 0.85; }
.nav-link:hover { background: var(--ink-soft); color: #fff; }
.nav-link.active { background: var(--ink-soft); color: #fff; border-left-color: var(--signal); }

.nav-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--ink-soft); }
.nav-user { padding: 8px 10px; font-size: 13px; color: #9297C7; }
.nav-user strong { display: block; color: #fff; font-size: 14px; font-weight: 600; }

.main-content {
    margin-left: var(--sidebar-w);
    padding: 32px 40px 60px;
    max-width: 980px;
}

@media (max-width: 860px) {
    .sidebar { position: static; width: 100%; flex-direction: row; align-items: center; padding: 12px 16px; }
    .brand { padding: 0; margin-right: 12px; }
    .nav-section-label { display: none; }
    .nav-link { padding: 6px 8px; }
    .nav-footer { margin-top: 0; padding-top: 0; border-top: none; margin-left: auto; }
    .main-content { margin-left: 0; padding: 20px; }
}

/* ============================================================
   Standalone pages (login/register/install) — no sidebar
   ============================================================ */
.wrap {
    max-width: 720px;
    margin: 40px auto;
    padding: 0 20px;
}
.auth-shell {
    min-height: 100vh;
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}
.auth-shell .brand { justify-content: center; padding-bottom: 32px; }
.auth-shell .brand-name { font-size: 20px; }
.auth-card-wrap { width: 100%; max-width: 440px; }

/* ============================================================
   Cards, forms, buttons, tables — shared everywhere
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(14, 18, 51, 0.04);
}

label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; margin-top: 16px; color: var(--text); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=file],
input[type=datetime-local], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--signal);
    box-shadow: 0 0 0 3px var(--signal-tint);
}
textarea { resize: vertical; }

button, .btn {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .btn:hover { background: var(--ink-soft); }
.btn-signal { background: var(--signal-dark); }
.btn-signal:hover { background: var(--signal); }
.btn-danger { background: var(--coral); }
.btn-danger:hover { background: #e34f4f; }

.nav { margin-bottom: 20px; }
.nav::after { content: ""; display: table; clear: both; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: var(--signal-tint); color: #036953; }
.alert-error { background: var(--coral-tint); color: #A32E2E; }

table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13.5px; }
th { text-align: left; padding: 10px; border-bottom: 2px solid var(--border); color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); }

.status-sent, .badge-active { color: var(--signal-dark); font-weight: 600; }
.status-failed, .badge-suspended { color: var(--coral); font-weight: 600; }
.hint { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.balance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--amber-tint);
    color: #8A5A00;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13.5px;
}

.plan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; }
.plan-card:hover { border-color: var(--signal); }

/* ============================================================
   Stat cards (dashboard)
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }
.stat-value { font-family: 'IBM Plex Mono', monospace; font-size: 28px; font-weight: 600; color: var(--ink); }
.stat-value.accent { color: var(--signal-dark); }

.status-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--paper); border: 1px solid var(--border); margin-right: 10px; margin-bottom: 8px; }
.status-chip.ok { background: var(--signal-tint); color: #036953; border-color: transparent; }
.status-chip.warn { background: var(--amber-tint); color: #8A5A00; border-color: transparent; }

/* ============================================================
   Setup wizard (install.php)
   ============================================================ */
.step-track { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.step-dot {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600;
    background: var(--border); color: var(--text-muted);
    flex-shrink: 0;
}
.step-dot.active { background: var(--signal); color: #023A2D; }
.step-dot.done { background: var(--signal-dark); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border); }
.step-line.done { background: var(--signal-dark); }
.step-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
