/* ════════════════════════════════════════════
   DAPSTUDIO Admin — Styles
   ════════════════════════════════════════════ */

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-input: #1a1a25;
  --border: #2a2a3a;
  --text: #e0e0e8;
  --text-dim: #8888a0;
  --primary: #fe2c55;
  --primary-hover: #e0264c;
  --cyan: #25f4ee;
  --green: #00d26a;
  --yellow: #ffb800;
  --red: #ff4757;
  --blue: #3b82f6;
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

/* ═══ Login Page ═══ */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, #1a0020 0%, var(--bg) 70%);
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 40px; width: 360px; max-width: 90vw;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 40px; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; color: var(--primary); }
.login-logo .subtitle { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

/* ═══ Forms ═══ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px; outline: none; transition: border .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 14px;
  cursor: pointer; transition: all .2s; font-weight: 500;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-full { width: 100%; }
.btn-small { padding: 6px 14px; font-size: 12px; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.error-msg { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; }

/* ═══ Navbar ═══ */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; background: var(--bg-card);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.nav-brand { font-size: 16px; font-weight: 700; color: var(--primary); }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-link {
  padding: 8px 14px; color: var(--text-dim); text-decoration: none;
  font-size: 13px; border-radius: var(--radius); transition: all .2s;
}
.nav-link:hover { color: var(--text); background: var(--bg-input); }
.nav-link.active { color: var(--cyan); background: rgba(37, 244, 238, .08); }
.nav-logout { color: var(--red); }

/* ═══ Container ═══ */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ═══ Tabs ═══ */
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content h2 { font-size: 20px; margin-bottom: 20px; color: var(--text); }

/* ═══ Stats Grid ═══ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.stat-active .stat-value { color: var(--green); }
.stat-inactive .stat-value { color: var(--yellow); }
.stat-revoked .stat-value { color: var(--red); }
.stat-expired .stat-value { color: var(--text-dim); }
.stat-sessions .stat-value { color: var(--cyan); }

/* ═══ Section Card ═══ */
.section-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.section-card h3 { font-size: 16px; margin-bottom: 16px; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .form-group { margin-bottom: 0; flex: 1; min-width: 120px; }

.generated-keys { margin-top: 16px; }
.generated-keys h4 { font-size: 13px; color: var(--cyan); margin-bottom: 8px; }
.generated-keys pre {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; font-size: 13px;
  white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow-y: auto;
  margin-bottom: 8px;
}

/* ═══ Toolbar ═══ */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; }
.filter-select { width: 150px; }

/* ═══ Table ═══ */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; background: var(--bg-card); position: sticky; top: 0; }
.data-table tr:hover { background: rgba(255,255,255,.02); }
.data-table td { vertical-align: middle; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px;
}
.badge-active { background: rgba(0,210,106,.15); color: var(--green); }
.badge-inactive { background: rgba(255,184,0,.15); color: var(--yellow); }
.badge-revoked { background: rgba(255,71,87,.15); color: var(--red); }
.badge-expired { background: rgba(136,136,160,.15); color: var(--text-dim); }

.key-text { font-family: 'SF Mono', Monaco, monospace; font-size: 12px; cursor: pointer; }
.key-text:hover { color: var(--cyan); }

.action-btns { display: flex; gap: 4px; flex-wrap: nowrap; }

/* ═══ Pagination ═══ */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pagination button { padding: 6px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); cursor: pointer; font-size: 12px; }
.pagination button:hover { border-color: var(--primary); }
.pagination button.active { background: var(--primary); border-color: var(--primary); }
.pagination button:disabled { opacity: .3; cursor: not-allowed; }

/* ═══ Modal ═══ */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,.7); display: flex; align-items: center;
  justify-content: center; z-index: 1000;
}
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; width: 90%; max-width: 800px; max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 22px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .navbar { flex-direction: column; height: auto; padding: 12px; gap: 8px; }
  .nav-links { flex-wrap: wrap; justify-content: center; }
  .inline-form { flex-direction: column; }
  .inline-form .form-group { min-width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
