/* ==========================================================
   PAGE TURNERS v2 — COMPLETE POLISH OVERRIDES

   New palette derived from the illustrated logo:
   - Deep teal (book cover)
   - Warm ivory (pages)
   - Soft periwinkle (martini glass)
   - Cherry red (garnish + nails)
   ========================================================== */


/* ==========================================================
   NEW COLOR PALETTE
   Replaces beige/terracotta with a more refined palette
   ========================================================== */
:root {
  /* Core palette — derived from logo */
  --bone: #FAF8F3;
  --paper: #FFFFFF;
  --ink: #1B2B2A;
  --terracotta: #1B4332;          /* deep teal replaces terracotta as primary */
  --terracotta-light: #E3EDE8;    /* teal tint */
  --midgray: #6B7C78;
  --warmgray: #D6DDD9;

  /* New accent tokens */
  --teal: #1B4332;
  --teal-light: #E3EDE8;
  --periwinkle: #9BB5D0;
  --periwinkle-light: #E8EFF6;
  --cherry: #8B3A3A;
  --cherry-light: #F2E4E4;
  --ivory: #FAF8F3;

  /* Override existing semantic tokens */
  --background: var(--ivory);
  --foreground: var(--ink);
  --card: var(--paper);
  --card-foreground: var(--ink);
  --primary: var(--teal);
  --primary-foreground: #FAFAF8;
  --accent: var(--teal-light);
  --accent-foreground: var(--teal);
  --ring: var(--teal);
  --border: var(--warmgray);
  --input: #CDD5D1;
  --muted: #F0F3F1;
  --muted-foreground: var(--midgray);

  /* Charts */
  --chart-1: var(--teal);
  --chart-2: var(--periwinkle);
  --chart-3: var(--cherry);

  /* Contrast-safe text variants */
  --teal-text: #153829;
  --midgray-text: #556B66;

  /* Elevation */
  --shadow-subtle:
    0 1px 3px rgba(27, 43, 42, 0.06),
    0 1px 2px rgba(27, 43, 42, 0.04);
  --shadow-medium:
    0 4px 12px rgba(27, 43, 42, 0.08),
    0 2px 4px rgba(27, 43, 42, 0.04);
  --shadow-hover:
    0 8px 24px rgba(27, 43, 42, 0.12),
    0 2px 8px rgba(27, 43, 42, 0.06);

  /* Type scale */
  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
}


/* ==========================================================
   FORCE UNIFIED THEME — No dark pages
   Wrapped page and Book Recs page use the same light theme
   ========================================================== */

/* Wrapped page: override dark background */
[data-loc*="ReadingWrapped"] .min-h-screen,
[data-loc*="Wrapped"] .min-h-screen,
div[style*="background: var(--ink)"][class*="min-h-screen"],
div[style*='background:"var(--ink)"'][class*="min-h-screen"] {
  background: var(--ivory) !important;
}

/* Wrapped page: fix text colors that were designed for dark bg */
[data-loc*="Wrapped"] [style*="color: var(--bone)"],
[data-loc*="Wrapped"] [style*="color:var(--bone)"] {
  color: var(--ink) !important;
}

[data-loc*="Wrapped"] [style*="rgba(240,235,224"] {
  color: var(--midgray) !important;
}

[data-loc*="Wrapped"] [style*="rgba(255,255,255"] {
  border-color: var(--warmgray) !important;
}

/* Wrapped page stat cards — force light treatment */
[data-loc*="Wrapped"] [style*="background: var(--terracotta)"],
[data-loc*="Wrapped"] [style*="background:var(--terracotta)"] {
  background: var(--teal-light) !important;
  color: var(--ink) !important;
}

/* Wrapped page: Book of the Year card */
[data-loc*="Wrapped"] [style*="background: var(--ink)"][style*="padding"],
[data-loc*="Wrapped"] div[style*="background: rgba(240,235,224"] {
  background: var(--teal-light) !important;
}

[data-loc*="Wrapped"] [style*="background: var(--ink)"] [style*="color: var(--bone)"],
[data-loc*="Wrapped"] [style*="background: var(--ink)"] .label-caps {
  color: var(--ink) !important;
}

