/* ==========================================================================
   Tales N Tune — Shared Stylesheet
   Interactive children's storybook & reading development platform
   ========================================================================== */

/* --------------------------------------------------------------------------
   Google Font Import
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* --------------------------------------------------------------------------
   CSS Custom Properties — Light Theme (default)
   -------------------------------------------------------------------------- */
:root {
  /* Core palette */
  --color-bg:             #FFF8F0;
  --color-bg-alt:         #FFF0E0;
  --color-surface:        #FFFFFF;
  --color-surface-hover:  #FFF5EB;
  --color-primary:        #7C5CBF;
  --color-primary-light:  #9B7FD4;
  --color-primary-dark:   #5E3FA3;
  --color-secondary:      #FFD166;
  --color-secondary-dark: #E6B84D;
  --color-accent:         #FF8C69;
  --color-accent-dark:    #E6734F;
  --color-success:        #7BC67E;
  --color-success-dark:   #5FAF62;
  --color-info:           #5DADE2;
  --color-warning:        #FFD166;
  --color-danger:         #E74C3C;

  /* Text */
  --color-text:           #2D2D3A;
  --color-text-light:     #5A5A72;
  --color-text-muted:     #8E8EA0;
  --color-text-inverse:   #FFFFFF;

  /* Borders & shadows */
  --color-border:         #E8DFD6;
  --color-border-light:   #F0E8DF;
  --shadow-sm:            0 1px 3px rgba(44, 44, 58, 0.06);
  --shadow-md:            0 4px 12px rgba(44, 44, 58, 0.08);
  --shadow-lg:            0 8px 30px rgba(44, 44, 58, 0.12);
  --shadow-xl:            0 12px 40px rgba(44, 44, 58, 0.16);
  --shadow-glow:          0 0 20px rgba(124, 92, 191, 0.15);

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

  /* Spacing scale */
  --space-xs:             4px;
  --space-sm:             8px;
  --space-md:             16px;
  --space-lg:             24px;
  --space-xl:             32px;
  --space-2xl:            48px;
  --space-3xl:            64px;

  /* Typography */
  --font-family:          'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs:         0.75rem;
  --font-size-sm:         0.875rem;
  --font-size-base:       1rem;
  --font-size-md:         1.125rem;
  --font-size-lg:         1.25rem;
  --font-size-xl:         1.5rem;
  --font-size-2xl:        2rem;
  --font-size-3xl:        2.5rem;
  --font-size-4xl:        3rem;

  /* Transitions */
  --transition-fast:      150ms ease;
  --transition-base:      250ms ease;
  --transition-slow:      400ms ease;

  /* Z-index scale */
  --z-dropdown:           100;
  --z-sticky:             200;
  --z-modal-backdrop:     900;
  --z-modal:              1000;
  --z-toast:              1100;

  /* Container */
  --container-max:        1200px;
  --container-narrow:     800px;
}

/* --------------------------------------------------------------------------
   Dark Theme
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --color-bg:             #1A1A2E;
  --color-bg-alt:         #16213E;
  --color-surface:        #222244;
  --color-surface-hover:  #2A2A50;
  --color-primary:        #B8A9D4;
  --color-primary-light:  #CFC2E5;
  --color-primary-dark:   #9B89BF;
  --color-secondary:      #FFD166;
  --color-secondary-dark: #E6B84D;
  --color-accent:         #FF8C69;
  --color-accent-dark:    #E6734F;
  --color-success:        #5DADE2;
  --color-success-dark:   #4A9BCC;
  --color-info:           #5DADE2;
  --color-warning:        #FFD166;
  --color-danger:         #E74C3C;

  --color-text:           #F0E6D3;
  --color-text-light:     #C8BDB0;
  --color-text-muted:     #8A8099;
  --color-text-inverse:   #1A1A2E;

  --color-border:         #3A3A5C;
  --color-border-light:   #2E2E4A;
  --shadow-sm:            0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md:            0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg:            0 8px 30px rgba(0, 0, 0, 0.3);
  --shadow-xl:            0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-glow:          0 0 20px rgba(184, 169, 212, 0.2);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.text-center    { text-align: center; }
.text-left      { text-align: left; }
.text-right     { text-align: right; }

.text-primary   { color: var(--color-primary); }
.text-accent    { color: var(--color-accent); }
.text-success   { color: var(--color-success); }
.text-muted     { color: var(--color-text-muted); }
.text-light     { color: var(--color-text-light); }

.fw-400 { font-weight: 400; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }

.fs-xs  { font-size: var(--font-size-xs); }
.fs-sm  { font-size: var(--font-size-sm); }
.fs-md  { font-size: var(--font-size-md); }
.fs-lg  { font-size: var(--font-size-lg); }
.fs-xl  { font-size: var(--font-size-xl); }
.fs-2xl { font-size: var(--font-size-2xl); }
.fs-3xl { font-size: var(--font-size-3xl); }

.d-flex       { display: flex; }
.d-grid       { display: grid; }
.d-block      { display: block; }
.d-inline     { display: inline; }
.d-none       { display: none; }

.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.gap-xs        { gap: var(--space-xs); }
.gap-sm        { gap: var(--space-sm); }
.gap-md        { gap: var(--space-md); }
.gap-lg        { gap: var(--space-lg); }
.gap-xl        { gap: var(--space-xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--color-text-inverse);
  box-shadow: 0 4px 14px rgba(124, 92, 191, 0.3);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  box-shadow: 0 6px 20px rgba(124, 92, 191, 0.4);
  transform: translateY(-2px);
}

/* Secondary */
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  transform: translateY(-2px);
}

