/* ====================================================================
   Tamil Dialect Dictionary - Main Stylesheet
   Theme: Peacock Blue / Green Palette with Dynamic Dark/Light Mode
   ==================================================================== */

:root {
  /* Light Theme Color Tokens (Peacock Blue/Green Core) */
  --primary: #0f766e;
  --primary-hover: #0d9488;
  --primary-light: #ccfbf1;
  --accent: #0284c7;
  --accent-light: #e0f2fe;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sticky: rgba(255, 255, 255, 0.92);
  --bg-pill: #f1f5f9;
  --bg-pill-hover: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --focus-ring: rgba(15, 118, 110, 0.35);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);

  --badge-chennai: #3b82f6;
  --badge-madurai: #eab308;
  --badge-kongu: #10b981;
  --badge-nellai: #ec4899;

  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --primary: #14b8a6;
  --primary-hover: #2dd4bf;
  --primary-light: rgba(20, 184, 166, 0.15);
  --accent: #38bdf8;
  --accent-light: rgba(56, 189, 248, 0.15);

  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-sticky: rgba(30, 41, 59, 0.92);
  --bg-pill: #334155;
  --bg-pill-hover: #475569;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --border-color: #334155;
  --border-hover: #475569;
  --focus-ring: rgba(45, 212, 191, 0.4);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

.container {
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ====================================================================
   Top Header Navigation
   ==================================================================== */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1.2rem 0;
  position: relative;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(15, 118, 110, 0.25);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon {
  background: var(--bg-pill);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-pill-hover);
  transform: translateY(-2px);
}

.admin-link-btn {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.admin-link-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

/* ====================================================================
   Sticky Search Box Container
   ==================================================================== */
.search-wrapper-sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-sticky);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0 1.2rem 0;
  box-shadow: var(--shadow-md);
}

.search-box-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}

/* Mode Toggle Switch Bar */
.search-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.mode-toggle-group {
  display: inline-flex;
  background: var(--bg-pill);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.mode-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.3);
}

.mode-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Search Input Bar */
.input-container-relative {
  position: relative;
  width: 100%;
}

.search-input-field {
  width: 100%;
  height: 52px;
  padding: 0 3rem 0 3.2rem;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-pill);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}

.search-input-field:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.search-icon-left {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
  pointer-events: none;
}

.btn-clear-input {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  padding: 4px;
}

.btn-clear-input:hover {
  color: var(--text-main);
}

/* Region Filter Pills */
.region-pills-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.region-pill {
  border: 1px solid var(--border-color);
  background: var(--bg-pill);
  color: var(--text-muted);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.region-pill:hover {
  background: var(--bg-pill-hover);
  color: var(--text-main);
}

.region-pill.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ====================================================================
   Instant Autocomplete Dropdown
   ==================================================================== */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 350px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.autocomplete-item {
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.highlighted {
  background: var(--bg-pill);
}

.auto-word-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auto-tanglish {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.98rem;
}

.auto-tamil {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.92rem;
}

.auto-region-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-pill-hover);
  color: var(--text-muted);
  font-weight: 600;
}

/* ====================================================================
   Widgets: Trending Searches & Live Statistics Bar
   ==================================================================== */
.widget-section {
  margin: 1.5rem 0 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.trending-widget {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.trending-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.chip-trending {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.chip-trending:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

/* Live Counters Grid Bar */
.stats-counter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ====================================================================
   Main Results Section & Dynamic Card Design
   ==================================================================== */
.results-container {
  margin: 1.5rem 0 3rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dictionary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.dictionary-card:hover {
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-top-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-title-group h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.card-tanglish-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.15rem;
}

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

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-region {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-region-chennai { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.badge-region-madurai { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }
.badge-region-kongu   { background: rgba(16, 185, 129, 0.15); color: #059669; }
.badge-region-nellai  { background: rgba(236, 72, 153, 0.15); color: #db2777; }

.badge-category {
  background: var(--bg-pill);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.card-standard-equiv {
  background: var(--bg-pill);
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.card-standard-equiv strong {
  color: var(--text-muted);
}

.card-standard-word {
  font-weight: 700;
  color: var(--accent);
}

.card-definitions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.def-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-md);
}

.def-box h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.5px;
}

.def-box p {
  font-size: 0.98rem;
  color: var(--text-main);
}

.card-sentences-section {
  background: var(--bg-pill);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}

.card-sentences-section h4 {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sentence-item {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.sentence-item:last-child {
  margin-bottom: 0;
}

.sentence-ta {
  font-weight: 600;
  color: var(--text-main);
}

.sentence-tanglish {
  color: var(--text-muted);
  font-style: italic;
}

.sentence-en {
  color: var(--primary);
  font-size: 0.9rem;
}

/* Card Actions Bar (Audio Play & WhatsApp Share) */
.card-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-action {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-action:hover {
  background: var(--bg-pill);
  border-color: var(--border-hover);
}

.btn-audio {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.btn-audio:hover {
  background: var(--primary);
  color: #ffffff;
}

.btn-whatsapp {
  background: #25d366;
  color: #ffffff;
  border: none;
}

.btn-whatsapp:hover {
  background: #1da851;
  color: #ffffff;
}

/* ====================================================================
   Fallback UI Container (No Results Match)
   ==================================================================== */
.fallback-ui-box {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  display: none;
  margin: 2rem 0;
}

.fallback-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.fallback-ui-box h3 {
  font-size: 1.3rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.fallback-ui-box p {
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 1.5rem auto;
  font-size: 0.95rem;
}

.btn-suggest-word {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: #ffffff;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
  transition: var(--transition);
}

.btn-suggest-word:hover {
  background: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-2px);
}

/* ====================================================================
   Additional Page Sections: Regions Showcase & Category Explorer
   ==================================================================== */
.section-block {
  margin: 3rem 0;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

.section-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.regions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.region-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition);
}

.region-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.region-card h4 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.region-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.category-card:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.category-icon {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.category-card h5 {
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 700;
}

/* ====================================================================
   Footer
   ==================================================================== */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 0 1.5rem 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.2rem;
  font-size: 0.85rem;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .search-mode-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .card-top-header {
    flex-direction: column;
  }

  .card-title-group h2 {
    font-size: 1.6rem;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}
