/* Global Variables */
:root {
  --text-color: #2d3748;
  --bg-color: #ffffff;
  --card-bg: #f7fafc;
  --border-color: #e2e8f0;
  --accent-color: #4a5568;
  --light-accent: #718096;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --text-color: #f7fafc;
  --bg-color: #1a202c;
  --card-bg: #2d3748;
  --border-color: #4a5568;
  --accent-color: #e2e8f0;
  --light-accent: #a0aec0;
}

/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

body {
  font-family: "Noto Sans Tamil", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
}

.container {
  width: 95%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 0;
}

/* Navbar Styles */
.navbar {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 15px 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  transition: all 0.3s ease;
}

.navbar.scrolled {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.navbar-brand {
  font-size: 32px;
  font-weight: 700;
  color: white;
  text-decoration: none;
  text-shadow: 2px 2px 12px rgba(0,0,0,0.55);
  transition: all 0.3s ease;
}

.navbar.scrolled .navbar-brand {
  color: var(--text-color);
  text-shadow: none;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 28px;
  align-items: center;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: 10px;
  transition: all 0.3s ease;
  text-shadow: 1px 1px 6px rgba(0,0,0,0.35);
}

.navbar.scrolled .nav-link {
  color: var(--text-color);
  text-shadow: none;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.18);
}

.navbar.scrolled .nav-link:hover,
.navbar.scrolled .nav-link.active {
  background: var(--border-color);
}

.navbar-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.3s ease;
}

.navbar-controls .language-select,
.navbar-controls .theme-toggle {
  color: white;
}

.language-select {
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  color: white;
  padding: 8px 10px;
  border-radius: 8px;
}

.theme-toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.35);
  color: white;
}

.theme-toggle:hover,
.language-select:focus {
  background: rgba(255,255,255,0.18);
}

.slider-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.30) 0%, rgba(0,0,0,0.08) 30%, rgba(0,0,0,0) 65%);
  pointer-events: none;
  z-index: 2;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 8px;
  cursor: pointer;
  padding: 14px;
  gap: 6px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  min-width: 50px;
  min-height: 50px;
  justify-content: center;
  align-items: center;
  margin-left: auto;
}

.hamburger:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.hamburger span {
  width: 24px;
  height: 3px;
  background: white;
  transition: all 0.3s ease;
  transform-origin: center;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Side Nav */
.side-nav {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  z-index: 1001;
  transition: left 0.3s ease;
  padding: 80px 20px 20px;
  overflow-y: auto;
}

.side-nav.active {
  left: 0;
}

.side-nav .navbar-nav {
  flex-direction: column;
  gap: 22px;
  align-items: flex-start;
}

.side-nav .nav-link {
  color: var(--text-color);
  text-shadow: none;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
}

.side-nav .navbar-controls {
  margin-top: 30px;
  width: 100%;
  justify-content: flex-start;
}

.side-nav .language-select,
.side-nav .theme-toggle {
  color: var(--text-color);
  background: var(--bg-color);
  border: 1px solid var(--border-color);
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 14px;
}

.theme-toggle:hover {
  background: var(--border-color);
}

/* Main Content */
.main-content {
  margin-top: 0;
  padding: 0 20px;
}

h1 {
  text-align: center;
  font-size: 36px;
  margin-bottom: 30px;
  color: var(--text-color);
}

/* Image Slider */
.slider-section {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.slider-container {
  width: 100%;
  height: 100%;
  position: relative;
  max-width: none;
}

.slider {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease, filter 0.8s ease, transform 0.8s ease;
  pointer-events: none;
}

.slide.active {
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
  filter: drop-shadow(0 0 22px rgba(255, 255, 255, 0.45));
  transform: scale(1.01);
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.65);
  color: #1f2937;
  font-size: 22px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.slider-arrow:hover {
  transform: translateY(-50%) scale(1.05);
  background: rgba(255,255,255,1);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
}

.slider-arrow.prev {
  left: 24px;
}

.slider-arrow.next {
  right: 24px;
}

.slider-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

/* Content after slider */
.search-section {
  margin-top: 100vh;
  padding-top: 40px;
}

.slider-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-color);
  cursor: pointer;
}

.footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 40px 20px;
  color: var(--text-color);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 30px;
}

.footer-content h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

.footer-content p,
.footer-content a,
.footer-content li {
  color: var(--text-color);
  font-size: 14px;
  line-height: 1.8;
}

.footer-content a {
  color: var(--accent-color);
  text-decoration: none;
}

