/* ============================================================
   License Management System — Admin CSS
   ============================================================ */

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

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #222535;
  --border:    #2c3050;
  --text:      #e8eaf0;
  --muted:     #7b82a0;
  --accent:    #4f6ef7;
  --accent-h:  #3b5bdb;
  --green:     #22c55e;
  --orange:    #f59e0b;
  --red:       #ef4444;
  --purple:    #a855f7;
  --sidebar-w: 220px;
  --radius:    10px;
  --shadow:    0 2px 12px rgba(0,0,0,.35);
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; font-size: 14px; background: var(--bg); color: var(--text); }

/* ============================================================ SIDEBAR */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.sidebar-logo span { font-size: 16px; font-weight: 700; color: var(--text); }
.sidebar-logo svg { width: 24px; height: 24px; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500;
  transition: all .15s;
}
.sidebar-nav a svg { width: 16px; height: 16px; }
.sidebar-nav a:hover { background: var(--surface2); color: var(--text); }
.sidebar-nav a.active { background: rgba(79,110,247,.15); color: var(--accent); }

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--muted);
}
.logout-link { color: var(--red); text-decoration: none; font-weight: 500; }
.logout-link:hover { text-decoration: underline; }

/* ============================================================ LAYOUT */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}
.topbar h2 { font-size: 18px; font-weight: 600; }

.content-wrap { padding: 24px 28px; flex: 1; }

/* ============================================================ CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.form-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* ============================================================ GRIDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 18px; height: 18px; }
.icon-total   { background: rgba(79,110,247,.15); color: var(--accent); }
.icon-active  { background: rgba(34,197,94,.15);  color: var(--green); }
.icon-inactive{ background: rgba(123,130,160,.15);color: var(--muted); }
.icon-expired { background: rgba(245,158,11,.15); color: var(--orange); }
.icon-banned  { background: rgba(239,68,68,.15);  color: var(--red); }
.icon-logs    { background: rgba(168,85,247,.15); color: var(--purple); }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.two-col-grid      { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col-grid-asym { display: grid; grid-template-columns: 380px 1fr; gap: 20px; }
@media (max-width: 900px) {
  .two-col-grid, .two-col-grid-asym { grid-template-columns: 1fr; }
}

/* ============================================================ TABLES */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }

code, .key-code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: rgba(79,110,247,.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(79,110,247,.2);
}
.note-text { font-size: 11px; color: var(--muted); margin-top: 3px; }
.actions-cell { white-space: nowrap; }

/* ============================================================ BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: capitalize;
}
.badge-active   { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-inactive { background: rgba(123,130,160,.15); color: var(--muted); }
.badge-expired  { background: rgba(245,158,11,.15);  color: var(--orange); }
.badge-banned   { background: rgba(239,68,68,.15);   color: var(--red); }

.action-tag {
  display: inline-block;
  padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: var(--surface2); color: var(--muted);
}
.tag-blue   { background: rgba(79,110,247,.15); color: var(--accent); }
.tag-green  { background: rgba(34,197,94,.15);  color: var(--green); }
.tag-orange { background: rgba(245,158,11,.15); color: var(--orange); }
.tag-red    { background: rgba(239,68,68,.15);  color: var(--red); }
.tag-purple { background: rgba(168,85,247,.15); color: var(--purple); }
.tag-gray   { background: var(--surface2);      color: var(--muted); }

.plan-tag {
  display: inline-block;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: rgba(79,110,247,.12); color: var(--accent);
}

/* ============================================================ FORMS */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }

.filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-bar input  { flex: 1; min-width: 200px; max-width: 340px; }
.filter-bar select { min-width: 130px; }

.input-copy-row { display: flex; gap: 8px; }
.input-copy-row input { flex: 1; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--accent);   color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-outline   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-warning   { background: rgba(245,158,11,.15); color: var(--orange); border: 1px solid rgba(245,158,11,.3); }
.btn-warning:hover { background: rgba(245,158,11,.25); }
.btn-danger    { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-delete    { background: rgba(239,68,68,.08); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.btn-delete:hover { background: rgba(239,68,68,.2); }

.btn-sm  { padding: 6px 12px; font-size: 13px; }
.btn-xs  { padding: 4px 8px;  font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ============================================================ ALERTS */
.alert {
  padding: 12px 18px; border-radius: 8px;
  margin: 0 28px 20px; font-size: 14px; font-weight: 500;
}
.alert-success { background: rgba(34,197,94,.12); color: var(--green);  border: 1px solid rgba(34,197,94,.25); }
.alert-error   { background: rgba(239,68,68,.12); color: var(--red);    border: 1px solid rgba(239,68,68,.25); }
.alert-warning { background: rgba(245,158,11,.12);color: var(--orange); border: 1px solid rgba(245,158,11,.25); }

/* ============================================================ GENERATED KEYS */
.generated-keys { padding: 10px 20px; display: flex; flex-direction: column; gap: 8px; }
.key-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
}
.key-row code { flex: 1; font-size: 13px; }

/* ============================================================ PAGINATION */
.pagination {
  display: flex; align-items: center; gap: 4px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--muted); text-decoration: none;
  border: 1px solid var(--border);
  transition: all .15s;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================ INFO GRID */
.info-grid { display: flex; flex-direction: column; gap: 12px; }
.info-grid > div { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.info-grid > div:last-child { border-bottom: none; }
.info-grid span { font-size: 13px; }
.info-grid strong { font-size: 13px; }

/* ============================================================ LOGIN */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  display: flex; flex-direction: column; gap: 20px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--accent); }
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--muted); }
.login-card .form-group { display: flex; flex-direction: column; gap: 6px; }
.login-card label { font-size: 13px; font-weight: 600; }

/* ============================================================ UTILITIES */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-danger { color: var(--red); }
.text-mono   { font-family: monospace; font-size: 12px; }
.small       { font-size: 12px; }

/* ============================================================ SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
