/* Terms of Service - Fixed CSS with proper theme variables and responsive design */

/* Root CSS Custom Properties */
:root {
  /* Light Theme Colors */
  --background-color: #ffffff;
  --surface-color: #f8fafc;
  --surface-color-rgb: 248, 250, 252;
  --heading-color: #1e293b;
  --default-color: #475569;
  --contrast-color: #ffffff;
  --accent-color: #667eea;
  --accent-color-dark: #5a6fd8;
  --border-color: rgba(148, 163, 184, 0.2);
  --shadow-color-rgb: 15, 23, 42;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Nunito', var(--font-primary);
  
  /* Spacing & Layout */
  --section-padding: 4rem 0;
  --container-max-width: 1200px;
  --border-radius: 16px;
  --border-radius-lg: 24px;
  
  /* Transitions - Optimized for faster interactions */
  --transition-fast: all 0.2s ease;
  --transition-base: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Dark Theme */
[data-bs-theme="dark"] {
  --background-color: #0f172a;
  --surface-color: #1e293b;
  --surface-color-rgb: 30, 41, 59;
  --heading-color: #e2e8f0;
  --default-color: #cbd5e1;
  --contrast-color: #0f172a;
  --accent-color: #a78bfa;
  --accent-color-dark: #9333ea;
  --border-color: rgba(148, 163, 184, 0.1);
  --shadow-color-rgb: 0, 0, 0;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  line-height: 1.6;
  color: var(--default-color);
  background-color: var(--background-color);
  transition: var(--transition-base);
  margin: 0;
  padding: 0;
}

/* Page Background with Animated Gradient */
.terms-of-service {
  min-height: 100vh;
  padding: 120px 0 80px;
  background: 
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139, 236, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(118, 75, 162, 0.06) 0%, transparent 50%),
    linear-gradient(135deg, var(--background-color) 0%, var(--surface-color) 100%);
  position: relative;
  overflow-x: hidden;
  transition: var(--transition-base);
}

.terms-of-service::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.04) 0%, transparent 25%),
    radial-gradient(circle at 75% 75%, rgba(139, 236, 255, 0.04) 0%, transparent 25%);
  animation: backgroundPulse 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes backgroundPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

.terms-of-service .container {
  position: relative;
  z-index: 2;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Terms Header */
.terms-header {
  background: rgba(var(--surface-color-rgb), 0.8); /* UPDATED: Use theme variable */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 50px 40px;
  text-align: center;
  margin-bottom: 50px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(var(--shadow-color-rgb), 0.1);
  transition: var(--transition-smooth);
}

.terms-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.05), transparent);
  transition: left 0.8s ease;
}

.terms-header:hover::before {
  left: 100%;
}

.terms-header:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 60px rgba(var(--shadow-color-rgb), 0.15);
  border-color: rgba(102, 126, 234, 0.3);
}

.terms-header h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--heading-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-heading);
  position: relative;
}

.terms-header .last-updated {
  color: var(--default-color);
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0.8;
}

/* Table of Contents */
.table-of-contents {
  background: rgba(var(--surface-color-rgb), 0.7); /* UPDATED: Use theme variable */
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  margin-bottom: 50px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(var(--shadow-color-rgb), 0.08);
  transition: var(--transition-smooth);
}

.table-of-contents::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-color), #8ec6ff, var(--accent-color));
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.table-of-contents:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(var(--shadow-color-rgb), 0.12);
}

.table-of-contents h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
}

.table-of-contents h2 i {
  color: var(--accent-color);
  font-size: 1.5rem;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px;
}

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  text-decoration: none;
  color: var(--default-color);
  background: rgba(var(--surface-color-rgb), 0.5); /* UPDATED: Use theme variable */
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.toc-list a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.08), transparent);
  transition: left 0.5s ease;
}

.toc-list a:hover::before {
  left: 100%;
}