/* Book Recs page: override dark background — multiple selectors for specificity */
[data-loc*="BookRecs"].min-h-screen,
[data-loc*="BookRecs"] .min-h-screen,
[data-loc*="BookRecs.tsx:265"],
div[data-loc*="BookRecs"][style*="background"],
.min-h-screen[style*="background: var(--ink"],
.min-h-screen[style*="background:var(--ink"],
.min-h-screen[style*="#1a1714"],
div[style*="ink, #1a1714"] {
  background: var(--ivory) !important;
}

[data-loc*="BookRecs"] [style*="color: var(--bone)"],
[data-loc*="BookRecs"] [style*="color:var(--bone)"] {
  color: var(--ink) !important;
}

[data-loc*="BookRecs"] [style*="rgba(240,235,224"] {
  color: var(--ink) !important;
}

/* Recs page: ALL text must be dark/readable */
[data-loc*="BookRecs"] p,
[data-loc*="BookRecs"] span,
[data-loc*="BookRecs"] div,
[data-loc*="BookRecs"] .leading-relaxed,
[data-loc*="BookRecs"] [class*="text-sm"],
[data-loc="client/src/pages/BookRecs.tsx:292"] {
  color: var(--ink) !important;
}

/* Recs page week label */
[data-loc*="BookRecs"] .label-caps {
  color: var(--teal-text) !important;
}

/* Nuclear: override any rgba cream text anywhere on the recs page */
.min-h-screen [style*="rgba(240,235,224"] {
  color: var(--ink) !important;
}

/* Direct target: the recs page description paragraph */
[data-loc="client/src/pages/BookRecs.tsx:292"] {
  color: #1B2B2A !important;
}

/* Catch-all: ANY element with an rgba(240...) inline color */
[style*="color: rgba(240"] {
  color: #1B2B2A !important;
}
[style*="color:rgba(240"] {
  color: #1B2B2A !important;
}

[data-loc*="BookRecs"] [style*="border: 1px solid rgba(240,235,224"] {
  border-color: var(--warmgray) !important;
}

/* Rec cards: light theme treatment */
[data-loc*="BookRecs"] article[style*="background: var(--paper"] {
  background: var(--paper) !important;
  border-color: var(--warmgray) !important;
  box-shadow: var(--shadow-subtle);
}

[data-loc*="BookRecs"] [style*="background: var(--ink, #1a1714)"] {
  background: var(--teal) !important;
}

[data-loc*="BookRecs"] [style*="color: var(--terracotta, #c4622d)"] {
  color: var(--teal) !important;
}

/* Rec page header text */
[data-loc*="BookRecs"] .font-display[style*="color: var(--bone)"] {
  color: var(--ink) !important;
}

[data-loc*="BookRecs"] .label-caps[style*="color: rgba(240"] {
  color: var(--midgray) !important;
}


/* ==========================================================
   HIDE ADMIN / MANAGE FROM NAV
   ========================================================== */

/* Hide "Manage" nav button */
nav button[class*="label-caps"]:last-child,
button[onclick*="admin"],
a[href="/admin"],
a[href*="admin"] {
  display: none !important;
}

/* Target by text content — hide nav items containing "Manage" */
/* This uses the nav structure: buttons inside a flex container */
header nav button:nth-last-child(1) {
  display: none !important;
}

/* Hide the admin route entirely if someone navigates directly */
[data-loc*="AdminBooks"],
[data-loc*="AdminGate"],
[data-loc*="ClubSettings"] {
  display: none !important;
}

/* Also hide the WhatsApp nav button if present */
[title="Open WhatsApp group"] {
  display: none !important;
}


/* ==========================================================
   HIDE NOTES + RATING TREND FROM STATS PAGE
   ========================================================== */

/* Stats page sections are numbered: 01 Overview, 02 Top Rated, 03 Notes, 04 Rating Trend, 05 By Year */
/* We want to keep 01 Overview and 02 Top Rated, hide 03 and 04 */

/* Hide "Notes" section (03) — target the section header and content */
[data-loc*="Dashboard"] [style*="border-bottom"]:has(+ [class*="font-display"]:is(:empty, :not(:empty))) ~ div:has(.recharts-bar-rectangles) {
  display: none !important;
}

/* Hide sections by their section number labels */
/* Notes section */
div:has(> [class*="label-caps"]:first-child) + div:has(.recharts-bar-rectangles),
div:has(> span:first-child[class*="terracotta"]) {
  /* Can't reliably hide by CSS alone without seeing DOM — using JS below */
}


