/* ==========================================================================
   திருக்குறள் (Thirukkural) - Modern Web Design System & Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Anek+Tamil:wght@300;400;500;600;700;800&family=Cinzel:wght@600;700;800&family=Noto+Serif+Tamil:wght@400;500;600;700;900&family=Outfit:wght@300;400;500;600;700&display=swap');

/* --- Design Tokens & Color Palettes --- */
:root {
  /* Fonts */
  --font-tamil-serif: 'Noto Serif Tamil', Georgia, serif;
  --font-tamil-sans: 'Anek Tamil', 'Segoe UI', sans-serif;
  --font-display: 'Cinzel', serif;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Common Spacing & Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Paal Theme Accents */
  --color-arathuppal: #eab308;
  --color-arathuppal-glow: rgba(234, 179, 8, 0.3);
  --color-porutpal: #38bdf8;
  --color-porutpal-glow: rgba(56, 189, 248, 0.3);
  --color-kamathuppal: #f43f5e;
  --color-kamathuppal-glow: rgba(244, 63, 94, 0.3);
}

/* --- Theme 1: Royal Midnight Dark (Default) --- */
[data-theme="dark"] {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1b2438;
  --bg-card: rgba(19, 27, 44, 0.75);
  --bg-card-hover: rgba(26, 38, 62, 0.9);
  --bg-modal: rgba(13, 19, 33, 0.96);
  --bg-input: #162035;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(245, 158, 11, 0.6);
  --border-gold: rgba(245, 158, 11, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-gold: #fbbf24;
  --text-highlight: #fef08a;

  --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #d97706 100%);
  --gold-glow: 0 0 25px rgba(245, 158, 11, 0.35);
  --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --hero-mesh: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.15) 0%, transparent 65%),
               radial-gradient(circle at 10% 30%, rgba(56, 189, 248, 0.08) 0%, transparent 50%),
               radial-gradient(circle at 90% 40%, rgba(244, 63, 94, 0.08) 0%, transparent 50%);
}

/* --- Theme 2: Classical Light --- */
[data-theme="light"] {
  --bg-primary: #faf8f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1ede4;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: #ffffff;
  --bg-modal: rgba(255, 255, 255, 0.98);
  --bg-input: #f4efe6;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(180, 83, 9, 0.5);
  --border-gold: rgba(217, 119, 6, 0.4);

  --text-primary: #1e1b18;
  --text-secondary: #5c5549;
  --text-tertiary: #8c8273;
  --text-gold: #b45309;
  --text-highlight: #92400e;

  --gold-gradient: linear-gradient(135deg, #d97706 0%, #b45309 50%, #78350f 100%);
  --gold-glow: 0 0 20px rgba(217, 119, 6, 0.2);
  --card-shadow: 0 10px 25px -5px rgba(180, 130, 80, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
  --hero-mesh: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.12) 0%, transparent 65%),
               radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.06) 0%, transparent 50%);
}

/* --- Theme 3: Palm-Leaf Sepia (ஓலைச்சுவடி) --- */
[data-theme="sepia"] {
  --bg-primary: #f2e8cf;
  --bg-secondary: #e7dac0;
  --bg-tertiary: #dbccae;
  --bg-card: rgba(247, 240, 226, 0.9);
  --bg-card-hover: #fffaf0;
  --bg-modal: #f7f0e2;
  --bg-input: #ebe0c8;

  --border-subtle: rgba(92, 64, 40, 0.15);
  --border-focus: rgba(139, 69, 19, 0.6);
  --border-gold: rgba(160, 82, 45, 0.4);

  --text-primary: #38220f;
  --text-secondary: #634327;
  --text-tertiary: #876241;
  --text-gold: #8c3b0f;
  --text-highlight: #702604;

  --gold-gradient: linear-gradient(135deg, #a0522d 0%, #8b4513 50%, #5c2c16 100%);
  --gold-glow: 0 0 20px rgba(160, 82, 45, 0.25);
  --card-shadow: 0 8px 20px rgba(92, 64, 40, 0.12);
  --hero-mesh: radial-gradient(circle at 50% 0%, rgba(160, 82, 45, 0.12) 0%, transparent 65%);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  background-image: var(--hero-mesh);
  background-attachment: fixed;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Tamil Typography Defaults */
.tamil-text, .kural-line, .urai-text {
  font-family: var(--font-tamil-serif);
  letter-spacing: 0.015em;
  word-spacing: 0.05em;
}

.tamil-sans {
  font-family: var(--font-tamil-sans);
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Buttons, Links & Inputs Reset */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
  transition: all var(--transition-fast);
}

input, select {
  font-family: inherit;
  color: inherit;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--border-gold);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-normal);
}

[data-theme="light"] .site-header {
  background: rgba(250, 248, 245, 0.88);
}
[data-theme="sepia"] .site-header {
  background: rgba(242, 232, 207, 0.9);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-symbol {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--gold-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-tamil-serif);
  font-size: 1.6rem;
  font-weight: 900;
  color: #0a0e17;
  box-shadow: var(--gold-glow);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-tamil-serif);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Nav Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  position: relative;
}

.btn-icon:hover {
  background: var(--border-gold);
  transform: translateY(-2px);
  color: var(--text-gold);
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-kamathuppal);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--gold-gradient);
  color: #0a0e17;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-gold);
  color: var(--text-gold);
}

/* ==========================================================================
   Hero Section & Daily Featured Kural
   ========================================================================== */
.hero-section {
  padding: 3rem 0 2rem;
  position: relative;
}

.hero-banner {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 2.5rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  color: var(--text-gold);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
  backdrop-filter: blur(8px);
}