.toc-list a:hover {
  transform: translateX(5px) translateY(-1px);
  color: var(--accent-color);
  background: rgba(102, 126, 234, 0.08);
  border-color: rgba(102, 126, 234, 0.2);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.1);
}

.toc-list a i {
  font-size: 1.1rem;
  color: var(--accent-color);
  opacity: 0.8;
  transition: var(--transition-base);
}

.toc-list a:hover i {
  opacity: 1;
  transform: scale(1.05);
}

.toc-list a.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(139, 236, 255, 0.05) 100%);
  color: var(--accent-color);
  border-color: rgba(102, 126, 234, 0.3);
  transform: translateX(5px);
}

.toc-list a.active i {
  transform: scale(1.05);
  color: var(--accent-color);
}

/* Terms Content Container */
.terms-content {
  background: rgba(var(--surface-color-rgb), 0.6); /* UPDATED: Use theme variable */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 50px 40px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(var(--shadow-color-rgb), 0.08);
  transition: var(--transition-smooth);
}

.terms-content:hover {
  box-shadow: 0 16px 48px rgba(var(--shadow-color-rgb), 0.12);
}

/* Introduction Section */
.terms-intro {
  background: rgba(102, 126, 234, 0.06);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(102, 126, 234, 0.15);
  border-radius: var(--border-radius);
  padding: 30px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.terms-intro::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent-color), rgba(102, 126, 234, 0.5));
  border-radius: 0 2px 2px 0;
}

.intro-text h3 {
  color: var(--heading-color);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
}

.intro-text h3 i {
  color: var(--accent-color);
}

.intro-text p {
  color: var(--default-color);
  font-size: 1.1rem;
  line-height: 1.7;
  margin: 0;
}

/* Terms Sections */
.terms-section {
  margin-bottom: 30px;
  background: rgba(var(--surface-color-rgb), 0.4); /* UPDATED: Use theme variable */
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition-smooth);
  position: relative;
}

.terms-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(180deg, var(--accent-color), rgba(102, 126, 234, 0.5));
  transition: width 0.4s ease;
  z-index: 1;
}

.terms-section:hover::before {
  width: 4px;
}

.terms-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(var(--shadow-color-rgb), 0.1);
  border-color: rgba(102, 126, 234, 0.15);
  background: rgba(var(--surface-color-rgb), 0.6); /* UPDATED: Use theme variable */
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 25px 30px;
  cursor: pointer;
  background: rgba(var(--surface-color-rgb), 0.3); /* UPDATED: Use theme variable */
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-base);
  position: relative;
  z-index: 2;
}

.section-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.03), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.section-header:hover::before {
  opacity: 1;
}

.section-header:hover {
  background: rgba(var(--accent-color), 0.05); /* UPDATED: Use accent-color for a more professional hover */
  transform: translateX(3px);
}

.section-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-color-dark));
  color: var(--contrast-color);
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
  transition: var(--transition-base);
}

.section-header:hover .section-number {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.section-header h2 {
  flex: 1;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition-base);
  font-family: var(--font-heading);
}

.section-header h2 i {
  color: var(--accent-color);
  font-size: 1.2rem;
}

.section-toggle {
  font-size: 1.2rem;
  color: var(--accent-color);
  transition: var(--transition-base);
  opacity: 0.7;
}

.section-header[aria-expanded="true"] .section-toggle {
  transform: rotate(180deg);
  opacity: 1;
}

.section-header:hover .section-toggle {
  opacity: 1;
  transform: translateX(-2px);
}

/* Section Content - Optimized for fast, smooth animation */
.section-content {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  background: rgba(var(--surface-color-rgb), 0.2);
  backdrop-filter: blur(8px);
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.section-content.show {
  grid-template-rows: 1fr;
}

/* Inner wrapper for content with fast fade-in */
.section-content-inner {
  min-height: 0;
  padding: 0 30px;
  opacity: 0;
  transition: opacity 0.2s ease 0.08s, padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-content.show .section-content-inner {
  opacity: 1;
  padding: 35px 30px;
}
/* End of animation update */


.section-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 30px 0 15px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
}

.section-content h3:first-child {
  margin-top: 0;
}

.section-content h3 i {
  color: var(--accent-color);
  font-size: 1.1rem;
}

.section-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading-color);
  margin: 25px 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
}

