/**
 * Lapwing Book Club — Modern Theme
 * Mobile-first, Rich & Editorial design system.
 * Replaces: app-theme.css, wise-theme.css, responsive.css, new-nav.css,
 *           custom.css, recommendations.css
 */

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Brand */
  --color-brand:       #9a1f40;
  --color-brand-dark:  #7a1930;
  --color-brand-light: #b5294f;
  --color-accent:      #c4788a;

  /* Surfaces */
  --color-bg:       #faf8f5;   /* warm off-white page */
  --color-surface:  #ffffff;   /* cards, modals */
  --color-surface-2:#f5f0e8;   /* subtle alt surface */

  /* Borders */
  --color-border:   #e4dbd0;
  --color-border-light: #ede8e0;

  /* Text */
  --color-text:     #1a1a1a;
  --color-heading:  #111111;
  --color-muted:    #6b7280;
  --color-muted-2:  #9ca3af;

  /* Feedback */
  --color-success:  #16a34a;
  --color-warning:  #d97706;
  --color-danger:   #dc2626;
  --color-info:     #2563eb;

  /* Radius */
  --radius-sm:   8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);

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

  /* Touch targets */
  --touch-min: 44px;
}

/* ─── Base Reset & Typography ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--color-heading);
  line-height: 1.25;
  font-weight: 700;
  margin-top: 0;
}

h1 { font-size: clamp(1.6rem, 5vw, 2.25rem); }
h2 { font-size: clamp(1.3rem, 4vw, 1.75rem); }
h3 { font-size: clamp(1.1rem, 3vw, 1.35rem); }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--color-brand-dark); text-decoration: underline; }

p { margin-top: 0; margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

/* ─── Section Labels (replaces cream card-header h3s) ───────────── */
.section-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.section-label i { font-size: 0.8rem; }

/* ─── Layout ────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: var(--space-lg) 0 calc(var(--space-2xl) + 60px);  /* bottom pad for mobile nav */
}

/* Desktop: no bottom nav padding needed */
@media (min-width: 768px) {
  .main-content { padding-bottom: var(--space-2xl); }
}

.page-header {
  margin-bottom: var(--space-lg);
}
.page-header h1 { margin-bottom: 0.25rem; }
.page-header .lead {
  color: var(--color-muted);
  font-size: 1rem;
  margin-bottom: 0;
}

/* ─── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-md);
  overflow: hidden;
}

/* Remove old cream card-header style */
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--color-border-light);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5 {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin: 0;
}

/* When a card-header has a dark background (inline style), force all text white */
.card-header[style*="background"] h2,
.card-header[style*="background"] h3,
.card-header[style*="background"] h4,
.card-header[style*="background"] h5,
.card-header[style*="background"] { color: #fff !important; }

.card-body { padding: var(--space-md); }
.card-footer {
  background: transparent;
  border-top: 1px solid var(--color-border-light);
  padding: var(--space-sm) var(--space-md);
}

/* Spine-coloured left border — flagship dynamic feature */
.card-spine {
  border-left: 4px solid var(--spine-color, var(--color-accent));
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-brand {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}
.btn-brand:hover {
  background: var(--color-brand-dark);
  border-color: var(--color-brand-dark);
  color: #fff;
  text-decoration: none;
}

.btn-brand-outline {
  background: transparent;
  color: var(--color-brand);
  border-color: var(--color-brand);
}
.btn-brand-outline:hover {
  background: var(--color-brand);
  color: #fff;
  text-decoration: none;
}

.btn-brand-sm, .btn-sm {
  min-height: var(--touch-min);
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  border-radius: var(--radius-pill);
}

.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
  text-decoration: none;
}

/* Keep Bootstrap utility button classes working */
.btn-primary { @extend .btn-brand; }
.btn-outline-primary { @extend .btn-brand-outline; }

/* Override Bootstrap button radius globally */
.btn-primary,
.btn-outline-primary,
.btn-secondary,
.btn-outline-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info {
  border-radius: var(--radius-pill) !important;
  min-height: var(--touch-min);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

/* ─── Badges ────────────────────────────────────────────────────── */
.badge {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.3em 0.7em;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
}

.badge-brand {
  background: var(--color-brand);
  color: #fff;
}
.badge-accent {
  background: var(--color-accent);
  color: #fff;
}
.badge-muted {
  background: var(--color-surface-2);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

/* ─── Forms ─────────────────────────────────────────────────────── */
.form-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.form-control, .form-select {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  min-height: var(--touch-min);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(154, 31, 64, 0.12);
  outline: none;
}

/* ─── Alerts ────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.9rem;
  padding: var(--space-md);
}
.alert-info    { background: #eff6ff; color: #1e40af; }
.alert-success { background: #f0fdf4; color: #15803d; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-danger  { background: #fef2f2; color: #991b1b; }

/* ─── Modals ────────────────────────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--color-border-light);
  padding: var(--space-md) var(--space-lg);
}
.modal-header .modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
}
.modal-body { padding: var(--space-lg); }
.modal-footer {
  border-top: 1px solid var(--color-border-light);
  padding: var(--space-sm) var(--space-lg);
}

/* ─── Tables ────────────────────────────────────────────────────── */
.table {
  font-size: 0.9rem;
}
.table th {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-muted);
  border-bottom: 2px solid var(--color-border);
  padding: 0.65rem var(--space-md);
}
.table td {
  padding: 0.75rem var(--space-md);
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border-light);
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: var(--color-surface-2); }

/* ─── Divider ───────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-muted);
  font-size: 0.85rem;
  margin: var(--space-lg) 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ─── Spinner ───────────────────────────────────────────────────── */
.spinner-border { color: var(--color-brand); }

/* ─── Footer ────────────────────────────────────────────────────── */
footer {
  background: var(--color-brand);
  color: rgba(255,255,255,0.9);
  padding: var(--space-lg) 0;
  margin-top: auto;
  font-size: 0.85rem;
  /* Hidden on mobile — bottom nav covers this role */
  display: none;
}
@media (min-width: 768px) {
  footer { display: block; }
}
footer a {
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}
footer a:hover { color: #fff; text-decoration: none; }

/* ─── Utility ───────────────────────────────────────────────────── */
.text-brand { color: var(--color-brand); }
.text-muted  { color: var(--color-muted) !important; }
.bg-brand    { background: var(--color-brand); color: #fff; }
.bg-surface  { background: var(--color-surface); }
.bg-page     { background: var(--color-bg); }

/* Ensure all interactive elements meet touch target size */
button, [role="button"], .btn, a.btn, input[type="submit"] {
  min-height: var(--touch-min);
}