/* ==========================================================
   STAT CARD FIX — Uniform backgrounds
   ========================================================== */

/* Stat overview cards — prominent, uniform, readable */
[data-loc*="Dashboard"] .p-6[style*="background: var(--terracotta)"],
[data-loc*="Dashboard"] [style*="background: var(--terracotta)"][style*="padding"] {
  background: var(--teal-light) !important;
  color: var(--ink) !important;
}

/* Stat overview cards need to NOT trigger the global teal-bg-light-text rule.
   Override back to ink for the teal-light background cards. */
[data-loc*="Dashboard"] .p-6[style*="background: var(--terracotta)"] *,
[data-loc*="Dashboard"] [style*="background: var(--terracotta)"][style*="padding"] * {
  color: var(--ink) !important;
}

[data-loc*="Dashboard"] .p-6[style*="background: var(--terracotta)"] .label-caps,
[data-loc*="Dashboard"] [style*="background: var(--terracotta)"][style*="padding"] .label-caps {
  color: var(--teal-text) !important;
}

/* All stat cards: visible with border + shadow */
[data-loc*="Dashboard"] .p-6,
[data-loc*="Dashboard"] [style*="border: 1px solid var(--warmgray)"][style*="padding"] {
  background: var(--paper) !important;
  border: 1px solid var(--warmgray) !important;
  box-shadow: var(--shadow-subtle);
}

/* Stat card numbers: make them pop */
[data-loc*="Dashboard"] .font-display.font-bold {
  color: var(--ink) !important;
}


/* ==========================================================
   TRANSITIONS + HOVER STATES
   ========================================================== */

a,
button,
[role="button"],
input,
textarea,
select {
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 200ms ease,
    transform 200ms ease,
    opacity 150ms ease;
}

.book-spread {
  transition: transform 200ms ease, box-shadow 200ms ease;
}

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