.section-content h4 i {
  color: var(--accent-color);
  font-size: 1rem;
}

.section-content p {
  color: var(--default-color);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 20px;
}

.section-content ul,
.section-content ol {
  color: var(--default-color);
  margin-bottom: 20px;
  padding-left: 20px;
}

.section-content li {
  margin-bottom: 8px;
  line-height: 1.6;
  position: relative;
}

.section-content li strong {
  color: var(--heading-color);
  font-weight: 600;
}

/* Info Boxes */
.info-box {
  background: rgba(74, 144, 226, 0.08);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(74, 144, 226, 0.15);
  border-radius: var(--border-radius);
  padding: 25px;
  margin: 25px 0;
  position: relative;
  overflow: hidden;
  transition: var(--transition-base);
}

.info-box::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #4a90e2, rgba(74, 144, 226, 0.5));
  border-radius: 0 2px 2px 0;
}

.info-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(74, 144, 226, 0.12);
}

.info-box h4 {
  color: var(--heading-color);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
}

.info-box h4 i {
  color: #4a90e2;
  font-size: 1rem;
}

.info-box p,
.info-box ul {
  color: var(--default-color);
  margin: 0;
  line-height: 1.6;
}

/* Highlight Boxes */
.highlight-box {
  background: rgba(255, 193, 7, 0.08);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 193, 7, 0.2);
  border-radius: var(--border-radius);
  padding: 25px;
  margin: 25px 0;
  position: relative;
  overflow: hidden;
  transition: var(--transition-base);
}

.highlight-box::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #ffc107, rgba(255, 193, 7, 0.5));
  border-radius: 0 2px 2px 0;
}

.highlight-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 193, 7, 0.12);
}

.highlight-box h4 {
  color: var(--heading-color);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
}

.highlight-box h4 i {
  color: #ffc107;
  font-size: 1rem;
}

.highlight-box p,
.highlight-box ul {
  color: var(--default-color);
  margin: 0;
  line-height: 1.6;
}

/* Warning Boxes */
.warning-box {
  background: rgba(220, 53, 69, 0.08);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: var(--border-radius);
  padding: 25px;
  margin: 25px 0;
  position: relative;
  overflow: hidden;
  transition: var(--transition-base);
}

.warning-box::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #dc3545, rgba(220, 53, 69, 0.5));
  border-radius: 0 2px 2px 0;
}

.warning-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(220, 53, 69, 0.12);
}

.warning-box h4 {
  color: var(--heading-color);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
}

.warning-box h4 i {
  color: #dc3545;
  font-size: 1rem;
}

.warning-box p {
  color: var(--default-color);
  margin: 0;
  line-height: 1.6;
}

/* Terms Footer */
.terms-footer {
  background: rgba(var(--surface-color-rgb), 0.7); /* UPDATED: Use theme variable */
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  margin-top: 50px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(var(--shadow-color-rgb), 0.08);
  transition: var(--transition-smooth);
}

.terms-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-color), #8ec6ff, var(--accent-color));
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.terms-footer:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(var(--shadow-color-rgb), 0.12);
}

.footer-content h3 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-heading);
}

.footer-content h3 i {
  color: var(--accent-color);
  font-size: 1.5rem;
}

.footer-content p {
  color: var(--default-color);
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 25px;
  opacity: 0.9;
}

/* Footer Actions */
.footer-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 25px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 25px;
  background: rgba(102, 126, 234, 0.08);
  color: var(--accent-color);
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  border: 1px solid rgba(102, 126, 234, 0.15);
  transition: var(--transition-base);
  backdrop-filter: blur(10px);
}

