/* ============================================
   BeatPractice — Design System
   Extracted from Stitch "Piano Exercise Library"
   ============================================ */

/* --- Font Faces --- */
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/Lexend-300.ttf') format('truetype');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Lexend-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/Lexend-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/Lexend-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Lexend-700.ttf') format('truetype');
}

/* --- CSS Custom Properties --- */
:root {
  /* Colors — Dark Theme */
  --bg-deepest: #0a0d14;
  --bg-base: #0f1219;
  --bg-surface: #151a25;
  --bg-card: #1a1f2e;
  --bg-elevated: #222838;
  --bg-input: #1e2433;

  /* Accent */
  --accent: #2b9dee;
  --accent-hover: #3eadff;
  --accent-glow: rgba(43, 157, 238, 0.25);
  --accent-dim: rgba(43, 157, 238, 0.12);

  /* Text */
  --text-primary: #f0f2f5;
  --text-secondary: #8b93a5;
  --text-muted: #5a6275;
  --text-accent: #2b9dee;

  /* Status */
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-error: #f87171;
  --color-perfect: #34d399;
  --color-good: #2b9dee;
  --color-ok: #fbbf24;
  --color-miss: #f87171;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(43, 157, 238, 0.4);

  /* Typography */
  --font-family: 'Lexend', system-ui, -apple-system, sans-serif;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.8125rem;  /* 13px */
  --font-size-base: 0.875rem; /* 14px */
  --font-size-md: 1rem;       /* 16px */
  --font-size-lg: 1.25rem;    /* 20px */
  --font-size-xl: 1.5rem;     /* 24px */
  --font-size-2xl: 2rem;      /* 32px */
  --font-size-3xl: 3rem;      /* 48px */
  --font-size-hero: 5rem;     /* 80px */

  /* Spacing — 4px grid */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-7: 3rem;      /* 48px */
  --space-8: 4rem;      /* 64px */

  /* Roundness */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-modal: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family);
  font-weight: 400;
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-deepest);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--text-accent);
  text-decoration: none;
}

button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  padding: var(--space-2) var(--space-3);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

select {
  appearance: none;
  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='%238b93a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* --- Utility Classes --- */
.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  animation: screenFadeIn var(--duration-slow) var(--ease-out);
}

.screen.active {
  display: flex;
  flex-direction: column;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* App container */
.app-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-5);
  background: var(--bg-base);
  min-height: 100vh;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.4);
}

/* Top navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  margin-bottom: var(--space-6);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--text-primary);
}

.navbar-brand .brand-icon {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: var(--font-size-base);
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-accent);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-md);
  border-radius: var(--radius-md);
}

/* Badge */
.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-beginner {
  background: rgba(52, 211, 153, 0.15);
  color: var(--color-success);
}

.badge-intermediate {
  background: rgba(43, 157, 238, 0.15);
  color: var(--accent);
}

.badge-advanced {
  background: rgba(251, 191, 36, 0.15);
  color: var(--color-warning);
}

.badge-chord {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.25);
}


/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.toggle-wrap .toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-base);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  border: 1px solid var(--border-default);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--duration-fast) var(--ease-out);
}

.toggle-switch.active {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch.active::after {
  left: 22px;
  background: #fff;
}

/* Section heading */
.section-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.section-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
