/* ======================================================
   KumaPinger Portal — Admin CSS
   Clean, professional dark sidebar layout
   ====================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #0f1117;
    --surface:     #1a1d27;
    --surface2:    #22263a;
    --border:      #2e3347;
    --accent:      #4f8ef7;
    --accent-dark: #3a6fd8;
    --green:       #22c55e;
    --red:         #ef4444;
    --yellow:      #f59e0b;
    --purple:      #a855f7;
    --text:        #e2e8f0;
    --text-muted:  #8892a4;
    --sidebar-w:   240px;
    --radius:      8px;
    --shadow:      0 1px 3px rgba(0,0,0,.4);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ── Admin Layout ── */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
}
.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: var(--accent);
}
.logo-icon { font-size: 22px; }
.sidebar-nav { list-style: none; padding: 12px 0; flex: 1; }
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}
.sidebar-nav li a:hover { background: var(--surface2); color: var(--text); }
.sidebar-nav li.active a { background: var(--surface2); color: var(--accent); border-left-color: var(--accent); }
.nav-icon { width: 18px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.btn-logout {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    display: flex; align-items: center; gap: 8px;
}
.btn-logout:hover { color: var(--red); }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-user { color: var(--text-muted); font-size: 13px; }
.content-area { padding: 28px; flex: 1; }

/* ── Page Header ── */
.page-header { display: flex; align-items: baseline; gap: 16px; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 8px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow);
}
.stat-card-warn { border-color: var(--red); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.bg-blue   { background: rgba(79,142,247,.15); color: var(--accent); }
.bg-green  { background: rgba(34,197,94,.15);  color: var(--green); }
.bg-red    { background: rgba(239,68,68,.15);  color: var(--red); }
.bg-purple { background: rgba(168,85,247,.15); color: var(--purple); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.mt-4 { margin-top: 20px; }
.mb-4 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 12px; }
.mt-2 { margin-top: 8px; }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface2); }
.row-stale { opacity: .65; }
.row-error { background: rgba(239,68,68,.06) !important; }
.row-inactive { opacity: .5; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-success  { background: rgba(34,197,94,.15);   color: var(--green); }
.badge-danger   { background: rgba(239,68,68,.15);   color: var(--red); }
.badge-warning  { background: rgba(245,158,11,.15);  color: var(--yellow); }
.badge-secondary{ background: rgba(136,146,164,.15); color: var(--text-muted); }

/* ── Code / Hash ── */
.code-badge {
    display: inline-block;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: var(--accent);
}
.hash-text { font-family: monospace; font-size: 12px; color: var(--text-muted); cursor: help; }

/* ── Forms ── */
.form-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 160px; }
.form-group-sm { flex: 0 0 120px; min-width: 100px; }
.form-group-lg { flex: 2; min-width: 200px; }
label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.form-control {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
.form-control:focus { border-color: var(--accent); }
.form-control-sm { padding: 6px 10px; font-size: 13px; }
.required { color: var(--red); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px;
    border: none; border-radius: var(--radius);
    cursor: pointer; font-size: 13px; font-weight: 600;
    text-decoration: none;
    transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-success  { background: var(--green);   color: #fff; }
.btn-danger   { background: var(--red);     color: #fff; }
.btn-warning  { background: var(--yellow);  color: #000; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; border-left: 4px solid; }
.alert-success { background: rgba(34,197,94,.1);   border-color: var(--green); color: var(--green); }
.alert-danger  { background: rgba(239,68,68,.1);   border-color: var(--red);   color: var(--red); }
.alert-info    { background: rgba(79,142,247,.1);  border-color: var(--accent); color: var(--accent); }
.alert-warning { background: rgba(245,158,11,.1);  border-color: var(--yellow); color: var(--yellow); }
.alert-token   { color: var(--text) !important; }

/* ── Token display ── */
.token-display {
    margin-top: 8px;
    background: var(--surface2);
    border: 1px dashed var(--green);
    border-radius: 6px;
    padding: 10px 14px;
    font-family: 'Consolas', monospace;
    font-size: 13px;
    word-break: break-all;
    color: var(--green);
}

/* ── Login Page ── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%; max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--accent); margin-bottom: 24px; justify-content: center; }
.login-logo .logo-icon { font-size: 28px; }
.login-title { font-size: 20px; font-weight: 600; margin-bottom: 20px; text-align: center; }
