/* ============================================================
   BoosterPanel — Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Sora:wght@400;500;600&display=swap');

/* ---- Reset & Variables ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1117;
  --bg2:      #161b27;
  --bg3:      #1e2538;
  --border:   #2a3248;
  --accent:   #4f8ef7;
  --accent2:  #2563eb;
  --text:     #e2e8f0;
  --muted:    #8892a4;
  --green:    #22c55e;
  --amber:    #f59e0b;
  --red:      #ef4444;
  --font:     'Sora', sans-serif;
  --mono:     'IBM Plex Mono', monospace;
  --rad:      8px;
  --rad-lg:   12px;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================
   AUTH / LOGIN PAGE
   ============================================================ */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

body.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(79,142,247,.09) 0%, transparent 70%);
  pointer-events: none;
}

.login-wrap {
  width: 100%;
  max-width: 380px;
  padding: 1rem;
  position: relative;
  z-index: 1;
}

.login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rad-lg);
  padding: 2.25rem 2rem;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.75rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon.small {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.brand-name span { color: var(--accent); }

.login-box h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

.alert-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--rad);
  padding: 9px 12px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--red);
  margin-bottom: 1rem;
}

/* ---- Form Fields ---- */
.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 9px 13px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s;
  appearance: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.field textarea {
  resize: vertical;
  min-height: 72px;
}

.field.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  border: none;
  border-radius: var(--rad);
  padding: 9px 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary:hover { background: var(--accent2); }
.btn-primary.full-width { width: 100%; justify-content: center; margin-top: 4px; }

.btn-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 9px 16px;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all .2s;
}

.btn-cancel:hover {
  border-color: var(--muted);
  color: var(--text);
}

/* ============================================================
   DASHBOARD PAGE
   ============================================================ */
body.dashboard-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Topbar ---- */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  height: 54px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title {
  font-size: 14px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.btn-logout {
  font-size: 12px;
  color: var(--red);
  background: none;
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
  transition: all .2s;
}

.btn-logout:hover { background: rgba(239,68,68,.1); }

/* ---- Main Content ---- */
.main-content {
  padding: 1.5rem;
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.page-header p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 14px 16px;
}

.stat-label {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.stat-value.green  { color: var(--green); }
.stat-value.amber  { color: var(--amber); }
.stat-value.muted  { color: var(--muted); }

/* ---- Controls ---- */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 8px 12px 8px 32px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s;
}

.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--muted); }

#filter-status {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

/* ---- Table ---- */
.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rad-lg);
  overflow: hidden;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: var(--bg3);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(42,50,72,.6);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); transition: background .15s; }

.cell-id     { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.cell-email  { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.cell-server { font-size: 12px; color: var(--muted); }
.cell-date   { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.cell-notes  { font-size: 12px; color: var(--muted); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-empty  { color: var(--border); }

.loading-cell, .empty-cell {
  text-align: center;
  padding: 2.5rem;
  color: var(--muted);
  font-size: 13px;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-ready    { background: rgba(34,197,94,.1);   color: #4ade80; }
.badge-ready::before    { background: #22c55e; }
.badge-used     { background: rgba(167,139,250,.1); color: #a78bfa; }
.badge-used::before     { background: #8b5cf6; }
.badge-cooldown { background: rgba(245,158,11,.1);  color: #fbbf24; }
.badge-cooldown::before { background: #f59e0b; }
.badge-pending  { background: rgba(148,163,184,.1); color: #94a3b8; }
.badge-pending::before  { background: #64748b; }

/* ---- Action Buttons ---- */
.action-btns { display: flex; gap: 6px; }

.act-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  transition: all .2s;
  white-space: nowrap;
}

.act-btn:hover           { border-color: var(--accent); color: var(--accent); }
.act-btn.btn-del:hover   { border-color: var(--red);    color: var(--red); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rad-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-box h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .main-content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .field.row-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .controls-bar { flex-direction: column; }
  .controls-bar > * { width: 100%; }
  .btn-primary { justify-content: center; }
}
