/* ========================================
   Online Tuition Teacher — Design Tokens
   Frontend-only. Does not affect backend.
   Import after legacy styles for gradual migration.
   ======================================== */

@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap");

:root {
  /* ── Primitive tokens (source) ── */
  --ott-color-border-default: #000000;
  --ott-color-text-secondary: #ffffff;
  --ott-color-surface-muted: #ff693d;
  --ott-color-surface-raised: #01202b;
  --ott-color-border-strong: #afb9bd;

  --ott-font-family: "Poppins", system-ui, -apple-system, sans-serif;
  --ott-font-size-base: 16px;
  --ott-font-weight-base: 400;
  --ott-line-height-base: normal;
  --ott-font-size-xs: 14px;
  --ott-font-size-sm: 16px;
  --ott-font-size-md: 20px;

  --ott-space-1: 1px;
  --ott-space-2: 2px;
  --ott-space-3: 4px;
  --ott-space-4: 6px;
  --ott-space-5: 9.5px;
  --ott-space-6: 10px;
  --ott-space-7: 10.4px;
  --ott-space-8: 12px;

  --ott-radius-xs: 8px;
  --ott-shadow-1: rgb(243, 84, 39) 0px -4px 0px 0px inset;
  --ott-motion-instant: 300ms ease;

  /* ── Semantic tokens ── */
  --ott-color-canvas-default: #ffffff;
  --ott-color-canvas-inverse: var(--ott-color-surface-raised);
  --ott-color-text-primary: var(--ott-color-surface-raised);
  --ott-color-text-inverse: var(--ott-color-text-secondary);
  --ott-color-text-muted: var(--ott-color-border-strong);
  --ott-color-text-accent: var(--ott-color-surface-muted);
  --ott-color-action-primary: var(--ott-color-surface-muted);
  --ott-color-action-primary-hover: #f35427;
  --ott-color-action-primary-active: #e04a20;
  --ott-color-border-subtle: rgba(1, 32, 43, 0.12);
  --ott-color-border-focus: var(--ott-color-surface-muted);
  --ott-color-status-success: #16a34a;
  --ott-color-status-warning: #f59e0b;
  --ott-color-status-error: #dc2626;
  --ott-color-status-info: #0ea5e9;

  --ott-font-size-body: var(--ott-font-size-sm);
  --ott-font-size-caption: var(--ott-font-size-xs);
  --ott-font-size-heading: var(--ott-font-size-md);
  --ott-font-size-display: clamp(1.9rem, 4vw, 2.75rem);
  --ott-font-weight-heading: 700;
  --ott-font-weight-action: 600;

  --ott-space-inline-xs: var(--ott-space-3);
  --ott-space-inline-sm: var(--ott-space-6);
  --ott-space-inline-md: var(--ott-space-8);
  --ott-space-stack-sm: var(--ott-space-6);
  --ott-space-stack-md: var(--ott-space-8);
  --ott-space-stack-lg: 24px;
  --ott-space-page-gutter: var(--ott-space-8);

  --ott-radius-control: var(--ott-radius-xs);
  --ott-shadow-elevated: 0 8px 24px rgba(1, 32, 43, 0.12);
  --ott-shadow-cta-inset: var(--ott-shadow-1);
  --ott-motion-transition: var(--ott-motion-instant);

  --ott-layout-content-max: 1200px;
  --ott-layout-content-wide: 1400px;
  --ott-layout-control-height: 44px;
  --ott-layout-nav-height: 68px;
  --ott-layout-card-gap: var(--ott-space-stack-md);
  --ott-layout-section-gap: 64px;

  /* ── Legacy aliases (gradual migration) ── */
  --primary: var(--ott-color-canvas-inverse);
  --primary-light: #023547;
  --primary-dark: #001018;
  --accent: var(--ott-color-action-primary);
  --accent-light: #ff8a65;
  --accent-dark: var(--ott-color-action-primary-active);
  --font-body: var(--ott-font-family);
  --font-heading: var(--ott-font-family);
  --radius-md: var(--ott-radius-control);
  --transition-normal: var(--ott-motion-transition);
}

@media (min-width: 768px) {
  :root {
    --ott-space-page-gutter: 24px;
  }
}

/* ── Base overrides when OTT tokens are active ── */
body.ott-theme,
body.ott-theme {
  font-family: var(--ott-font-family);
  font-size: var(--ott-font-size-body);
  font-weight: var(--ott-font-weight-base);
  line-height: var(--ott-line-height-base);
  color: var(--ott-color-text-primary);
  background-color: var(--ott-color-canvas-default);
}

/* ── Focus-visible (global) ── */
.ott-theme :focus {
  outline: none;
}

.ott-theme :focus-visible {
  outline: 2px solid var(--ott-color-border-focus);
  outline-offset: 2px;
}

