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

/* ---- Tokens ---- */
:root {
    --navy-950: #0b1220;
    --navy-800: #16233a;
    --navy-700: #1e2d47;
    --slate-500: #6b7a99;
    --slate-200: #e4e8f0;
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --signal: #00c896;   /* received / success */
    --waiting: #f5a623;  /* waiting / pending */
    --danger: #e5484d;   /* cancelled / error */
    --radius: 10px;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Space Grotesk', var(--font-body);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--navy-950);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--navy-950);
}

a { color: var(--navy-700); }

/* ---- Layout ---- */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}

.navbar {
    background: var(--navy-950);
    color: white;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.navbar-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: auto;
}

.navbar-balance {
    background: rgba(0, 200, 150, 0.15);
    color: var(--signal);
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.navbar-links { display: flex; gap: 14px; flex-wrap: wrap; }
.navbar-links a { color: var(--slate-200); text-decoration: none; font-size: 0.92rem; }
.navbar-links a:hover { color: white; }

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(11, 18, 32, 0.08);
    border: 1px solid var(--slate-200);
}

.buy-card, .order-card { max-width: 480px; }

.order-card { border-left: 4px solid var(--signal); }

/* ---- Forms ---- */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy-700);
    margin: 14px 0 6px;
}

label:first-of-type { margin-top: 0; }

input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    font-family: var(--font-body);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--navy-700);
    box-shadow: 0 0 0 3px rgba(30, 45, 71, 0.12);
}

.hint { font-size: 0.8rem; color: var(--slate-500); margin-top: 4px; }

.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 11px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 18px;
    font-family: var(--font-body);
}

.btn-primary { background: var(--navy-950); color: white; }
.btn-primary:hover { background: var(--navy-700); }
.btn-primary:disabled { background: var(--slate-200); color: var(--slate-500); cursor: not-allowed; }

.btn-secondary { background: var(--danger); color: white; }
.btn-small { padding: 6px 12px; font-size: 0.8rem; margin-top: 0; background: var(--slate-200); color: var(--navy-950); }

/* ---- Alerts ---- */
.alert { padding: 12px 14px; border-radius: 8px; margin: 14px 0; font-size: 0.9rem; }
.alert-error { background: rgba(229, 72, 77, 0.1); color: var(--danger); }
.alert-success { background: rgba(0, 200, 150, 0.12); color: #007a5e; }

/* ---- Price / status ---- */
.price-display { margin-top: 14px; font-size: 1.1rem; }

.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: capitalize;
}
.status-waiting { background: rgba(245, 166, 35, 0.15); color: #a86400; }
.status-received { background: rgba(0, 200, 150, 0.15); color: #007a5e; }
.status-cancelled, .status-expired { background: rgba(229, 72, 77, 0.1); color: var(--danger); }

/* ---- Tables ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.88rem;
}
.data-table th, .data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--slate-200);
}
.data-table th { background: var(--navy-950); color: white; font-weight: 600; font-size: 0.8rem; }

/* ---- Auth pages ---- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-950);
    padding: 20px;
}
.auth-card {
    background: white;
    border-radius: var(--radius);
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
}
.auth-card h1 { font-size: 1.3rem; margin-bottom: 2px; }
.auth-card h2 { font-size: 1rem; color: var(--slate-500); font-weight: 500; margin-top: 0; }
.auth-link { margin-top: 18px; font-size: 0.88rem; text-align: center; }

/* ---- Stats grid (admin) ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 16px;
}
.stat-label { font-size: 0.78rem; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; margin-top: 4px; }

/* ---- Mobile ---- */
@media (max-width: 480px) {
    .navbar { padding: 12px 14px; }
    .navbar-links { gap: 10px; }
    .container { padding: 16px 12px 48px; }
    .data-table { font-size: 0.78rem; }
}

/* ---- Sidebar layout ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--navy-950);
    color: white;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin-bottom: 6px; }
.sidebar-balance {
    background: rgba(0, 200, 150, 0.15);
    color: var(--signal);
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: inline-block;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    color: var(--slate-200);
    text-decoration: none;
    font-size: 0.92rem;
    padding: 10px 12px;
    border-radius: 8px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: white; }
.sidebar-nav a.active { background: var(--signal); color: var(--navy-950); font-weight: 600; }
.app-main { flex: 1; min-width: 0; }
.mobile-topbar {
    display: none;
    background: var(--navy-950);
    color: white;
    padding: 14px 16px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}
.mobile-topbar button { background: none; border: none; color: white; font-size: 1.3rem; }

@media (max-width: 800px) {
    .sidebar { position: fixed; left: -240px; z-index: 30; transition: left 0.2s; box-shadow: 4px 0 20px rgba(0,0,0,0.2); }
    .sidebar.open { left: 0; }
    .mobile-topbar { display: flex; }
}

/* ---- Developer API docs ---- */
.endpoint-card { border: 1px solid var(--slate-200); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.endpoint-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #fafbfc; }
.method-badge { font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 6px; color: white; }
.method-get { background: var(--signal); }
.method-post { background: var(--navy-700); }
.endpoint-path { font-family: monospace; font-size: 0.9rem; }
.endpoint-body { padding: 14px 16px; }
.code-block {
    background: var(--navy-950);
    color: #d7e3f4;
    padding: 12px 14px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.78rem;
    overflow-x: auto;
    white-space: pre;
    margin-top: 8px;
}
.key-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #fafbfc;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

/* ---- Support tickets ---- */
.ticket-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--navy-950);
}
.msg-bubble { max-width: 80%; padding: 10px 14px; border-radius: 12px; margin-bottom: 10px; font-size: 0.9rem; }
.msg-user { background: var(--navy-950); color: white; margin-left: auto; }
.msg-admin { background: #fafbfc; border: 1px solid var(--slate-200); }
.msg-meta { font-size: 0.7rem; opacity: 0.7; margin-top: 4px; }
