/* ================================================================
   Domain Scout — Stylesheet
   ================================================================ */

/* ── Reset & foundations ────────────────────────────────────────── */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0284c7;
  --info-light: #e0f2fe;
  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── Navbar ─────────────────────────────────────────────────────── */

.navbar {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.nav-brand a {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.nav-link {
  color: #cbd5e1;
  font-size: .9rem;
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: var(--radius);
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.btn-primary-sm {
  background: var(--primary) !important;
  color: #fff !important;
}
.btn-primary-sm:hover { background: var(--primary-dark) !important; }
.btn-ghost {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

/* ── Container ──────────────────────────────────────────────────── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

/* ── Auth pages ─────────────────────────────────────────────────── */

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-form { text-align: left; }
.auth-footer { margin-top: 1.25rem; font-size: .9rem; color: var(--text-muted); }

/* ── Cards ──────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.15rem; margin-bottom: .5rem; }

/* ── Page header ────────────────────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header h1 { font-size: 1.5rem; }
.header-actions { display: flex; gap: .5rem; }

/* ── Forms ──────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: .3rem;
}
.form-group small { color: var(--text-muted); font-weight: 400; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: .6rem .75rem;
  font-size: .95rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.input-lg { font-size: 1.15rem; padding: .8rem 1rem; }

textarea { resize: vertical; }

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.toggle-group { flex: 1; min-width: 200px; }
.toggle-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  padding: .4rem 0;
}
.toggle-label input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--primary);
}
.toggle-label span { font-weight: 500; }
.toggle-label small { color: var(--text-muted); }

details.card { cursor: default; }
.details-summary {
  cursor: pointer;
  padding: .25rem 0;
  user-select: none;
}
.details-summary:hover { opacity: .8; }

/* ── Buttons ────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: .55rem 1.1rem;
  font-size: .9rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

.btn-danger-outline {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
  font-size: .8rem;
  padding: .3rem .6rem;
}
.btn-danger-outline:hover { background: var(--danger-light); }

.btn-sm { font-size: .8rem; padding: .3rem .7rem; }
.btn-lg { font-size: 1rem; padding: .75rem 1.5rem; }
.btn-full { width: 100%; }

.inline-form { display: inline; }

/* ── Alerts ─────────────────────────────────────────────────────── */

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-danger  { background: var(--danger-light);  color: #991b1b; }
.alert-success { background: var(--success-light); color: #166534; }
.alert-warning { background: var(--warning-light); color: #92400e; }

/* ── Badges ─────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.badge-success  { background: var(--success-light); color: #166534; }
.badge-info     { background: var(--info-light);    color: #075985; }
.badge-warning  { background: var(--warning-light); color: #92400e; }
.badge-danger   { background: var(--danger-light);  color: #991b1b; }

.badge-expansion { background: var(--primary-light); color: var(--primary-dark); }
.badge-typo      { background: #fce7f3; color: #9d174d; }
.badge-cctld     { background: #e0e7ff; color: #3730a3; }
.badge-ccsld     { background: #f0fdf4; color: #166534; }

/* ── Tables ─────────────────────────────────────────────────────── */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.table th {
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: .6rem .5rem;
  border-bottom: 2px solid var(--border);
}
.table td {
  padding: .55rem .5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover { background: #f8fafc; }
.table-compact td, .table-compact th { padding: .4rem .4rem; font-size: .84rem; }

.row-warn { background: var(--warning-light) !important; }

.domain-cell { font-family: 'Consolas', 'Monaco', monospace; }
.actions-cell { white-space: nowrap; display: flex; gap: .3rem; align-items: center; }

.sortable { cursor: pointer; }
.sortable:hover { color: var(--primary); }

/* ── Stat cards ─────────────────────────────────────────────────── */

.stats-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 120px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Progress bar ───────────────────────────────────────────────── */

.progress-bar-wrap {
  width: 100%;
  height: 28px;
  background: var(--bg);
  border-radius: 50px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 50px;
  transition: width .4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  min-width: 2rem;
}

/* ── Pack sections ──────────────────────────────────────────────── */

.pack-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .75rem;
  overflow: hidden;
}
.pack-header {
  padding: .75rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}
.pack-header:hover { background: #f1f5f9; }
.pack-meta { font-size: .85rem; color: var(--text-muted); }

/* ── Empty state ────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { margin-bottom: .5rem; }
.empty-state p { color: var(--text-muted); margin-bottom: 1.5rem; max-width: 500px; margin-inline: auto; }

/* ── Utilities ──────────────────────────────────────────────────── */

.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

.pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ── Footer ─────────────────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: .8rem;
}

/* ── Admin panel ────────────────────────────────────────────────── */

.admin-section { margin-bottom: 2rem; }
.admin-section h2 { margin-bottom: 1rem; font-size: 1.25rem; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-admin  { background: var(--primary-light); color: var(--primary-dark); }
.badge-user   { background: var(--surface);       color: var(--text-muted); border: 1px solid var(--border); }
.badge-success{ background: var(--success-light); color: var(--success); }
.badge-warning{ background: var(--warning-light); color: var(--warning); }
.badge-info   { background: var(--info-light);    color: var(--info); }

.action-buttons { display: flex; gap: .35rem; flex-wrap: wrap; }

.btn-sm {
  padding: .25rem .5rem;
  font-size: .78rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  line-height: 1;
}
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-secondary { background: var(--text-muted); color: #fff; }
.btn-secondary:hover { background: var(--text); }

.row-pending { background: var(--warning-light); }

.alert {
  padding: .75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-weight: 500;
}
.alert-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-left: 4px solid var(--warning);
}

.text-muted { color: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .container { padding: 1rem; }
  .navbar { flex-direction: column; gap: .5rem; }
  .nav-links { flex-wrap: wrap; justify-content: center; }
  .stats-row { flex-direction: column; }
  .form-row { flex-direction: column; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .table { font-size: .8rem; }
}
