/* ============================================
   CoinMark v5.0 — Web3 Premium Aesthetic
   Teal/Emerald + Gold + Deep Navy
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800&family=Sora:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg-root: #080812;
    --bg-surface: #0d0d1a;
    --bg-elevated: #13132a;
    --bg-overlay: #1a1a35;
    --bg-input: #0a0a16;
    --teal-400: #34d399; --teal-500: #10b981; --teal-600: #059669;
    --gold-400: #d4a929; --gold-500: #c9a227; --gold-600: #a88521;
    --purple-400: #a78bfa; --purple-500: #8b5cf6;
    --accent: var(--teal-500); --accent-hover: var(--teal-400);
    --accent-glow: rgba(16,185,129,0.10);
    --gold-gradient: linear-gradient(135deg, #d4a929, #c9a227, #a88521);
    --teal-gradient: linear-gradient(135deg, #34d399, #10b981, #059669);
    --success: #10b981; --success-bg: rgba(16,185,129,0.08);
    --danger: #f43f5e; --danger-bg: rgba(244,63,94,0.08);
    --warning: #f59e0b; --warning-bg: rgba(245,158,11,0.08);
    --info: #3b82f6; --info-bg: rgba(59,130,246,0.08);
    --text-primary: #f0f0f8; --text-secondary: #8888a8; --text-tertiary: #555570; --text-disabled: #333348;
    --border-default: rgba(255,255,255,0.06); --border-subtle: rgba(255,255,255,0.03);
    --border-accent: rgba(16,185,129,0.18); --border-accent-strong: rgba(16,185,129,0.35);
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.5); --shadow-sm: 0 2px 6px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5); --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
    --shadow-teal: 0 4px 24px rgba(16,185,129,0.12); --shadow-gold: 0 4px 24px rgba(201,162,39,0.10);
    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 20px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1); --duration-fast: 150ms; --duration-base: 250ms;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Sora', 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --sidebar-w: 260px;
    /* Legacy aliases */
    --primary: var(--bg-root); --primary-light: var(--bg-surface); --primary-mid: var(--bg-elevated);
    --input-bg: var(--bg-input); --card-bg: var(--bg-surface);
    --text: var(--text-primary); --text-muted: var(--text-secondary); --text-dim: var(--text-tertiary);
    --border: var(--border-default); --border-light: var(--border-subtle); --border-strong: var(--border-accent-strong);
    --font: var(--font-sans); --radius: 12px; --shadow: var(--shadow-sm);
    --purple-glow: rgba(139,92,246,0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans); background: var(--bg-root); color: var(--text-primary);
    line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; font-size: 14px;
}
a { color: var(--accent); text-decoration: none; transition: color var(--duration-fast) var(--ease); }
a:hover { color: var(--accent-hover); }
::selection { background: rgba(16,185,129,0.3); color: #fff; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(16,185,129,0.15); border-radius: 3px; }

/* LAYOUT */
.app-wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: var(--bg-surface);
    border-right: 1px solid var(--border-default);
    position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100;
    transition: transform var(--duration-base) var(--ease); display: flex; flex-direction: column;
}
.sidebar::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--teal-500), transparent); opacity: 0.3;
}
.sidebar-header {
    padding: 22px 20px 20px; border-bottom: 1px solid var(--border-default);
    display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.sidebar-logo {
    width: 36px; height: 36px; min-width: 36px; max-width: 36px; min-height: 36px; max-height: 36px;
    border-radius: 50%; overflow: hidden; flex-shrink: 0;
    box-shadow: 0 0 16px rgba(16,185,129,0.2), 0 0 4px rgba(201,162,39,0.12);
}
.sidebar-logo img { width: 36px !important; height: 36px !important; object-fit: cover; display: block; border-radius: 50%; }
.sidebar-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.sidebar-title .coin-text { color: var(--gold-400); }
.sidebar-title .mark-text { color: var(--teal-400); }
.sidebar-nav { padding: 14px 0; flex: 1; display: flex; flex-direction: column; }
.nav-section {
    padding: 18px 20px 6px; font-size: 10px; font-weight: 700;
    color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 1.8px;
}
.nav-section:first-child { padding-top: 8px; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 9px 20px;
    color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
    transition: all var(--duration-fast) var(--ease); border-left: 2px solid transparent; margin: 1px 0;
}
.nav-link:hover { color: var(--text-primary); background: rgba(16,185,129,0.04); }
.nav-link.active {
    color: var(--teal-400); background: var(--accent-glow);
    border-left-color: var(--teal-500); font-weight: 600;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.45; }
.nav-link:hover svg { opacity: 0.75; }
.nav-link.active svg { opacity: 1; color: var(--teal-400); }

.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    height: 56px; background: rgba(8,8,18,0.85); border-bottom: 1px solid var(--border-default);
    display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
    position: sticky; top: 0; z-index: 50; backdrop-filter: blur(24px); flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.page-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text-primary); }