.footer-content a:hover {
  text-decoration: underline;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-bottom {
  margin-top: 30px;
  font-size: 13px;
  color: var(--text-color);
  opacity: 0.8;
}

@media (max-width: 900px) {
  .footer-content {
    grid-template-columns: 1fr;
  }
}

.slider-dot.active {
  background: var(--accent-color);
}

@media (max-width: 1024px) {
  .navbar .container {
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 18px;
  }

  .navbar-nav {
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
  }

  .nav-link {
    padding: 8px 12px;
    font-size: 14px;
  }

  .language-select,
  .theme-toggle {
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 12px 0;
  }

  .navbar-brand {
    font-size: 22px;
  }

  .navbar > .container > .hamburger {
    display: flex;
  }

  .navbar > .container > .navbar-nav {
    display: none;
  }

  .navbar > .container > .navbar-controls {
    display: none;
  }

  .slider-arrow {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .slider-arrow.prev {
    left: 16px;
  }

  .slider-arrow.next {
    right: 16px;
  }

  .slider-nav {
    bottom: 18px;
  }

  .slider-section {
    height: 100vh;
  }
}

@media (max-width: 600px) {
  .navbar .container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .slider-section {
    height: 100vh;
  }

  .search-box {
    flex-direction: column;
  }
}

/* Search Section */
.search-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 25px;
  margin: 30px 0;
  border: 1px solid var(--border-color);
}

.search-box {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.search-box input,
.search-box select {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  background: var(--bg-color);
  color: var(--text-color);
  min-width: 250px;
}

.search-box input:focus,
.search-box select:focus {
  outline: none;
  border-color: var(--accent-color);
}

.stats {
  text-align: center;
  color: var(--light-accent);
  font-size: 16px;
  padding: 10px;
}

.tts-warning-popup {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  z-index: 2000;
  width: min(96%, 520px);
  border-radius: 12px;
  overflow: hidden;
}

.popup-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.popup-content p {
  margin: 0;
  color: var(--text-color);
  font-size: 15px;
  line-height: 1.7;
}

.popup-close {
  align-self: flex-end;
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.popup-close:hover {
  background: var(--light-accent);
}

/* Kural Display */
.kural-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.kural-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
}

.kural-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.kural-number {
  font-size: 18px;
  font-weight: bold;
  color: var(--accent-color);
}

.kural-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.audio-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.audio-btn:hover {
  background: var(--light-accent);
  transform: scale(1.05);
}

.audio-btn.playing {
  background: #e53e3e;
}

.audio-btn.playing:hover {
  background: #c53030;
}

.audio-btn i {
  font-size: 12px;
}

.kural-details {
  text-align: right;
  font-size: 14px;
  color: var(--light-accent);
  flex: 1;
  margin-left: 15px;
}

.pal {
  font-weight: 600;
  margin-bottom: 2px;
}

.adhigaram {
  font-size: 13px;
}

.kural-text {
  font-size: 20px;
  line-height: 1.8;
  margin-bottom: 15px;
  color: var(--text-color);
  font-weight: 500;
  text-align: center;
  padding: 15px;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.kural-line {
  margin-bottom: 8px;
}

.kural-line:last-child {
  margin-bottom: 0;
}

.meaning {
  color: var(--light-accent);
  line-height: 1.7;
  font-size: 15px;
  padding: 12px;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.load-more-container {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 20px;
}

.load-more-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.load-more-btn:hover {
  background: var(--light-accent);
}

.empty {
  text-align: center;
  padding: 60px 30px;
  color: var(--light-accent);
  font-size: 18px;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  grid-column: 1 / -1;
}

/* Footer */
.footer {
  margin-top: 60px;
  padding: 30px 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-content p {
  color: var(--light-accent);
  font-size: 14px;
}

/* History Page Styles */
.history-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 0;
}

.history-section {
  margin-bottom: 40px;
  padding: 25px;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.history-section h2 {
  color: var(--accent-color);
  margin-bottom: 20px;
  font-size: 24px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
}

.history-section p {
  margin-bottom: 15px;
  line-height: 1.7;
  color: var(--text-color);
}

.history-section ul {
  margin: 20px 0;
  padding-left: 20px;
}

.history-section li {
  margin-bottom: 10px;
  color: var(--text-color);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.feature-card {
  padding: 20px;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.feature-card h3 {
  color: var(--accent-color);
  margin-bottom: 10px;
  font-size: 18px;
}

.feature-card p {
  color: var(--light-accent);
  font-size: 14px;
  line-height: 1.6;
}

blockquote {
  background: var(--bg-color);
  border-left: 4px solid var(--accent-color);
  padding: 20px;
  margin: 20px 0;
  font-style: italic;
  border-radius: 0 8px 8px 0;
}

blockquote cite {
  display: block;
  margin-top: 10px;
  color: var(--light-accent);
  font-size: 14px;
  font-style: normal;
}

.languages-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.language-tag {
  background: var(--accent-color);
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}