/* ═══════════════════════════════════════════════════════════════
   Yab Academy — Styles partagés
   ═══════════════════════════════════════════════════════════════ */

:root {
  --accent: #1e4fa0;
  --accent-dark: #163d80;
  --ink: #0d1117;
  --ink-soft: #444;
  --paper: #f5f0e8;
  --white: #ffffff;
  --green: #1a6b3c;
  --red: #b91c1c;
  --gold: #c9940a;
  --gray-100: #f7f7f7;
  --gray-200: #eee;
  --gray-300: #ddd;
  --gray-500: #888;
  --gray-700: #555;
  --shadow-sm: 0 2px 8px rgba(13, 17, 23, 0.06);
  --shadow-md: 0 4px 24px rgba(13, 17, 23, 0.08);
  --shadow-lg: 0 8px 40px rgba(13, 17, 23, 0.12);
  --radius: 8px;
  --radius-sm: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

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

/* ─── Layout principal ────────────────────────────────────── */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 24px;
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-size: 1.2rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--ink); }

.nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav a {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav a:hover {
  color: var(--accent);
  text-decoration: none;
}
.nav a.active { color: var(--accent); }

.main {
  flex: 1;
  padding: 40px 24px;
}

.main-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.main-inner.narrow {
  max-width: 560px;
}

.footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 24px;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.85rem;
}

.footer a {
  color: var(--gray-700);
  margin: 0 8px;
}

/* ─── Cards ──────────────────────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.card-narrow {
  max-width: 480px;
  margin: 40px auto;
}

.card h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
}

.card .subtitle {
  color: var(--gray-700);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

/* ─── Formulaires ────────────────────────────────────────── */

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ─── Boutons ────────────────────────────────────────────── */

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
}

.btn:hover {
  opacity: 0.9;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--ink);
  border: 1px solid var(--gray-300);
}

.btn-danger { background: var(--red); }

.btn-large { padding: 16px 32px; font-size: 1rem; }

/* ─── Messages ───────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin: 12px 0;
}

.alert-error {
  color: var(--red);
  background: rgba(185, 28, 28, 0.08);
  border-left: 3px solid var(--red);
}

.alert-success {
  color: var(--green);
  background: rgba(26, 107, 60, 0.08);
  border-left: 3px solid var(--green);
}

.alert-info {
  color: var(--accent);
  background: rgba(30, 79, 160, 0.08);
  border-left: 3px solid var(--accent);
}

.alert-warning {
  color: var(--gold);
  background: rgba(201, 148, 10, 0.08);
  border-left: 3px solid var(--gold);
}

/* ─── Liens auth (sous form) ────────────────────────────── */

.auth-links {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: 0.85rem;
  color: var(--gray-700);
}

.auth-links a {
  font-weight: 500;
  margin: 0 8px;
}

.auth-links .sep {
  color: var(--gray-300);
}

/* ─── Catalogue (grille modules) ─────────────────────────── */

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.module-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.module-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.module-card .module-desc {
  color: var(--ink-soft);
  font-size: 0.9rem;
  flex: 1;
  margin-bottom: 16px;
}

.module-card .module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.module-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.module-price-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Dashboard purchases ────────────────────────────────── */

.purchases-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.purchase-row {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.purchase-info { flex: 1; }
.purchase-info h3 { margin: 0 0 4px; font-size: 1rem; }
.purchase-info .meta {
  color: var(--gray-500);
  font-size: 0.8rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.purchase-actions {
  display: flex;
  gap: 8px;
}

/* ─── Status badges ──────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success { background: rgba(26, 107, 60, 0.12); color: var(--green); }
.badge-warn { background: rgba(201, 148, 10, 0.12); color: var(--gold); }
.badge-danger { background: rgba(185, 28, 28, 0.12); color: var(--red); }
.badge-info { background: rgba(30, 79, 160, 0.12); color: var(--accent); }

/* ─── Loading ───────────────────────────────────────────── */

.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-500);
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
  .header-inner { flex-direction: column; gap: 12px; }
  .nav { flex-wrap: wrap; gap: 12px; }
  .catalog-grid { grid-template-columns: 1fr; }
  .purchase-row { flex-direction: column; align-items: stretch; }
  .card { padding: 24px; }
}

/* ─── Print ─────────────────────────────────────────────── */

@media print {
  .header, .footer, .nav { display: none; }
  body { background: white; }
}
