/* ── LT Central API Dashboard — styles ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0f0f23;
    --bg2:       #1a1a3e;
    --bg3:       #252555;
    --sidebar:   #12122e;
    --border:    #2d2d6e;
    --text:      #e2e8f0;
    --text-muted:#8892a4;
    --primary:   #6366f1;
    --primary-h: #4f46e5;
    --success:   #10b981;
    --warning:   #f59e0b;
    --danger:    #ef4444;
    --orange:    #f97316;
    --purple:    #8b5cf6;
    --blue:      #3b82f6;
    --radius:    10px;
    --shadow:    0 4px 20px rgba(0,0,0,0.4);
    --sidebar-w: 240px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); min-height: 100vh; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }

code { background: var(--bg3); padding: 2px 6px; border-radius: 4px;
       font-family: 'Courier New', monospace; font-size: 0.85em; color: #a5b4fc; }

pre { background: var(--bg2); padding: 16px; border-radius: var(--radius);
      overflow-x: auto; font-size: 0.85em; line-height: 1.7; color: #a5b4fc;
      border: 1px solid var(--border); }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.app-wrap { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-w); background: var(--sidebar); border-right: 1px solid var(--border);
           display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
           height: 100vh; z-index: 100; }

.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px 16px;
                font-size: 1.1rem; font-weight: 700; color: var(--text);
                border-bottom: 1px solid var(--border); }
.sidebar-logo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px;
            color: var(--text-muted); transition: all 0.15s; cursor: pointer;
            border-left: 3px solid transparent; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--primary);
                   border-left-color: var(--primary); }
.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.nav-label { font-size: 0.9rem; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border);
                  display: flex; align-items: center; gap: 8px; }
.user-info { display: flex; align-items: center; gap: 8px; flex: 1; overflow: hidden; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
               display: flex; align-items: center; justify-content: center;
               font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }
.btn-logout { padding: 6px 10px; border-radius: 6px; background: var(--bg3);
              color: var(--text-muted); font-size: 1rem; transition: all 0.15s; }
.btn-logout:hover { background: var(--danger); color: #fff; }

.main-content { flex: 1; margin-left: var(--sidebar-w); padding: 24px;
                max-width: calc(100vw - var(--sidebar-w)); }

.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--text); }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
        margin-bottom: 20px; overflow: hidden; }
.card-header { padding: 14px 18px; font-weight: 600; font-size: 0.95rem;
               border-bottom: 1px solid var(--border); display: flex;
               align-items: center; justify-content: space-between; gap: 12px; }
.card-body { padding: 18px; }
.card-footer { padding: 10px 18px; font-size: 0.82rem; border-top: 1px solid var(--border); }

.card-success { border-color: var(--success); }
.card-success .card-header { color: var(--success); }
.card-warning { border-color: var(--warning); }
.card-warning .card-header { color: var(--warning); }
.card-danger  { border-color: var(--danger); }
.card-danger  .card-header { color: var(--danger); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
       border-radius: 7px; border: none; font-size: 0.88rem; font-weight: 500;
       cursor: pointer; transition: all 0.15s; text-decoration: none; color: #fff; }
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary   { background: var(--primary); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); }
.btn-warning   { background: var(--warning); color: #000; }
.btn-danger    { background: var(--danger); }
.btn-sm        { padding: 5px 10px; font-size: 0.8rem; }
.btn-full      { width: 100%; justify-content: center; }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px;
         font-size: 0.9rem; border: 1px solid; }
.alert-success { background: rgba(16,185,129,0.12); border-color: var(--success); color: #6ee7b7; }
.alert-error   { background: rgba(239, 68, 68,0.12); border-color: var(--danger);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11, 0.12); border-color: var(--warning); color: #fcd34d; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500;
                    color: var(--text-muted); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; background: var(--bg3); border: 1px solid var(--border);
    border-radius: 7px; color: var(--text); font-size: 0.9rem; outline: none;
    transition: border-color 0.15s; }
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.form-group small { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.form-row   { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row-4 { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 12px; }
.checkbox-label { display: flex !important; flex-direction: row !important; align-items: center;
                  gap: 8px; cursor: pointer; font-size: 0.9rem !important; color: var(--text) !important; }
.checkbox-label input[type=checkbox] { width: auto; }
.required { color: var(--danger); }

.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select { padding: 5px 8px; font-size: 0.82rem; background: var(--bg3);
                       border: 1px solid var(--border); border-radius: 6px; color: var(--text); }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th { padding: 10px 14px; text-align: left; background: var(--bg3);
                  color: var(--text-muted); font-weight: 600; font-size: 0.8rem;
                  text-transform: uppercase; letter-spacing: 0.05em;
                  border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px 14px; border-bottom: 1px solid rgba(45,45,110,0.5);
                  vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(99,102,241,0.05); }
.actions { display: flex; gap: 6px; align-items: center; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px;
         font-size: 0.75rem; font-weight: 600; }
.badge-green  { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-red    { background: rgba(239,68,68, 0.15); color: #f87171; }
.badge-orange { background: rgba(249,115,22,0.15); color: #fb923c; }
.badge-blue   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }
.badge-gray   { background: rgba(100,116,139,0.15); color: #94a3b8; }

/* ── Stat grids ─────────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
             padding: 20px 16px; text-align: center; }
.stat-icon  { font-size: 1.8rem; margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.stats-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 16px; }
.stat-item    { background: var(--bg3); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-item.green  { border-top: 3px solid var(--success); }
.stat-item.orange { border-top: 3px solid var(--orange); }
.stat-num  { font-size: 1.8rem; font-weight: 700; }
.stat-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.stat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat-label-inline { color: var(--text-muted); font-size: 0.88rem; min-width: 180px; }

/* ── Progress bars ──────────────────────────────────────────────────────────── */
.progress-bar-wrap { margin-top: 16px; }
.progress-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.progress-bar { background: var(--bg3); border-radius: 20px; height: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success));
                 border-radius: 20px; transition: width 0.5s ease; }