.footer-link:hover {
  background: var(--accent-color);
  color: var(--contrast-color);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
  border-color: var(--accent-color);
}

.footer-link i {
  font-size: 1rem;
}

/* Premium Newsletter Section */
.footer-newsletter-section {
  margin: 35px 0 30px;
  padding: 30px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-radius: var(--border-radius);
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.footer-newsletter-section h4 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-heading);
}

.footer-newsletter-section h4 i {
  color: var(--accent-color);
  font-size: 1.3rem;
}

.newsletter-text {
  color: var(--default-color);
  font-size: 1rem;
  margin-bottom: 20px;
  opacity: 0.9;
}

.footer-newsletter-form {
  max-width: 500px;
  margin: 0 auto;
}

.newsletter-input-group-modern {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(var(--surface-color-rgb), 0.9); /* UPDATED: Use theme variable */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--border-color);
  border-radius: 50px;
  padding: 4px;
  transition: var(--transition-base);
  height: 54px;
  box-shadow: 0 4px 15px rgba(var(--shadow-color-rgb), 0.05);
  overflow: hidden; /* ADDED: This clips the inner input's corners */
}

.newsletter-input-group-modern:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
  transform: translateY(-1px);
}

.newsletter-input-group-modern input[type="email"] {
  background: transparent;
  border: none;
  color: var(--heading-color);
  padding: 14px 65px 14px 20px;
  height: 100%;
  flex: 1;
  min-width: 0;
  outline: none;
  font-size: 0.95rem;
  font-family: var(--font-primary);
}

.newsletter-input-group-modern input::placeholder {
  color: var(--default-color);
  opacity: 0.6;
}

.newsletter-btn-modern {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-dark) 100%);
  border: none;
  color: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.newsletter-btn-modern:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, var(--accent-color-dark) 0%, var(--accent-color) 100%);
}

.newsletter-btn-modern:active {
  transform: translateY(-50%) scale(0.98);
}

.newsletter-btn-modern .btn-icon,
.newsletter-btn-modern .btn-loading {
  font-size: 1.2rem;
  line-height: 0;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.form-messages {
  margin-top: 12px;
  font-size: 0.9rem;
  min-height: 1.2em;
  text-align: center;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.form-messages.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.form-messages.success {
  color: #10b981;
  font-weight: 500;
}

.form-messages.error {
  color: #ef4444;
  font-weight: 500;
}

/* Dark Theme Newsletter Adjustments */
[data-bs-theme="dark"] .footer-newsletter-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
  border-color: rgba(102, 126, 234, 0.15);
}

/* DELETED: This rule is no longer needed */
/*
[data-bs-theme="dark"] .newsletter-input-group-modern {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(102, 126, 234, 0.2);
}
*/

[data-bs-theme="dark"] .newsletter-input-group-modern:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
}

[data-bs-theme="dark"] .newsletter-input-group-modern input::placeholder {
  color: var(--default-color);
  opacity: 0.5;
}

/* Back to Top Button */
.terms-back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 55px;
  height: 55px;
  background: rgba(var(--surface-color-rgb), 0.9); /* UPDATED: Use theme variable */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition-smooth);
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(var(--shadow-color-rgb), 0.12);
}

.terms-back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.terms-back-to-top:hover {
  background: var(--accent-color);
  color: var(--contrast-color);
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(102, 126, 234, 0.25);
  border-color: var(--accent-color);
}

/* Dark Theme Adjustments */
/* DELETED all specific background overrides, as they are now handled by the theme variable */
[data-bs-theme="dark"] .terms-of-service {
  background: 
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139, 236, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(118, 75, 162, 0.05) 0%, transparent 50%),
    linear-gradient(135deg, var(--background-color) 0%, var(--surface-color) 100%);
}

[data-bs-theme="dark"] .terms-header {
  border-color: var(--border-color);
}

[data-bs-theme="dark"] .table-of-contents {
  border-color: var(--border-color);
}

