/* MyDriveScore Shared Styles */

:root {
  --deep-plum: #2D1B33;
  --rich-burgundy: #6B2D4D;
  --warm-coral: #E07A5F;
  --soft-cream: #FAF8F5;
  --muted-sage: #5A9A7A;
  --muted-sage-light: #81B29A;
  --light-sage: #E8F0EC;
  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-light: #666666;
  --border-light: rgba(45, 27, 51, 0.12);
  --bg-primary: #FAF8F5;
  --bg-secondary: #FFFFFF;
  --bg-nav: rgba(250, 248, 245, 0.95);
}

@media (prefers-color-scheme: dark) {
  :root {
    --deep-plum: #E8E4EA;
    --rich-burgundy: #D4A5B9;
    --warm-coral: #E07A5F;
    --soft-cream: #1A1A1A;
    --muted-sage: #81B29A;
    --muted-sage-light: #A5CBBA;
    --light-sage: #2A3A32;
    --text-primary: #F5F5F5;
    --text-secondary: #B8B8B8;
    --text-light: #8A8A8A;
    --border-light: rgba(255, 255, 255, 0.12);
    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-nav: rgba(18, 18, 18, 0.95);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 120px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Background Effects */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(107, 45, 77, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(224, 122, 95, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(129, 178, 154, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.grain {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 1000;
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-nav);
  backdrop-filter: blur(10px);
  z-index: 100;
  border-bottom: 1px solid var(--border-light);
}

.nav-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--deep-plum);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(45, 27, 51, 0.04);
}

.nav-link.active {
  color: var(--rich-burgundy);
  font-weight: 500;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-user-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.nav-user-name {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.nav-signout {
  font-size: 0.8125rem;
  color: var(--text-light);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-signout:hover {
  border-color: var(--text-light);
  color: var(--text-secondary);
}

/* Hamburger Menu Button */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  z-index: 10001;
  position: relative;
}

.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.3s ease;
  transform-origin: center;
}

/* Hamburger to X animation */
.nav-hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-hamburger.active span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation */
@media (max-width: 900px) {
  .nav-hamburger {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    background: var(--bg-primary);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .nav-links.active {
    opacity: 1;
    visibility: visible;
  }
  
  .nav-links .nav-link {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    padding: 1rem 2rem;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s ease;
  }
  
  .nav-links.active .nav-link {
    opacity: 1;
    transform: translateY(0);
  }
  
  /* Staggered animation for menu items */
  .nav-links.active .nav-link:nth-child(1) { transition-delay: 0.1s; }
  .nav-links.active .nav-link:nth-child(2) { transition-delay: 0.15s; }
  .nav-links.active .nav-link:nth-child(3) { transition-delay: 0.2s; }
  .nav-links.active .nav-link:nth-child(4) { transition-delay: 0.25s; }
  .nav-links.active .nav-link:nth-child(5) { transition-delay: 0.3s; }
  .nav-links.active .nav-link:nth-child(6) { transition-delay: 0.35s; }
  
  .nav-links .nav-link:hover {
    color: var(--warm-coral);
    background: transparent;
  }
  
  .nav-links .nav-link.active {
    color: var(--warm-coral);
  }
  
  /* Hide user name on mobile, keep photo and signout */
  .nav-user {
    z-index: 10001;
  }
  
  .nav-user-name {
    display: none;
  }
  
  /* Ensure nav stays above overlay */
  .nav {
    z-index: 10002;
  }
  
  /* Keep logo visible but allow hamburger interaction */
  .nav-logo {
    z-index: 10001;
  }
}

/* Dark mode mobile menu */
@media (max-width: 900px) and (prefers-color-scheme: dark) {
  .nav-links {
    background: var(--bg-primary);
  }
  
  .nav-links .nav-link {
    color: var(--text-primary);
  }
}

@media (max-width: 600px) {
  .nav-user-name { display: none; }
}

/* Prevent body scroll when menu is open */
body.menu-open {
  overflow: hidden;
}

/* Loading States */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--muted-sage);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Auth State Classes */
body:not(.auth-ready) .auth-required {
  display: none;
}

body.auth-ready .auth-loading {
  display: none;
}

/* Forms */
.form-input {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s ease;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--rich-burgundy);
  box-shadow: 0 0 0 3px rgba(107, 45, 77, 0.1);
}

.form-input::placeholder {
  color: var(--text-light);
}

/* Buttons */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 300px;
  padding: 0.875rem 1.5rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-google:hover {
  border-color: var(--text-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-google svg {
  width: 18px;
  height: 18px;
}

/* Waitlist */
.waitlist-note {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-top: 0.75rem;
}

.waitlist-success {
  color: var(--muted-sage);
}

.waitlist-error {
  color: var(--warm-coral);
}

/* Footer */
.footer {
  padding: 3rem 2rem;
  border-top: 1px solid var(--border-light);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--deep-plum);
}

.footer-links {
  display: flex;
  gap: 2rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--rich-burgundy);
}

.footer-copy {
  font-size: 0.8125rem;
  color: var(--text-light);
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.fade-in { opacity: 0; animation: fadeIn 0.8s ease-out forwards; }
.fade-up { opacity: 0; animation: fadeUp 0.8s ease-out forwards; }
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }
.delay-5 { animation-delay: 1s; }

/* Content Pages */
.page-header {
  padding: 8rem 2rem 3rem;
  max-width: 900px;
  margin: 0 auto;
}

.page-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.page-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
}

.page-meta {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-top: 1.5rem;
}

.page-content {
  padding: 0 2rem 4rem;
  max-width: 900px;
  margin: 0 auto;
}

/* Content Cards */
.content-section {
  margin-bottom: 4rem;
}

.content-section-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.content-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.content-card h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.content-card p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.content-card p:last-child {
  margin-bottom: 0;
}

.content-card ul, .content-card ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.content-card li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.content-card strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* Comparison Tables */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}