.user-badge {
    display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
    background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: 20px;
    font-size: 12px; color: var(--text-secondary); transition: border-color var(--duration-fast) var(--ease);
}
.user-badge:hover { border-color: var(--border-accent); }
.user-avatar {
    width: 26px; height: 26px; border-radius: 50%; background: var(--teal-gradient);
    display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #000;
}
.content-area { padding: 28px; max-width: 1320px; flex: 1; }

/* CARDS */
.card {
    background: var(--bg-surface); border: 1px solid var(--border-default);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-base) var(--ease);
}
.card:hover { border-color: rgba(16,185,129,0.1); }
.card-header {
    padding: 14px 20px; border-bottom: 1px solid var(--border-default);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h3 { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border-default); }

/* STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
    padding: 18px 20px; transition: all var(--duration-base) var(--ease); position: relative; overflow: hidden;
}
.stat-card:hover { border-color: rgba(16,185,129,0.12); box-shadow: var(--shadow-teal); transform: translateY(-1px); }
.stat-card.accent { border-top: 2px solid var(--teal-500); }
.stat-card.success { border-top: 2px solid var(--success); }
.stat-card.warning { border-top: 2px solid var(--warning); }
.stat-card.danger { border-top: 2px solid var(--danger); }
.stat-card.info { border-top: 2px solid var(--info); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.15; letter-spacing: -0.5px; }
.stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* TABLES */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-default); background: var(--bg-root); }
tbody td { padding: 11px 16px; font-size: 13px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); vertical-align: middle; }
tbody tr { transition: background var(--duration-fast) var(--ease); }
tbody tr:hover { background: rgba(16,185,129,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 600; letter-spacing: 0.2px; }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-confirmed, .badge-approved, .badge-completed, .badge-active { background: var(--success-bg); color: var(--success); }
.badge-failed, .badge-expired, .badge-rejected, .badge-deleted, .badge-suspended { background: var(--danger-bg); color: var(--danger); }
.badge-awaiting_claim { background: var(--info-bg); color: var(--info); }
.badge-awaiting_gas, .badge-awaiting_confirmation { background: var(--warning-bg); color: var(--warning); }
.badge-admin { background: rgba(167,139,250,0.1); color: var(--purple-400); }
.badge-merchant { background: var(--info-bg); color: var(--info); }

/* FORMS */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 5px; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; background: var(--bg-input);
    border: 1px solid var(--border-default); border-radius: var(--radius-md);
    color: var(--text-primary); font-size: 13.5px; font-family: var(--font-sans);
    transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(16,185,129,0.08); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-disabled); }
.form-select { cursor: pointer; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23555570' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-textarea { min-height: 100px; resize: vertical; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border: 1px solid transparent; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; font-family: var(--font-sans); cursor: pointer; transition: all var(--duration-fast) var(--ease); text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--teal-gradient); color: #000; font-weight: 700; box-shadow: var(--shadow-xs); }
.btn-primary:hover { box-shadow: var(--shadow-teal); color: #000; filter: brightness(1.1); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-secondary); border-color: var(--border-default); }
.btn-secondary:hover { border-color: var(--border-accent); color: var(--text-primary); background: var(--bg-overlay); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; margin-bottom: 16px; border: 1px solid; line-height: 1.5; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(244,63,94,0.15); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(16,185,129,0.15); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(245,158,11,0.15); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: rgba(59,130,246,0.15); }

/* COPY BOX */
.copy-box { display: flex; align-items: center; gap: 8px; background: var(--bg-root); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 8px 12px; margin: 10px 0; }
.copy-box input { flex: 1; background: none; border: none; color: var(--teal-400); font-family: var(--font-mono); font-size: 12.5px; outline: none; min-width: 0; }
.copy-box .btn-copy { padding: 6px 14px; background: var(--teal-gradient); color: #000; border: none; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; cursor: pointer; transition: all var(--duration-fast) var(--ease); font-family: var(--font-sans); }
.copy-box .btn-copy:hover { box-shadow: var(--shadow-teal); }

/* UTILITIES */
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-tertiary); }
.empty-state svg { opacity: 0.2; margin-bottom: 16px; }
.empty-state h4 { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.empty-state p { font-size: 13px; }
pre { background: var(--bg-root); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 16px; overflow-x: auto; font-size: 12.5px; color: var(--text-secondary); font-family: var(--font-mono); line-height: 1.65; }
code { background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 12.5px; color: var(--teal-400); }

/* PUBLIC PAGES */
.public-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-root); padding: 20px; position: relative; }
.public-page::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 600px; height: 400px; background: radial-gradient(ellipse, rgba(16,185,129,0.04) 0%, transparent 70%); pointer-events: none; }
.public-card { width: 100%; max-width: 420px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-xl); padding: 36px; position: relative; z-index: 1; box-shadow: var(--shadow-lg); }
.public-card-wide { max-width: 540px; }
.public-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; justify-content: center; }
.public-logo-icon { width: 40px; height: 40px; min-width: 40px; max-width: 40px; min-height: 40px; max-height: 40px; border-radius: 50%; overflow: hidden; }
.public-logo-icon img { width: 40px !important; height: 40px !important; object-fit: cover; display: block; border-radius: 50%; }
.public-logo-text { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.public-logo-text .coin-text { color: var(--gold-400); }
.public-logo-text .mark-text { color: var(--teal-400); }
.public-card h2 { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; text-align: center; }
.public-card .subtitle { font-size: 13.5px; color: var(--text-tertiary); text-align: center; margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-tertiary); }