[data-bs-theme="dark"] .toc-list a {
  border-color: var(--border-color);
}

[data-bs-theme="dark"] .toc-list a:hover {
  background: rgba(102, 126, 234, 0.1);
  border-color: rgba(102, 126, 234, 0.2);
}

[data-bs-theme="dark"] .terms-content {
  border-color: var(--border-color);
}

[data-bs-theme="dark"] .terms-section {
  border-color: var(--border-color);
}

/* UPDATED: Dark mode hover for sections */
[data-bs-theme="dark"] .terms-section:hover {
  background: rgba(var(--surface-color-rgb), 0.7); /* Use a slightly lighter dark-mode surface color */
  border-color: rgba(148, 163, 184, 0.15);
}

[data-bs-theme="dark"] .section-header {
  border-color: var(--border-color);
}

/* UPDATED: Dark mode hover for section headers */
[data-bs-theme="dark"] .section-header:hover {
  background: rgba(var(--accent-color), 0.1); /* Use accent-color for a professional hover */
}

[data-bs-theme="dark"] .section-content {
  /* This background override is fine as it's a slightly different shade */
  background: rgba(30, 41, 59, 0.2);
}

[data-bs-theme="dark"] .terms-intro {
  background: rgba(102, 126, 234, 0.05);
  border-color: rgba(102, 126, 234, 0.1);
}

[data-bs-theme="dark"] .info-box {
  background: rgba(74, 144, 226, 0.05);
  border-color: rgba(74, 144, 226, 0.1);
}

/* UPDATED: Dark mode hover for info box */
[data-bs-theme="dark"] .info-box:hover {
  box-shadow: 0 8px 24px rgba(74, 144, 226, 0.15);
  background: rgba(74, 144, 226, 0.1);
}

[data-bs-theme="dark"] .highlight-box {
  background: rgba(255, 193, 7, 0.05);
  border-color: rgba(255, 193, 7, 0.15);
}

/* UPDATED: Dark mode hover for highlight box */
[data-bs-theme="dark"] .highlight-box:hover {
  box-shadow: 0 8px 24px rgba(255, 193, 7, 0.15);
  background: rgba(255, 193, 7, 0.1);
}

[data-bs-theme="dark"] .warning-box {
  background: rgba(220, 53, 69, 0.05);
  border-color: rgba(220, 53, 69, 0.15);
}

/* UPDATED: Dark mode hover for warning box */
[data-bs-theme="dark"] .warning-box:hover {
  box-shadow: 0 8px 24px rgba(220, 53, 69, 0.15);
  background: rgba(220, 53, 69, 0.1);
}

[data-bs-theme="dark"] .terms-footer {
  border-color: var(--border-color);
}

[data-bs-theme="dark"] .terms-back-to-top {
  border-color: var(--border-color);
}