.comparison-table th,
.comparison-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.comparison-table th {
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.comparison-table td {
  color: var(--text-secondary);
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

/* Quick Answer Box */
.quick-answer {
  background: var(--light-sage);
  border-left: 4px solid var(--muted-sage);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 0 8px 8px 0;
}

.quick-answer-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-sage);
  margin-bottom: 0.5rem;
}

.quick-answer p {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* CTA Box */
.cta-box {
  background: var(--light-sage);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  margin-top: 3rem;
}

.cta-box p {
  font-size: 1.0625rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.cta-box .btn {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 1rem 2rem;
  background: var(--muted-sage);
  color: white;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.cta-box .btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

@media (prefers-color-scheme: dark) {
  .cta-box .btn {
    color: #1A1A1A;
  }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .nav { padding: 1rem 1.5rem; }
  .page-header { padding: 7rem 1.5rem 2rem; }
  .page-content { padding: 0 1.5rem 3rem; }
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--warm-coral);
  width: 0%;
  z-index: 10003;
  transition: width 0.1s ease-out;
}

/* Page Header - Centered for card pages */
.page-header.centered {
  text-align: center;
}

.page-header.centered .page-subtitle {
  margin: 0 auto;
}

/* Topic Card Grid */
.card-section {
  padding: 2rem 2rem 4rem;
  max-width: 1000px;
  margin: 0 auto;
}

.card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.topic-card {
  background: var(--bg-secondary);
  padding: 2rem;
  border: 1px solid var(--border-light);
  border-top: 4px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  width: calc(33.333% - 1rem);
  min-width: 280px;
  max-width: 320px;
  text-decoration: none;
}

.topic-card:hover {
  border-top-color: var(--warm-coral);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(45, 27, 51, 0.12);
}

.topic-card h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--text-primary);
  transition: color 0.25s ease;
}

.topic-card:hover h3 {
  color: var(--warm-coral);
}

.topic-card p {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-top: 1rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.topic-card:hover p {
  max-height: 100px;
  opacity: 1;
}

.topic-card .card-cta {
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--warm-coral);
  margin-top: 1rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.topic-card:hover .card-cta {
  max-height: 30px;
  opacity: 1;
}

/* Mobile: reveal cards on scroll into view */
@media (max-width: 900px) {
  .topic-card.in-view {
    border-top-color: var(--warm-coral);
  }
  
  .topic-card.in-view h3 {
    color: var(--warm-coral);
  }
  
  .topic-card.in-view p {
    max-height: 100px;
    opacity: 1;
  }
  
  .topic-card.in-view .card-cta {
    max-height: 30px;
    opacity: 1;
  }
}

/* 2-card layout for privacy page */
.card-grid.two-cards .topic-card {
  width: calc(50% - 1rem);
  max-width: 400px;
}

/* Content Sections with Navigation */
.article-section {
  padding: 4rem 2rem;
  max-width: 800px;
  margin: 0 auto;
  border-top: 1px solid var(--border-light);
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--warm-coral);
  margin-bottom: 0.75rem;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.content-body p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.content-body ul, .content-body ol {
  margin: 1rem 0 1.5rem 1.5rem;
}

.content-body li {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.content-body strong {
  color: var(--text-primary);
  font-weight: 500;
}

.content-body a {
  color: var(--rich-burgundy);
  text-decoration: none;
  border-bottom: 1px solid rgba(107, 45, 77, 0.3);
  transition: border-color 0.2s ease;
}

.content-body a:hover {
  border-bottom-color: var(--rich-burgundy);
}

/* Section Navigation */
.section-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.section-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.section-nav-btn:hover {
  border-color: var(--warm-coral);
  color: var(--warm-coral);
}

.section-nav-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.section-nav-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  display: block;
  margin-bottom: 0.125rem;
}

.section-nav-title {
  font-weight: 500;
  color: var(--text-primary);
}

.section-nav-btn:hover .section-nav-title {
  color: var(--warm-coral);
}

/* Back to Top */
.back-to-top {
  text-align: center;
  margin-top: 3rem;
}

.back-to-top a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-to-top a:hover {
  color: var(--warm-coral);
}

/* FAQ Accordion */
.faq-item {
  border-bottom: 1px solid var(--border-light);
}

.faq-question {
  width: 100%;
  padding: 1.25rem 0;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s ease;
}

.faq-question:hover {
  color: var(--warm-coral);
}

.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-light);
  transition: transform 0.3s ease;
}

.faq-item.active .faq-question::after {
  content: '−';
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.active .faq-answer {
  max-height: 500px;
  padding-bottom: 1.25rem;
}

.faq-answer p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* Card Grid Responsive */
@media (max-width: 700px) {
  .topic-card {
    width: 100%;
    max-width: 400px;
  }
  
  .card-grid.two-cards .topic-card {
    width: 100%;
  }
  
  .section-nav {
    flex-direction: column;
    gap: 1rem;
  }
  
  .section-nav-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (min-width: 701px) and (max-width: 1000px) {
  .topic-card {
    width: calc(50% - 1rem);
  }
}
