/* Brasstacks Study Portal — shared CSS */

/* ── Design tokens — dark mode (default) ───────────────────────── */
:root {
  --bg:            #13111C;
  --surface:       #1E1A2E;
  --surface-2:     #2A2440;
  --border:        #3D3560;
  --accent:        #8B5CF6;
  --accent-hover:  #7C3AED;
  --accent-soft:   rgba(139, 92, 246, 0.15);
  --text:          #EDE9FE;
  --text-secondary:#C4B5FD;
  --text-muted:    #7C6FAD;
  --highlight:     #A78BFA;
  --success:       #34D399;
  --success-bg:    rgba(52, 211, 153, 0.12);
  --warning:       #FBBF24;
  --warning-bg:    rgba(251, 191, 36, 0.12);
  --error:         #F87171;
  --error-bg:      rgba(248, 113, 113, 0.12);
  --coin:          #F59E0B;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

/* ── Light mode ──────────────────────────────────────────────────── */
html.light {
  --bg:            #F5F3FF;
  --surface:       #FFFFFF;
  --surface-2:     #EDE9FE;
  --border:        #DDD6FE;
  --accent:        #7C3AED;
  --accent-hover:  #6D28D9;
  --accent-soft:   rgba(124, 58, 237, 0.1);
  --text:          #1E1B4B;
  --text-secondary:#4C3D8A;
  --text-muted:    #7C6FAD;
  --highlight:     #7C3AED;
  --success:       #059669;
  --success-bg:    rgba(5, 150, 105, 0.1);
  --warning:       #D97706;
  --warning-bg:    rgba(217, 119, 6, 0.1);
  --error:         #DC2626;
  --error-bg:      rgba(220, 38, 38, 0.1);
  --coin:          #B45309;
  color-scheme: light;
}

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

/* ── Base ───────────────────────────────────────────────────────── */
html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  transition: background 0.2s, color 0.2s;
}

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

h1, h2, h3, h4, h5, h6 { color: var(--text); line-height: 1.3; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }

p { color: var(--text-secondary); }

/* ── App layout ─────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Nav bar ────────────────────────────────────────────────────── */
.app-nav {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.app-nav .logo {
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.3px;
}
.app-nav .logo:hover { text-decoration: none; opacity: 0.85; }

.app-nav .nav-links {
  display: flex;
  gap: 4px;
}

.app-nav .nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.app-nav .nav-link:hover,
.app-nav .nav-link.active {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}

.app-nav .nav-spacer { flex: 1; }

.app-nav .theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.app-nav .theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

.app-nav .balance {
  color: var(--coin);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--warning-bg);
  transition: opacity 0.15s;
}
.app-nav .balance:hover { opacity: 0.8; text-decoration: none; }

.app-nav .user-menu { position: relative; }

.app-nav .user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s;
}
.app-nav .user-menu-trigger:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.app-nav .user-menu-trigger .chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.app-nav .user-menu-trigger[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.app-nav .user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 160px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  overflow: hidden;
}

.app-nav .user-dropdown a,
.app-nav .user-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}
.app-nav .user-dropdown a:hover,
.app-nav .user-dropdown button:hover {
  background: var(--accent-soft);
  color: var(--text);
  text-decoration: none;
}
.app-nav .user-dropdown .dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Main content area ──────────────────────────────────────────── */
.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: background 0.2s, border-color 0.2s;
}

.card-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.card-hover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
}
.card-hover:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-soft);
  transform: translateY(-1px);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--highlight);
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn-outline:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.btn-outline:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn-ghost:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.btn-ghost:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--success);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-success:hover { opacity: 0.85; text-decoration: none; }
.btn-success:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Inputs ─────────────────────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-muted); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }

select.input { appearance: none; cursor: pointer; }

/* ── Form groups ────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-error  { font-size: 13px; color: var(--error); }
.form-hint   { font-size: 13px; color: var(--text-muted); }

/* ── Banners ────────────────────────────────────────────────────── */
.error-banner {
  background: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--error);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.error-banner button {
  background: none; border: none; color: var(--error);
  cursor: pointer; font-size: 16px; padding: 0; line-height: 1; flex-shrink: 0;
}

.success-banner {
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--success);
  font-size: 14px;
  margin-bottom: 16px;
}

.info-banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--highlight);
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Difficulty badges ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-easy     { background: rgba(16,185,129,0.18); color: #34D399; }
.badge-medium   { background: rgba(251,191,36,0.18);  color: #FBBF24; }
.badge-hard     { background: rgba(248,113,113,0.18); color: #F87171; }

.badge-mastered   { background: rgba(52,211,153,0.18);  color: #34D399; }
.badge-proficient { background: rgba(139,92,246,0.18);  color: #A78BFA; }
.badge-practicing { background: rgba(251,191,36,0.18);  color: #FBBF24; }
.badge-untried    { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

html.light .badge-easy     { background: rgba(5,150,105,0.12);   color: #059669; }
html.light .badge-medium   { background: rgba(217,119,6,0.12);   color: #B45309; }
html.light .badge-hard     { background: rgba(220,38,38,0.12);   color: #DC2626; }
html.light .badge-mastered { background: rgba(5,150,105,0.12);   color: #059669; }
html.light .badge-proficient { background: rgba(124,58,237,0.12); color: #7C3AED; }
html.light .badge-practicing { background: rgba(217,119,6,0.12); color: #B45309; }

/* ── Subject colour strips ──────────────────────────────────────── */
.subject-math     { border-left: 4px solid #60A5FA; }
.subject-science  { border-left: 4px solid #34D399; }
.subject-humanities { border-left: 4px solid #F472B6; }
.subject-english  { border-left: 4px solid #FBBF24; }

/* ── Progress bar ───────────────────────────────────────────────── */
.progress-bar-track {
  background: var(--surface-2);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  background: linear-gradient(90deg, var(--accent), #C084FC);
  border-radius: 4px;
  height: 8px;
  transition: width 0.5s ease;
}

/* ── Coin display ───────────────────────────────────────────────── */
.coin-icon { display: inline-block; }

/* ── Utility ────────────────────────────────────────────────────── */
.text-muted      { color: var(--text-muted); }
.text-secondary  { color: var(--text-secondary); }
.text-accent     { color: var(--highlight); }
.text-success    { color: var(--success); }
.text-warning    { color: var(--warning); }
.text-error      { color: var(--error); }
.text-sm  { font-size: 13px; }
.text-xs  { font-size: 12px; }
.text-lg  { font-size: 18px; }
.font-bold { font-weight: 700; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ── Section headers ────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ── Divider ────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 32px;
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}
.empty-state h3 { margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); margin-bottom: 24px; }

/* ── Loading spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loading page ───────────────────────────────────────────────── */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  gap: 16px;
}

/* ── Alpine cloak ───────────────────────────────────────────────── */
[x-cloak] { display: none !important; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-main { padding: 16px; }
  .app-nav .nav-title { display: none; }
  .app-nav .nav-links { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .app-nav { padding: 0 16px; }
}