[data-bs-theme="dark"] .footer-link {
  background: rgba(102, 126, 234, 0.05);
  border-color: rgba(102, 126, 234, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .terms-of-service {
    padding: 100px 0 60px;
  }
  
  .terms-header h1 {
    font-size: 3rem;
  }
  
  .toc-list {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .terms-of-service {
    padding: 90px 0 50px;
  }
  
  .terms-of-service .container {
    padding: 0 15px;
  }
  
  .terms-header {
    padding: 35px 25px;
    margin-bottom: 35px;
  }
  
  .terms-header h1 {
    font-size: 2.5rem;
  }
  
  .table-of-contents {
    padding: 30px 25px;
    margin-bottom: 35px;
  }
  
  .toc-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .toc-list a {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
  
  .terms-content {
    padding: 35px 25px;
  }
  
  .section-header {
    padding: 20px 25px;
  }
  
  .section-header h2 {
    font-size: 1.25rem;
  }
  
  .section-content.show .section-content-inner { /* UPDATED for grid animation */
    padding: 25px;
  }
  
  .info-box, .highlight-box, .warning-box {
    padding: 20px;
    margin: 20px 0;
  }
  
  .terms-footer {
    padding: 30px 25px;
  }
  
  .footer-actions {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
  
  .footer-link {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
  
  .terms-back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
  
  /* UPDATED: Simplify backdrop-filter on mobile */
  .terms-header,
  .table-of-contents,
  .terms-content,
  .terms-section,
  .section-header,
  .section-content {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

@media (max-width: 576px) {
  .terms-of-service {
    padding: 80px 0 40px;
  }
  
  .terms-of-service .container {
    padding: 0 12px;
  }
  
  .terms-header {
    padding: 25px 20px;
    margin-bottom: 30px;
  }
  
  .terms-header h1 {
    font-size: 2rem;
  }
  
  .terms-header .last-updated {
    font-size: 1rem;
  }
  
  .table-of-contents {
    padding: 25px 20px;
    margin-bottom: 30px;
  }
  
  .table-of-contents h2 {
    font-size: 1.5rem;
  }
  
  .toc-list a {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
  
  .terms-content {
    padding: 25px 20px;
  }
  
  .section-header {
    padding: 18px 20px;
    gap: 15px;
  }
  
  .section-header h2 {
    font-size: 1.1rem;
  }
  
  .section-number {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
  
  .section-content.show .section-content-inner { /* UPDATED for grid animation */
    padding: 20px;
  }
  
  .section-content h3 {
    font-size: 1.1rem;
  }
  
  .section-content h4 {
    font-size: 1rem;
  }
  
  .section-content p {
    font-size: 0.95rem;
  }
  
  .info-box, .highlight-box, .warning-box {
    padding: 16px;
    margin: 16px 0;
  }
  
  .info-box h4, .highlight-box h4, .warning-box h4 {
    font-size: 1rem;
  }
  
  .terms-footer {
    padding: 25px 20px;
  }
  
  .footer-content h3 {
    font-size: 1.5rem;
  }
  
  .footer-content p {
    font-size: 1rem;
  }
  
  .footer-link {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .terms-back-to-top {
    bottom: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .terms-header h1 {
    font-size: 1.75rem;
  }
  
  .table-of-contents h2 {
    font-size: 1.3rem;
  }
  
  .section-header h2 {
    font-size: 1rem;
  }
  
  .section-number {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }
  
  .footer-content h3 {
    font-size: 1.3rem;
  }
}

/* Animation Keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* AOS Fallback */
[data-aos] {
  opacity: 1;
  transform: none;
  transition: var(--transition-base);
}

/* Smooth scrolling for the whole page */
html {
  scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.section-header:focus,
.toc-list a:focus,
.footer-link:focus,
.terms-back-to-top:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .terms-back-to-top,
  .nav-wrap {
    display: none !important;
  }
  
  .terms-of-service {
    background: white !important;
    padding: 0 !important;
  }
  
  .section-content {
    display: block !important; /* Revert grid for printing */
    grid-template-rows: auto !important;
    max-height: none !important;
    opacity: 1 !important;
    padding: 0 !important;
  }

  .section-content-inner {
    padding: 20px 0 !important;
    opacity: 1 !important;
  }
  
  .section-content.show {
    padding: 0 !important;
  }
}


/* Preload optimization for theme switch */
@media (max-width: 768px) {
  /* Predefine all possible color combinations to prevent flashing */
  .terms-header,
  .table-of-contents,
  .terms-content,
  .terms-section,
  .section-header {
    contain: layout style paint;
  }
  
  /* Force GPU acceleration on mobile for smoother transitions */
  .theme-switch,
  .theme-switch__track,
  .theme-switch__knob {
    transform: translateZ(0);
    will-change: transform, background-color;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .terms-of-service,
  .terms-of-service *,
  .theme-switch,
  .theme-switch * {
    animation: none !important;
    transition: none !important;
  }
  
  .terms-of-service::before {
    animation: none !important;
  
  }
}