/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f1117;
  color: #c9d1d9;
  line-height: 1.6;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

/* ── Typography ── */
h1 {
  font-size: 1.8rem;
  color: #e6edf3;
  border-bottom: 2px solid #30363d;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}
h2 {
  font-size: 1.3rem;
  color: #58a6ff;
  margin: 1.5rem 0 0.75rem 0;
}
p, li { color: #c9d1d9; margin-bottom: 0.5rem; }
a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Form Container ── */
.form-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}

/* ── Form Elements ── */
label {
  display: block;
  color: #e6edf3;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  margin-top: 1rem;
}
label:first-child { margin-top: 0; }

input[type="email"],
select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
input[type="email"]:focus,
select:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

/* ── Radio Group ── */
.radio-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  font-weight: 400;
  font-size: 0.9rem;
  margin: 0;
  transition: border-color 0.15s, background 0.15s;
}
.radio-group label:hover {
  border-color: #58a6ff;
}
.radio-group input[type="radio"] {
  accent-color: #58a6ff;
}
.radio-group input[type="radio"]:checked + span {
  color: #58a6ff;
}

/* ── Hour Selectors ── */
.hour-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.4rem;
}
.hour-row select {
  width: auto;
  flex: 1;
}
.hour-row span {
  color: #8b949e;
  font-size: 0.9rem;
}

/* ── Submit Button ── */
button[type="submit"], .btn {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.7rem 2rem;
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}
button[type="submit"]:hover, .btn:hover {
  background: #2ea043;
  text-decoration: none;
}
.btn-blue {
  background: #1f6feb;
}
.btn-blue:hover {
  background: #388bfd;
}

/* ── Alerts ── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-success {
  background: rgba(35, 134, 54, 0.15);
  border: 1px solid #238636;
  color: #3fb950;
}
.alert-error {
  background: rgba(218, 54, 51, 0.15);
  border: 1px solid #da3633;
  color: #f85149;
}
.alert-info {
  background: rgba(31, 111, 235, 0.15);
  border: 1px solid #1f6feb;
  color: #58a6ff;
}

/* ── Message Card (success/verify/unsub pages) ── */
.message-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
}
.message-card h2 {
  margin-top: 0;
}
.message-card p {
  color: #8b949e;
  font-size: 0.95rem;
}