/* Accent */
.btn-accent {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(255, 140, 105, 0.3);
}
.btn-accent:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(255, 140, 105, 0.45);
  transform: translateY(-2px);
}

/* Success / green */
.btn-success {
  background: linear-gradient(135deg, var(--color-success), var(--color-success-dark));
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(123, 198, 126, 0.3);
}
.btn-success:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(123, 198, 126, 0.45);
  transform: translateY(-2px);
}

/* Warning / yellow */
.btn-warning {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-dark));
  color: var(--color-text);
  box-shadow: 0 4px 14px rgba(255, 209, 102, 0.3);
}
.btn-warning:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(255, 209, 102, 0.45);
  transform: translateY(-2px);
}

/* Ghost / text button */
.btn-ghost {
  background: transparent;
  color: var(--color-text-light);
  padding: 8px 16px;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

/* Icon button (square) */
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-light);
  font-size: var(--font-size-lg);
  border: 1px solid var(--color-border-light);
}
.btn-icon:hover:not(:disabled) {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Size variants */
.btn-sm {
  padding: 8px 18px;
  font-size: var(--font-size-sm);
}
.btn-lg {
  padding: 16px 36px;
  font-size: var(--font-size-lg);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card--flat:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.card__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--color-bg-alt);
}

.card__body {
  padding: var(--space-lg);
}

.card__title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.card__subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.card__footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Clickable card variant */
.card--clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card--clickable:hover {
  border-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  padding: var(--space-2xl);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base), transform var(--transition-base);
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal__title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--color-primary);
}

.modal__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-size: 18px;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.modal__close:hover {
  background: var(--color-danger);
  color: #FFFFFF;
}

.modal__body {
  margin-bottom: var(--space-lg);
}

.modal__footer {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text-light);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.15);
}

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

.form-input--error {
  border-color: var(--color-danger);
}

.form-input--error:focus {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--color-danger);
  margin-top: var(--space-xs);
  display: none;
}

.form-error.visible {
  display: block;
}

.form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235A5A72' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.15);
}

/* Checkbox / radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Inline form row */
.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-row > * {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Badges & Tags
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge--primary {
  background: rgba(124, 92, 191, 0.12);
  color: var(--color-primary);
}

.badge--success {
  background: rgba(123, 198, 126, 0.15);
  color: var(--color-success-dark);
}

.badge--warning {
  background: rgba(255, 209, 102, 0.2);
  color: #B8860B;
}

.badge--accent {
  background: rgba(255, 140, 105, 0.15);
  color: var(--color-accent-dark);
}

.badge--info {
  background: rgba(93, 173, 226, 0.15);
  color: #2980B9;
}

/* --------------------------------------------------------------------------
   Star Rating Display
   -------------------------------------------------------------------------- */
.stars {
  display: inline-flex;
  gap: 2px;
  color: var(--color-secondary);
  font-size: 14px;
}

.stars .star-empty {
  color: var(--color-border);
}

/* --------------------------------------------------------------------------
   Toast / Alert
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideInRight 0.3s ease forwards;
  max-width: 400px;
}

.toast--success {
  background: var(--color-success);
  color: #FFFFFF;
}

.toast--error {
  background: var(--color-danger);
  color: #FFFFFF;
}

.toast--info {
  background: var(--color-info);
  color: #FFFFFF;
}

.toast--warning {
  background: var(--color-secondary);
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Loading Spinner
   -------------------------------------------------------------------------- */
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--color-border-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--sm {
  width: 20px;
  height: 20px;
  border-width: 3px;
}

.spinner--lg {
  width: 48px;
  height: 48px;
  border-width: 5px;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-3xl);
  color: var(--color-text-muted);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Avatar
   -------------------------------------------------------------------------- */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  color: #FFFFFF;
  flex-shrink: 0;
  user-select: none;
}