.mini-bar { display: flex; align-items: center; gap: 8px; }
.mini-fill { height: 6px; background: var(--success); border-radius: 3px; min-width: 4px; max-width: 80px; }
.mini-bar span { font-size: 0.8rem; color: var(--text-muted); }

/* ── Action grid ─────────────────────────────────────────────────────────────── */
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; }
.action-btn { display: flex; align-items: center; justify-content: center; gap: 8px;
              padding: 14px; background: var(--bg3); border: 1px solid var(--border);
              border-radius: var(--radius); font-size: 0.88rem; font-weight: 500;
              color: var(--text); transition: all 0.15s; text-align: center; }
.action-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff;
                    transform: translateY(-2px); box-shadow: var(--shadow); }

/* ── API key ────────────────────────────────────────────────────────────────── */
.api-key { cursor: pointer; user-select: all; }
.api-key-reveal { margin: 16px 0; }
.api-key-reveal label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.api-key-box { display: flex; align-items: center; gap: 10px; background: var(--bg3);
               border: 2px solid var(--success); border-radius: var(--radius); padding: 12px 14px; }
.api-key-box code { flex: 1; font-size: 0.95rem; color: #34d399; word-break: break-all; background: none; }

.code-snippet { margin: 16px 0; }
.code-snippet label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }

/* ── Lang badge ─────────────────────────────────────────────────────────────── */
.lang-badge { display: inline-block; background: var(--bg3); padding: 2px 8px;
              border-radius: 4px; font-family: monospace; font-size: 0.82rem;
              color: #a5b4fc; border: 1px solid var(--border); }

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

/* ── Text helpers ───────────────────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-danger { color: #fca5a5; }
.text-green  { color: #34d399; }
.text-orange { color: #fb923c; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7);
         display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal-box { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
             padding: 28px; min-width: 360px; max-width: 90%; }
.modal-box h3 { margin-bottom: 20px; font-size: 1.1rem; }

/* ── Login page ─────────────────────────────────────────────────────────────── */
body.login-page { display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; max-width: 380px; background: var(--bg2); border: 1px solid var(--border);
              border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); }
.login-logo { font-size: 3rem; text-align: center; margin-bottom: 8px; }
.login-wrap h1 { text-align: center; font-size: 1.4rem; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 24px; }
.login-wrap .form-group { margin-bottom: 14px; }
.login-wrap .btn { margin-top: 8px; }

/* ── Action row ─────────────────────────────────────────────────────────────── */
.action-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo span, .nav-label, .user-name, .user-role { display: none; }
    .sidebar-logo { justify-content: center; }
    .nav-item { justify-content: center; }
    .main-content { margin-left: 60px; padding: 16px; }
    .stats-grid-2, .stats-grid-3 { grid-template-columns: 1fr; }
    .form-row-4 { grid-template-columns: 1fr; }
}