.archive-book-card {
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.archive-book-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

nav button,
nav a {
  transition: color 150ms ease, opacity 150ms ease;
}

button:active,
[role="button"]:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* ==========================================================
   ELEVATION — Replace flat borders with shadows
   ========================================================== */

div[style*="border: 1px solid var(--warmgray)"][style*="background: var(--paper)"] {
  border: none !important;
  box-shadow: var(--shadow-subtle);
}

div[style*="background: var(--paper)"]:hover {
  box-shadow: var(--shadow-medium);
}


/* ==========================================================
   TYPOGRAPHY + CONTRAST
   ========================================================== */

body {
  font-size: var(--text-base);
  line-height: 1.6;
}

.label-caps {
  font-size: var(--text-xs) !important;
  letter-spacing: 0.12em;
  line-height: 1.4;
  color: var(--teal-text) !important;
}

/* GLOBAL: Any element with a teal/terracotta background gets light text.
   This covers year toggles, rating buttons, action buttons, badges, etc.
   The selector must beat the .label-caps rule above (which sets teal-text). */
[style*="background: var(--terracotta)"],
[style*="background:var(--terracotta)"],
button[style*="background: var(--terracotta)"],
[style*="background: var(--terracotta)"].label-caps,
button.label-caps[style*="background: var(--terracotta)"],
button.label-caps[style*="background:var(--terracotta)"] {
  color: var(--ivory) !important;
}

[style*="background: var(--terracotta)"] *,
[style*="background:var(--terracotta)"] * {
  color: var(--ivory) !important;
}

[style*="background: var(--terracotta)"] svg,
[style*="background:var(--terracotta)"] svg {
  color: var(--ivory) !important;
  stroke: var(--ivory) !important;
}

/* Also catch inline color:white that our overrides might clobber */
[style*="background: var(--terracotta)"][style*="color: white"],
[style*="background: var(--terracotta)"][style*="color:white"] {
  color: var(--ivory) !important;
}

/* HIGHEST SPECIFICITY: .label-caps on teal bg buttons — must beat the
   .label-caps { color: var(--teal-text) } rule above */
button.label-caps[style*="background: var(--terracotta)"],
button.label-caps[style*="background:var(--terracotta)"],
a.label-caps[style*="background: var(--terracotta)"],
[data-loc*="BookDetail"] button.label-caps[style*="background"],
[data-loc*="BookDetail"] .label-caps[style*="background: var(--terracotta)"] {
  color: var(--ivory) !important;
}

/* Enter Member Ratings — target by data-loc directly */
[data-loc*="BookDetail.tsx:542"],
[data-loc*="BookDetail.tsx:551"] {
  color: var(--ivory) !important;
}

[data-loc*="BookDetail.tsx:542"] * {
  color: var(--ivory) !important;
}

.font-display {
  letter-spacing: -0.025em;
}

p,
.leading-relaxed {
  line-height: 1.65;
}

/* Normalize drifting small font sizes */
[style*='fontSize:"0.55rem"'],
[style*='fontSize:"0.6rem"'],
[style*='fontSize:"0.65rem"'] {
  font-size: var(--text-xs) !important;
}

[style*='fontSize:"0.7rem"'],
[style*='fontSize:"0.75rem"'],
[style*='fontSize:"0.8rem"'] {
  font-size: var(--text-sm) !important;
}


/* ==========================================================
   MEETING BADGE — Update color
   ========================================================== */

/* The "2d UNTIL MEETING" pill in the nav */
[style*="background: var(--terracotta)"][style*="border-radius: 999px"],
[style*="borderRadius:\"999px\""][style*="background: var(--terracotta)"],
[style*="borderRadius:\"999px\""] {
  background: var(--teal) !important;
}


/* ==========================================================
   MISC REFINEMENTS
   ========================================================== */

/* Selection color */
::selection {
  background: var(--teal-light);
  color: var(--ink);
}

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

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

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

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

/* Star ratings — teal instead of terracotta */
.star-rating span[style*="var(--terracotta)"] {
  color: var(--teal) !important;
  background: var(--teal) !important;
}

/* Genre tags — refined */
[style*="background: var(--terracotta-light)"] {
  background: var(--teal-light) !important;
  color: var(--teal-text) !important;
}

/* Buttons with teal background need white text */
[style*="background: var(--terracotta)"][style*="border-radius"],
[style*="background:var(--terracotta)"][style*="border-radius"],
button[style*="background: var(--terracotta)"],
button[style*="background:var(--terracotta)"] {
  color: #FAFAF8 !important;
}

/* "Enter Member Ratings" and similar action buttons */
button .label-caps[style*="color: var(--terracotta)"],
button .label-caps[style*="color:var(--terracotta)"],
a .label-caps[style*="color: var(--terracotta)"],
[data-loc*="BookDetail"] button .label-caps {
  color: #FAFAF8 !important;
}


/* Logo is injected via JS in index.html — no CSS ::before needed */

/* Hide "Hottest book club" subtitle from homepage nav */
[data-loc*="Home.tsx:151"] {
  display: none !important;
}

/* Hide Tags section entirely */
[data-loc="client/src/pages/BookDetail.tsx:594"] {
  display: none !important;
}

/* Hide Generate Discussion Questions button wrapper */
[data-loc="client/src/pages/BookDetail.tsx:743"] {
  display: none !important;
}
/* Broader catch: any label-caps directly after the site title */
h1.font-display + .label-caps,
[data-loc*="Home.tsx:145"] ~ .label-caps {
  display: none !important;
}


/* ==========================================================
   RECS PAGE — No admin gate
   ========================================================== */

/* Hide the admin password input on recs page */
[data-loc*="BookRecs"] input[type="password"],
[data-loc*="BookRecs"] [placeholder*="Admin password"],
[data-loc*="BookRecs"] [placeholder*="admin password"] {
  display: none !important;
}

/* Hide the "Admins: use refresh recs" hint text */
[data-loc*="BookRecs"] [class*="label-caps"][style*="rgba(240,235,224,0.5)"] {
  display: none !important;
}

/* Hide the "An admin can generate" empty state text */
[data-loc*="BookRecs.tsx:331"],
[data-loc*="BookRecs.tsx:335"],
[data-loc*="BookRecs.tsx:344"] {
  display: none !important;
}


/* ==========================================================
   FIX 1: BRANDED LOADING + EMPTY STATES
   ========================================================== */

/* --- Loading spinner: book page turning animation --- */
@keyframes page-turn {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(-180deg); }
  100% { transform: rotateY(-360deg); }
}

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

/* Override the default spin animation on loading indicators */
.animate-spin {
  animation: none !important;
  border: none !important;
  width: 32px !important;
  height: 40px !important;
  background: var(--teal) !important;
  border-radius: 2px 6px 6px 2px !important;
  position: relative !important;
  animation: page-turn 1.2s ease-in-out infinite !important;
  transform-style: preserve-3d;
}