/* ── Navigation ── */
nav {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
nav a {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  background: #21262d;
  font-size: 0.9rem;
  color: #c9d1d9;
  transition: background 0.15s;
}
nav a:hover { background: #30363d; text-decoration: none; }
nav a.active { background: #1f6feb; color: #fff; }
nav a.nav-random {
  background: #238636;
  color: #fff;
  margin-left: auto;
}
nav a.nav-random:hover { background: #2ea043; }

/* ── Page Header (title + random button) ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.page-header h1 {
  margin-bottom: 0.25rem;
}
.page-header p {
  margin-bottom: 0;
}
.btn-random {
  background: #238636 !important;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0;
  font-size: 0.85rem !important;
  padding: 0.5rem 1.25rem !important;
}
.btn-random:hover {
  background: #2ea043 !important;
}

/* ── Category Grid ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.category-card {
  display: block;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.1s;
}
.category-card:hover {
  border-color: #58a6ff;
  transform: translateY(-2px);
  text-decoration: none;
}
.category-card h3 {
  color: #e6edf3;
  font-size: 1.05rem;
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.category-count {
  color: #8b949e;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.category-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.category-range {
  color: #484f58;
  font-size: 0.8rem;
  font-family: monospace;
  margin: 0;
}

/* ── Tags ── */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  vertical-align: middle;
}
.tag-pattern {
  background: #30363d;
  color: #8b949e;
}

/* ── Family Dot ── */
.family-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Drill Cards (list view) ── */
.drill-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}
.drill-card:hover { border-color: #58a6ff; }
.drill-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.drill-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1f6feb;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.drill-title {
  color: #e6edf3;
  font-weight: 600;
  font-size: 0.95rem;
}
.drill-plain {
  color: #8b949e;
  font-size: 0.85rem;
  margin: 0;
}
.drill-meta {
  margin-top: 0.5rem;
}

/* ── Complexity Badge ── */
.complexity {
  display: inline-block;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-family: monospace;
  color: #8b949e;
}

/* ── Code Blocks ── */
pre {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
}
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  color: #e6edf3;
}
p code {
  background: #21262d;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ── Drill Detail ── */
.concept {
  color: #8b949e;
  font-style: italic;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.prompt-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.prompt-label {
  color: #58a6ff;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.spoiler-wall {
  height: 200px;
}
.solution-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.solution-label {
  color: #58a6ff;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* ── Drill Nav (prev/next) ── */
.drill-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
}
.drill-nav .btn {
  margin-top: 0;
  font-size: 0.9rem;
  padding: 0.5rem 1.25rem;
}

/* ── Pattern Recognition Detail ── */
.pattern-label {
  color: #58a6ff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}
.signal-list {
  padding-left: 1.25rem;
  margin: 0.75rem 0 1.25rem 0;
}
.signal-list li {
  color: #c9d1d9;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  line-height: 1.5;
}
.method-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-left: 3px solid #58a6ff;
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.method-box .tag {
  margin-bottom: 0.5rem;
}
.method-box p {
  margin: 0.5rem 0 0 0;
  font-size: 0.9rem;
}
.method-alt {
  opacity: 0.8;
}
.trap-box {
  background: rgba(218, 54, 51, 0.08);
  border: 1px solid #da3633;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}
.trap-label {
  color: #f85149;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}
.trap-box p:last-child {
  margin: 0;
  font-size: 0.9rem;
}

/* ── Text & Password Inputs ── */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

/* ── Admin Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  text-align: center;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #e6edf3;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.8rem;
  color: #8b949e;
  margin-top: 0.25rem;
}

/* ── Admin Table ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #21262d;
}
.admin-table th {
  color: #8b949e;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #30363d;
}
.admin-table tr:hover {
  background: rgba(88, 166, 255, 0.04);
}
.admin-table a {
  color: #58a6ff;
}
.admin-table .sort-link {
  color: #8b949e;
  text-decoration: none;
}
.admin-table .sort-link:hover {
  color: #e6edf3;
}
.admin-table .sort-link.active {
  color: #58a6ff;
}

/* ── Danger Button ── */
.btn-danger {
  background: #da3633;
  color: #fff;
}
.btn-danger:hover {
  background: #f85149;
}
.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  margin-top: 0;
}

/* ── Admin Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-bar select {
  width: auto;
}

/* ── Admin Detail Grid ── */
.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin: 1rem 0;
}
.detail-grid dt {
  color: #8b949e;
  font-size: 0.85rem;
  font-weight: 600;
}
.detail-grid dd {
  color: #e6edf3;
  font-size: 0.95rem;
}

/* ── Status Badge ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-green { background: rgba(35,134,54,0.2); color: #3fb950; }
.badge-yellow { background: rgba(210,153,34,0.2); color: #d29922; }
.badge-red { background: rgba(218,54,51,0.2); color: #f85149; }

/* ── Admin Nav Link ── */
nav a.nav-admin {
  background: #30363d;
  color: #8b949e;
  margin-left: auto;
}
nav a.nav-admin:hover { background: #484f58; color: #e6edf3; }

/* ── Textarea ── */
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.15s;
}
textarea:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

/* ── Job Spec Box ── */
.job-spec-box {
  background: rgba(31, 111, 235, 0.08);
  border: 1px solid #1f6feb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.job-spec-label {
  color: #58a6ff;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.job-spec-box p:last-child {
  color: #c9d1d9;
  font-size: 0.9rem;
}

/* ── Add-to-List Widget ── */
.add-to-list-widget {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.add-to-list-widget form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}
.add-to-list-widget select {
  flex: 1;
  max-width: 300px;
}

/* ── List Item Actions ── */
.item-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.item-actions .btn {
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  margin-top: 0;
}

/* ── Hero Section ── */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
  margin-bottom: 2rem;
}
.hero-title {
  font-size: 3rem;
  font-weight: 800;
  color: #e6edf3;
  border: none;
  padding: 0;
  margin-bottom: 0.75rem;
  letter-spacing: -1px;
}
.hero-accent {
  background: linear-gradient(135deg, #58a6ff, #3fb950);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-tagline {
  font-size: 1.2rem;
  color: #e6edf3;
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.hero-sub {
  color: #8b949e;
  font-size: 0.95rem;
  max-width: 540px;
  margin: 0 auto;
}

/* ── Features Grid ── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.feature-card {
  display: block;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.1s;
}
.feature-card:hover {
  border-color: #58a6ff;
  transform: translateY(-2px);
  text-decoration: none;
}
.feature-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}
.feature-card h3 {
  color: #e6edf3;
  font-size: 1.05rem;
  margin: 0 0 0.5rem 0;
}
.feature-card p {
  color: #8b949e;
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
}
@media (max-width: 700px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
  .hero-title {
    font-size: 2.2rem;
  }
}

/* ── Stat Bar ── */
.stat-bar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
  color: #8b949e;
  font-size: 0.9rem;
  font-weight: 500;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
}
.stat-sep {
  color: #30363d;
}

/* ── Footer ── */
footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #30363d;
  color: #484f58;
  font-size: 0.8rem;
  text-align: center;
}