.avatar--sm {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.avatar--lg {
  width: 72px;
  height: 72px;
  font-size: 36px;
}

.avatar--xl {
  width: 96px;
  height: 96px;
  font-size: 48px;
}

/* --------------------------------------------------------------------------
   Progress Bar
   -------------------------------------------------------------------------- */
.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transition: width var(--transition-slow);
}

/* --------------------------------------------------------------------------
   Stat Cards (for dashboard)
   -------------------------------------------------------------------------- */
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--color-border-light);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-card__icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
}

.stat-card__value {
  font-size: var(--font-size-2xl);
  font-weight: 900;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-card__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 64px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state__title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-light);
  margin-bottom: var(--space-sm);
}

.empty-state__text {
  font-size: var(--font-size-base);
  margin-bottom: var(--space-lg);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------------------------------------
   Divider
   -------------------------------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-lg) 0;
  border: none;
}

.divider--text {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.divider--text::before,
.divider--text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border-light);
}

/* --------------------------------------------------------------------------
   Keyframe Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-12px);
  }
  60% {
    transform: translateY(-6px);
  }
}

@keyframes starBurst {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.3) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(360deg);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-5deg); }
  75%      { transform: rotate(5deg); }
}

/* Animation utility classes */
.anim-fade-in      { animation: fadeIn 0.5s ease forwards; }
.anim-fade-in-up   { animation: fadeInUp 0.5s ease forwards; }
.anim-fade-in-down { animation: fadeInDown 0.5s ease forwards; }
.anim-slide-in     { animation: slideIn 0.5s ease forwards; }
.anim-bounce       { animation: bounce 1s ease; }
.anim-star-burst   { animation: starBurst 0.6s ease forwards; }
.anim-pulse        { animation: pulse 2s ease-in-out infinite; }
.anim-float        { animation: float 3s ease-in-out infinite; }
.anim-scale-in     { animation: scaleIn 0.3s ease forwards; }
.anim-wiggle       { animation: wiggle 0.5s ease; }

/* Stagger children animation */
.stagger-children > * {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}
.stagger-children > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2)  { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4)  { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6)  { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8)  { animation-delay: 0.40s; }
.stagger-children > *:nth-child(9)  { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.50s; }
.stagger-children > *:nth-child(11) { animation-delay: 0.55s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.60s; }

/* Skeleton / placeholder shimmer */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-bg-alt) 25%,
    var(--color-border-light) 50%,
    var(--color-bg-alt) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Responsive Breakpoints
   -------------------------------------------------------------------------- */

/* Phone (up to 575px) */
@media (max-width: 575.98px) {
  :root {
    --font-size-3xl: 1.75rem;
    --font-size-2xl: 1.5rem;
    --font-size-xl:  1.25rem;
  }

  .container {
    padding: 0 var(--space-md);
  }

  .modal {
    width: 95%;
    padding: var(--space-lg);
    max-height: 95vh;
  }

  .form-row {
    flex-direction: column;
  }

  .hide-phone {
    display: none !important;
  }
}

/* Tablet portrait (576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .hide-tablet-portrait {
    display: none !important;
  }
}

/* Tablet landscape (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .hide-tablet-landscape {
    display: none !important;
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Grid helpers at breakpoints */
@media (max-width: 575.98px) {
  .grid-responsive {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (min-width: 1024px) {
  .grid-responsive {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* --------------------------------------------------------------------------
   Scrollbar Styling
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-alt);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

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

/* --------------------------------------------------------------------------
   Selection Styling
   -------------------------------------------------------------------------- */
::selection {
  background: rgba(124, 92, 191, 0.2);
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Focus Visible (keyboard navigation)
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #FFFFFF;
    color: #000000;
  }

  .btn,
  .modal,
  .modal-backdrop,
  .toast-container {
    display: none !important;
  }
}