.animate-spin::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 50%;
  height: 100%;
  background: var(--teal-light);
  border-radius: 2px 0 0 2px;
}

/* "Loading…" text — add animated dots feel */
.label-caps:only-child {
  /* Let the text stay as-is, it's fine */
}

/* --- Empty state: "NO TAGS YET" --- */
/* Warm up the tags empty state */
[data-loc*="BookDetail"] [style*="NO TAGS"],
div:empty + [class*="label-caps"] {
  /* Handled via JS below */
}

/* --- Empty state styling for notes "0 notes" --- */
/* Style via JS mutation observer in index.html */


/* ==========================================================
   FIX 2: LIST ROW HOVER + FOCUS RINGS
   ========================================================== */

/* --- Custom focus rings for all interactive elements --- */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--teal) !important;
  outline-offset: 2px !important;
  border-radius: 2px;
}

/* --- List row hover states --- */
/* Top Rated Books, By Year rankings, Admin book list */
/* These are divs with border + padding containing book info */
div[style*="border: 1px solid var(--warmgray)"][style*="padding"]:not([style*="background: var(--paper)"]) {
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

div[style*="border: 1px solid var(--warmgray)"][style*="padding"]:not([style*="background: var(--paper)"]):hover {
  background-color: var(--teal-light) !important;
}

/* Broader list row targeting — rows inside containers on stats/wrapped pages */
[data-loc*="Dashboard"] div[style*="border: 1px solid"][style*="flex"] {
  transition: background-color 150ms ease;
}

[data-loc*="Dashboard"] div[style*="border: 1px solid"][style*="flex"]:hover {
  background-color: var(--teal-light) !important;
}

[data-loc*="Wrapped"] div[style*="border: 1px solid"][style*="flex"] {
  transition: background-color 150ms ease;
}

[data-loc*="Wrapped"] div[style*="border: 1px solid"][style*="flex"]:hover {
  background-color: var(--teal-light) !important;
}

/* Stat cards — hover elevation */
[data-loc*="Dashboard"] .p-6,
[data-loc*="Dashboard"] [style*="padding"][style*="border-radius"] {
  transition: transform 200ms ease, box-shadow 200ms ease;
}

[data-loc*="Dashboard"] .p-6:hover,
[data-loc*="Dashboard"] [style*="padding"][style*="border-radius"]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* "Generate Discussion Questions" button — visible hover */
[data-loc*="BookDetail"] button[style*="border: 1px solid"],
button[class*="label-caps"][style*="border"] {
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

[data-loc*="BookDetail"] button[style*="border: 1px solid"]:hover,
button[class*="label-caps"][style*="border"]:hover {
  background-color: var(--teal) !important;
  color: var(--primary-foreground) !important;
  transform: translateY(-1px);
}

/* Rec cards — hover lift */
[data-loc*="BookRecs"] article {
  transition: transform 200ms ease, box-shadow 200ms ease;
}

[data-loc*="BookRecs"] article:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}


/* ==========================================================
   FIX 3: SPACING SCALE + SECTION RHYTHM
   ========================================================== */

:root {
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
}

/* Stats page: increase section spacing */
[data-loc*="Dashboard"] .container {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

/* Stats page: space between sections (Overview → Top Rated → By Year) */
[data-loc*="Dashboard"] .container > div > div {
  margin-bottom: var(--space-2xl);
}

/* Stat cards: more generous internal padding */
[data-loc*="Dashboard"] .p-6 {
  padding: var(--space-lg) var(--space-xl) !important;
}

/* Book detail page: breathe between sections */
[data-loc*="BookDetail"] .container {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-3xl);
}

/* Tags section spacing */
[data-loc*="BookDetail"] [style*="TAGS"],
[data-loc*="BookDetail"] div:has(> .label-caps) {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
}

/* Notes section spacing */
[data-loc*="BookDetail"] [style*="MEMBER NOTES"],
[data-loc*="BookDetail"] div:has(> [class*="label-caps"]):last-of-type {
  margin-top: var(--space-2xl);
}

/* Wrapped page: section breathing */
[data-loc*="Wrapped"] .container {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

/* Recs page: card grid gap */
[data-loc*="BookRecs"] .grid {
  gap: var(--space-lg) !important;
}

/* Homepage: breathing below the hero "Currently Reading" card */
.book-spread {
  margin-bottom: var(--space-md);
}

/* Persistent nav items: consistent spacing */
#persistent-nav nav a {
  padding: var(--space-sm) 0;
}


/* ==========================================================
   FIX 4: FULL CARD ELEVATION PASS
   ========================================================== */

/* Currently Reading hero card — strongest shadow */
[data-loc*="Home.tsx"] div[style*="border: 1px solid var(--warmgray)"][style*="border-radius"] {
  border: none !important;
  box-shadow:
    0 4px 16px rgba(27, 43, 42, 0.08),
    0 2px 6px rgba(27, 43, 42, 0.05) !important;
}

[data-loc*="Home.tsx"] div[style*="border: 1px solid var(--warmgray)"][style*="border-radius"]:hover {
  box-shadow:
    0 8px 28px rgba(27, 43, 42, 0.12),
    0 4px 10px rgba(27, 43, 42, 0.06) !important;
}

/* Book detail: main card */
[data-loc*="BookDetail"] > div > div[style*="border: 1px solid"] {
  border: none !important;
  box-shadow: var(--shadow-subtle);
}

/* Stat cards — explicit targeting */
[data-loc*="Dashboard.tsx:21"] {
  border: none !important;
  box-shadow: var(--shadow-subtle);
}

/* Wrapped stat cards */
[data-loc*="Wrapped"] [style*="border: 1px solid"][style*="padding"] {
  border: none !important;
  box-shadow: var(--shadow-subtle);
}

/* Wrapped Book of the Year card */
[data-loc*="Wrapped"] [style*="border-radius"][style*="padding"][style*="background"] {
  box-shadow: var(--shadow-medium);
}

/* Rec cards — shadow instead of border */
[data-loc*="BookRecs"] article[style*="border: 1px solid"] {
  border: none !important;
  box-shadow: var(--shadow-subtle);
}

/* Book detail: notes form area */
[data-loc*="BookDetail"] input[style*="border"],
[data-loc*="BookDetail"] textarea[style*="border"] {
  border-color: var(--warmgray) !important;
  box-shadow: inset 0 1px 3px rgba(27, 43, 42, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

[data-loc*="BookDetail"] input[style*="border"]:focus,
[data-loc*="BookDetail"] textarea[style*="border"]:focus {
  border-color: var(--teal) !important;
  box-shadow: inset 0 1px 3px rgba(27, 43, 42, 0.04), 0 0 0 3px rgba(27, 67, 50, 0.1);
}

/* Generic: any remaining bordered card that looks like a content container */
div[style*="border: 1px solid var(--warmgray)"][style*="border-radius: 2px"] {
  border: none !important;
  box-shadow: var(--shadow-subtle);
}

/* All cards: smooth hover transition */
div[style*="border-radius: 2px"] {
  transition: box-shadow 200ms ease, transform 200ms ease;
}
/* ==========================================================
   BOOK DETAIL — Layout refinement
   ========================================================== */

/* More breathing room between the main card and sections below */
[data-loc*="BookDetail"] .container > div {
  margin-bottom: 32px;
}

/* Synopsis text: more readable */
[data-loc*="BookDetail"] .drop-cap {
  font-size: 1rem !important;
  line-height: 1.7 !important;
  color: var(--ink);
}

/* Synopsis drop cap: larger, teal */
[data-loc*="BookDetail"] .drop-cap::first-letter {
  font-size: 3.5rem !important;
  color: var(--teal) !important;
  float: left;
  line-height: 0.8;
  margin-right: 8px;
  margin-top: 4px;
}

/* Book cover in detail: slightly larger with shadow */
[data-loc*="BookDetail"] img[src*="covers"] {
  box-shadow: 0 4px 16px rgba(27, 43, 42, 0.15);
  border-radius: 2px;
}

/* Tags section: better spacing */
[data-loc*="BookDetail"] [style*="TAGS"],
[data-loc*="BookDetail"] hr {
  margin-top: 24px;
}

/* Metadata labels (GENRE, PAGES, READ) — clearer hierarchy */
[data-loc*="BookDetail"] .label-caps.block {
  margin-bottom: 4px;
}


/* ==========================================================
   HOMEPAGE HERO — Polish
   ========================================================== */

/* Currently Reading hero card: stronger presence */
[data-loc*="Home.tsx"] .book-spread:first-of-type {
  box-shadow:
    0 6px 20px rgba(27, 43, 42, 0.1),
    0 2px 6px rgba(27, 43, 42, 0.05) !important;
  padding: 2rem !important;
}

/* Hero book cover: shadow and presence */
[data-loc*="Home.tsx"] .book-spread img {
  box-shadow: 0 4px 16px rgba(27, 43, 42, 0.15);
  border-radius: 2px;
}

/* "Currently Reading" label: more prominent */
[data-loc*="Home.tsx:64"] {
  font-size: 0.75rem !important;
  font-weight: 600;
}

/* Hero book title: generous sizing */
[data-loc*="Home.tsx"] .book-spread .font-display {
  line-height: 1.1;
}

/* Genre tag + page count at bottom of hero: better spacing */
[data-loc*="Home.tsx"] .book-spread [style*="borderRadius"] {
  margin-top: 16px;
}

/* "The Shelf" heading: more presence */
[data-loc*="Home.tsx"] h2.font-display {
  margin-top: 40px;
  margin-bottom: 16px;
}


/* ==========================================================
   REC CARDS — Cover image integration
   ========================================================== */

/* Rec card articles: ensure good padding for cover layout */
[data-loc*="BookRecs"] article {
  overflow: hidden;
}

/* Cover images injected via JS */
.rec-cover-img {
  transition: transform 200ms ease;
}

article:hover .rec-cover-img {
  transform: scale(1.03);
}


/* ==========================================================
   MOBILE RESPONSIVE
   ========================================================== */

/* Nav: tighten on small screens */
@media (max-width: 640px) {
  #persistent-nav {
    height: 48px !important;
  }

  #persistent-nav .ptnav-inner {
    padding: 0 12px !important;
    gap: 8px !important;
  }

  #persistent-nav .ptnav-title {
    font-size: 0.95rem !important;
  }

  #persistent-nav nav {
    gap: 0.5rem !important;
  }

  #persistent-nav nav a {
    font-size: 0.5625rem !important;
    letter-spacing: 0.08em !important;
  }

  #persistent-nav img {
    width: 24px !important;
    height: 24px !important;
  }

  /* Content containers: less padding */
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Book cover images: constrain on mobile */
  .book-spread img,
  .archive-book-card img {
    max-width: 100%;
    height: auto;
  }

  /* Stat cards: stack vertically */
  [data-loc*="Dashboard"] .grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Rec cards: single column */
  [data-loc*="BookRecs"] .grid {
    grid-template-columns: 1fr !important;
  }

  /* Member picks: single column */
  #mp-list {
    grid-template-columns: 1fr !important;
  }

  /* Member picks form: stack fields */
  #mp-form-wrapper > div:first-child,
  #mp-form-wrapper > div:nth-child(2) {
    grid-template-columns: 1fr !important;
  }

  /* Discussion questions slider: stack label and slider */
  #dq-section > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  /* Book detail: reduce padding */
  .p-8 { padding: 1rem !important; }
  .md\:p-14 { padding: 1rem !important; }

  /* Hero book card: reduce internal spacing */
  [data-loc*="Home"] .book-spread {
    padding: 1rem !important;
  }

  /* Typography: slightly smaller headings */
  .font-display {
    font-size: clamp(1.25rem, 4vw, 2rem) !important;
  }

  /* Images in book detail: constrain width */
  [data-loc*="BookDetail"] img {
    max-width: 120px;
    height: auto;
  }
}

/* Tablet tweaks */
@media (min-width: 641px) and (max-width: 1024px) {
  #persistent-nav .ptnav-inner {
    padding: 0 1.5rem !important;
  }

  #persistent-nav nav {
    gap: 1.25rem !important;
  }

  #persistent-nav nav a {
    font-size: 0.625rem !important;
  }
}

/* Desktop: restore full spacing */
@media (min-width: 1025px) {
  #persistent-nav .ptnav-inner {
    padding: 0 2rem !important;
  }

  #persistent-nav nav {
    gap: 2rem !important;
  }

  #persistent-nav nav a {
    font-size: 0.6875rem !important;
  }

  #persistent-nav .ptnav-title {
    font-size: 1.25rem !important;
  }
}