/* ── Primary button (OTT) ── */
.ott-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ott-space-inline-xs);
  min-height: var(--ott-layout-control-height);
  padding: var(--ott-space-6) var(--ott-space-inline-md);
  font-family: var(--ott-font-family);
  font-size: var(--ott-font-size-caption);
  font-weight: var(--ott-font-weight-action);
  line-height: 1.4;
  border-radius: var(--ott-radius-control);
  border: none;
  cursor: pointer;
  transition:
    background var(--ott-motion-transition),
    transform var(--ott-motion-transition),
    box-shadow var(--ott-motion-transition),
    opacity var(--ott-motion-transition);
}

.ott-btn--primary {
  background: var(--ott-color-action-primary);
  color: var(--ott-color-text-inverse);
  box-shadow: var(--ott-shadow-cta-inset);
}

.ott-btn--primary:hover:not(:disabled) {
  background: var(--ott-color-action-primary-hover);
  transform: translateY(-1px);
}

.ott-btn--primary:active:not(:disabled) {
  background: var(--ott-color-action-primary-active);
  box-shadow: none;
  transform: translateY(0);
}

.ott-btn--secondary {
  background: transparent;
  color: var(--ott-color-text-accent);
  border: 1px solid var(--ott-color-action-primary);
  box-shadow: none;
}

.ott-btn--secondary:hover:not(:disabled) {
  background: rgba(255, 105, 61, 0.08);
}

.ott-btn--ghost {
  background: transparent;
  color: var(--ott-color-text-primary);
  box-shadow: none;
}

.ott-btn--ghost:hover:not(:disabled) {
  color: var(--ott-color-text-accent);
}

.ott-btn:disabled,
.ott-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.ott-btn--loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.ott-btn--loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ott-color-text-inverse);
  border-top-color: transparent;
  border-radius: 50%;
  animation: ott-spin 0.6s linear infinite;
}

.ott-btn--error {
  border: 2px solid var(--ott-color-status-error);
}

@keyframes ott-spin {
  to { transform: rotate(360deg); }
}

/* ── Hero (OTT) ── */
.ott-hero {
  background: var(--ott-color-canvas-inverse);
  padding: 80px var(--ott-space-page-gutter) 56px;
  position: relative;
  overflow: hidden;
}

.ott-hero::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255, 105, 61, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.ott-hero h1 {
  font-size: var(--ott-font-size-display);
  font-weight: 800;
  color: var(--ott-color-text-inverse);
  line-height: 1.15;
}

.ott-hero h1 em {
  font-style: normal;
  color: var(--ott-color-text-accent);
}

.ott-hero p {
  font-size: var(--ott-font-size-body);
  color: rgba(255, 255, 255, 0.78);
  max-width: 580px;
  margin-inline: auto;
}

/* ── Search bar (OTT) ── */
.ott-search-wrap {
  max-width: 680px;
  margin: 0 auto;
  background: var(--ott-color-canvas-default);
  border-radius: var(--ott-radius-control);
  display: flex;
  overflow: hidden;
  box-shadow: var(--ott-shadow-elevated);
}

.ott-search-input {
  flex: 1;
  border: none;
  padding: var(--ott-space-inline-md) var(--ott-space-stack-lg);
  font-family: var(--ott-font-family);
  font-size: 15px;
  color: var(--ott-color-text-primary);
  min-height: var(--ott-layout-control-height);
  outline: none;
}

.ott-search-btn {
  padding: var(--ott-space-inline-md) 28px;
  background: var(--ott-color-action-primary);
  color: var(--ott-color-text-inverse);
  border: none;
  font-family: var(--ott-font-family);
  font-weight: var(--ott-font-weight-action);
  font-size: var(--ott-font-size-caption);
  cursor: pointer;
  box-shadow: var(--ott-shadow-cta-inset);
  transition: background var(--ott-motion-transition);
  white-space: nowrap;
}

.ott-search-btn:hover {
  background: var(--ott-color-action-primary-hover);
}

/* ── Filter bar (OTT) ── */
.ott-filter-bar {
  background: var(--ott-color-canvas-inverse);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  position: sticky;
  top: var(--ott-layout-nav-height);
  z-index: 200;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
}

/* ── Card (OTT base) ── */
.ott-card {
  background: var(--ott-color-canvas-default);
  border: 1px solid var(--ott-color-border-subtle);
  border-radius: var(--ott-radius-control);
  transition:
    box-shadow var(--ott-motion-transition),
    transform var(--ott-motion-transition);
}

.ott-card:hover {
  box-shadow: var(--ott-shadow-elevated);
  transform: translateY(-2px);
}

.ott-card:focus-visible {
  outline: 2px solid var(--ott-color-border-focus);
  outline-offset: 2px;
}

.ott-card--loading {
  pointer-events: none;
}

.ott-card--error {
  border-left: 4px solid var(--ott-color-status-error);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .ott-btn,
  .ott-card,
  .ott-search-btn {
    transition: none;
  }

  .ott-card:hover {
    transform: none;
  }

  .ott-btn--loading::after {
    animation: none;
  }
}