.hero-title {
  font-family: var(--font-tamil-serif);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.85rem;
}

.hero-title span {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Featured / Daily Kural Card */
.daily-kural-container {
  max-width: 900px;
  margin: 0 auto;
}

.kural-card-featured {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  box-shadow: var(--card-shadow), var(--gold-glow);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.kural-card-featured::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gold-gradient);
}

.card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.kural-badge-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.kural-num-pill {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--gold-gradient);
  color: #0a0e17;
}

.paal-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.paal-pill.arathuppal { color: var(--color-arathuppal); border-color: var(--color-arathuppal); }
.paal-pill.porutpal { color: var(--color-porutpal); border-color: var(--color-porutpal); }
.paal-pill.kamathuppal { color: var(--color-kamathuppal); border-color: var(--color-kamathuppal); }

.card-actions-quick {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Couplet Text Presentation */
.kural-verses {
  margin-bottom: 1.75rem;
  text-align: center;
}

.kural-line {
  font-size: clamp(1.25rem, 2.8vw, 1.75rem);
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-highlight);
  display: block;
}

.kural-line:first-child {
  margin-bottom: 0.35rem;
}

.kural-transliteration {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.75rem;
}

/* Scholar Commentaries Selector & Box */
.commentary-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.tab-btn {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  white-space: nowrap;
  border: 1px solid transparent;
}

.tab-btn.active {
  background: var(--border-gold);
  color: var(--text-gold);
  border-color: var(--border-focus);
}

.tab-btn:hover:not(.active) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.commentary-box {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border-subtle);
  min-height: 90px;
  position: relative;
}

.urai-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-gold);
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.urai-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-primary);
}

/* Featured Card Footer Controls */
.card-footer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Section: Paal Explorer (3 Divisions)
   ========================================================================== */
.paal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.paal-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

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

.paal-card.active {
  border-color: var(--border-focus);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.paal-card.arathuppal:hover, .paal-card.arathuppal.active {
  border-color: var(--color-arathuppal);
  box-shadow: 0 10px 30px var(--color-arathuppal-glow);
}
.paal-card.porutpal:hover, .paal-card.porutpal.active {
  border-color: var(--color-porutpal);
  box-shadow: 0 10px 30px var(--color-porutpal-glow);
}
.paal-card.kamathuppal:hover, .paal-card.kamathuppal.active {
  border-color: var(--color-kamathuppal);
  box-shadow: 0 10px 30px var(--color-kamathuppal-glow);
}

.paal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.paal-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.paal-card.arathuppal .paal-icon-wrap { background: rgba(234, 179, 8, 0.15); }
.paal-card.porutpal .paal-icon-wrap { background: rgba(56, 189, 248, 0.15); }
.paal-card.kamathuppal .paal-icon-wrap { background: rgba(244, 63, 94, 0.15); }

.paal-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.paal-card-title {
  font-family: var(--font-tamil-serif);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.paal-card-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.paal-card-desc {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.paal-stats {
  display: flex;
  gap: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-weight: 700;
  color: var(--text-primary);
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ==========================================================================
   Search & Filter Hub
   ========================================================================== */
.search-hub-section {
  padding: 2rem 0 1rem;
}

.search-bar-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 1.25rem;
}

.search-bar-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--gold-glow);
}

.search-icon {
  font-size: 1.25rem;
  color: var(--text-gold);
  margin-left: 0.75rem;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  padding: 0.5rem 0.25rem;
  color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-clear-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.search-clear-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Quick Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.chip.active {
  background: var(--gold-gradient);
  color: #0a0e17;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chapter-select {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-primary);
  max-width: 240px;
}

/* ==========================================================================
   Kurals Grid List
   ========================================================================== */
.kurals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.kural-card-item {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-normal);
  position: relative;
  backdrop-filter: blur(12px);
}

.kural-card-item:hover {
  transform: translateY(-4px);
  border-color: var(--border-gold);
  box-shadow: var(--card-shadow);
}

.kural-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.kural-item-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-gold);
  border: 1px solid var(--border-gold);
}

.kural-item-adhigaram {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.kural-item-verses {
  margin-bottom: 1.25rem;
}

.kural-item-line {
  font-family: var(--font-tamil-serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-primary);
  display: block;
}

.kural-item-urai {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kural-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px dashed var(--border-subtle);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

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

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), var(--gold-glow);
  transform: scale(0.95) translateY(10px);
  transition: all var(--transition-bounce);
  padding: 2rem;
  position: relative;
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  font-size: 1.5rem;
  color: var(--text-tertiary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Canvas Image Card Generator Modal Specifics */
.canvas-preview-box {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #000;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
}

#quoteCanvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
}

.canvas-style-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.color-option {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.color-option.selected {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

/* Quiz Mode Component */
.quiz-box {
  padding: 1rem 0;
}

.quiz-progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--gold-gradient);
  transition: width var(--transition-normal);
}

.quiz-question-box {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  text-align: center;
}

.quiz-options-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.quiz-option-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: left;
  font-family: var(--font-tamil-serif);
  font-size: 1.05rem;
  transition: all var(--transition-fast);
}

.quiz-option-btn:hover {
  background: var(--border-gold);
  border-color: var(--border-focus);
}

.quiz-option-btn.correct {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #4ade80;
}

.quiz-option-btn.wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #f87171;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  backdrop-filter: blur(12px);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 0.75rem;
  max-width: 420px;
}

.footer-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-gold);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--text-gold);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  .header-inner {
    height: 64px;
  }
  .kural-card-featured {
    padding: 1.5rem 1.25rem;
  }
  .kurals-grid {
    grid-template-columns: 1fr;
  }
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}