/* PAYMENT PAGE */
.payment-page { min-height: 100vh; background: var(--bg-root); display: flex; align-items: center; justify-content: center; padding: 20px; }
.payment-card { width: 100%; max-width: 460px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-lg); }
.payment-header { background: var(--teal-gradient); padding: 24px; text-align: center; color: #000; }
.payment-amount { font-family: var(--font-display); font-size: 34px; font-weight: 800; }
.payment-currency { font-size: 14px; font-weight: 600; opacity: 0.7; }
.payment-body { padding: 20px; }
.payment-detail { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.payment-detail:last-child { border-bottom: none; }
.payment-detail .label { color: var(--text-tertiary); }
.payment-detail .value { font-weight: 600; color: var(--text-primary); }

/* CLAIM/REFUND PAGES */
.claim-container { max-width: 580px; margin: 0 auto; }
.claim-card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-md); }
.claim-heading { padding: 14px 20px; border-bottom: 1px solid var(--border-default); }
.claim-heading h3 { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0; }
.claim-heading h3.success { color: var(--success); }
.claim-body { padding: 20px; }
.claim-table { width: 100%; border-collapse: collapse; }
.claim-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.claim-table tr:last-child td { border-bottom: none; }
.claim-table .label-cell { text-align: right; white-space: nowrap; color: var(--text-tertiary); width: 40%; font-weight: 500; }
.claim-table .value-cell { color: var(--text-primary); font-weight: 600; }
.claim-table .value-cell.coins { color: var(--teal-400); font-family: var(--font-mono); }
.claim-note { background: var(--bg-root); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 14px 16px; margin-top: 14px; font-size: 12.5px; color: var(--text-tertiary); line-height: 1.6; }
.claim-note b { color: var(--warning); }
.claim-steps-bar { display: flex; gap: 4px; margin-bottom: 20px; }
.claim-step-dot { flex: 1; height: 3px; border-radius: 2px; background: var(--border-default); }
.claim-step-dot.active { background: var(--teal-500); }
.claim-step-dot.done { background: var(--success); }
.gas-info-box { background: var(--bg-root); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 20px; margin-top: 16px; }
.gas-layout { display: flex; gap: 20px; align-items: flex-start; }
.gas-qr { flex-shrink: 0; background: #fff; padding: 8px; border-radius: 8px; }
.gas-qr img { display: block; width: 140px; height: 140px; }
.gas-details { flex: 1; font-size: 13px; line-height: 1.7; color: var(--text-tertiary); }
.gas-details b { color: var(--text-primary); }
.gas-addr { font-family: var(--font-mono); font-size: 11.5px; color: var(--teal-400); word-break: break-all; background: var(--bg-surface); padding: 8px 10px; border-radius: 6px; margin: 8px 0; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-default); }
.gas-addr button { flex-shrink: 0; }
.txid-hint { font-size: 11.5px; color: var(--text-disabled); margin-top: 5px; line-height: 1.5; }
@media (max-width: 560px) { .gas-layout { flex-direction: column; align-items: center; } }
.confirm-info { font-size: 13.5px; color: var(--text-tertiary); line-height: 1.7; margin-bottom: 14px; }
.confirm-address { background: var(--bg-root); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 12px 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--teal-400); word-break: break-all; margin: 10px 0; }
.status-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.status-row:last-child { border-bottom: none; }
.status-row .label { color: var(--text-tertiary); }
.status-row .value { color: var(--text-primary); font-weight: 600; }

/* INSTALLER */
.installer-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-root); padding: 20px; }
.installer-card { width: 100%; max-width: 560px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-xl); padding: 36px; box-shadow: var(--shadow-lg); }
.installer-steps { display: flex; gap: 4px; margin-bottom: 28px; }
.installer-step { flex: 1; height: 3px; background: var(--border-default); border-radius: 2px; }
.installer-step.active { background: var(--teal-500); }
.installer-step.done { background: var(--success); }
.check-list { list-style: none; padding: 0; }
.check-list li { padding: 7px 0; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check-list .ok { color: var(--success); }
.check-list .fail { color: var(--danger); }

/* MOBILE */
.mobile-toggle { display: none; background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.mobile-toggle:hover { background: var(--bg-elevated); }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); } .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; } .mobile-toggle { display: flex; align-items: center; justify-content: center; }
    .content-area { padding: 16px; } .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 20px; } .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } .public-card { padding: 24px; } }
