/* ========================================
   KALOSCAN — Main Stylesheet
   Emerald health theme
   ======================================== */

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

:root {
  /* Emerald palette */
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-300: #6ee7b7;
  --primary-400: #34d399;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  --primary-800: #065f46;
  --primary-900: #064e3b;

  --text-heading: #1a2e1a;
  --text-body: #374151;
  --text-muted: #6b7280;
  --text-light: #9ca3af;

  --bg-white: #ffffff;
  --bg-light: #f5faf7;
  --bg-section: #f0fdf4;

  --border: #e5e7eb;
  --border-light: #f3f4f6;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.1), 0 8px 20px rgba(0,0,0,0.06);
  --shadow-primary: 0 8px 24px rgba(16,185,129,0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-body);
  background: var(--bg-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* --- Typography --- */
h1, h2, h3, h4 {
  color: var(--text-heading);
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 1vw + 1.8rem, 3.5rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 1vw + 1rem, 2.5rem); font-weight: 700; letter-spacing: -0.015em; }
h3 { font-size: clamp(1.1rem, 1vw + 0.6rem, 1.5rem); font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-600);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  background: var(--primary-700);
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(16,185,129,0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--primary-700);
  border: 1.5px solid var(--primary-200);
}

.btn-ghost:hover {
  background: var(--primary-50);
  border-color: var(--primary-400);
}

.btn-white {
  background: white;
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

.btn-white:hover {
  background: var(--primary-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Badge / Pill --- */
.badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--primary-100);
  color: var(--primary-700);
  margin-bottom: 16px;
}

/* ========================================
   HEADER
   ======================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-heading);
}

.logo-icon {
  font-size: 1.5rem;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
  position: relative;
}

.nav-links a:hover {
  color: var(--primary-600);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-selector select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--bg-white);
  color: var(--text-body);
  cursor: pointer;
  font-family: inherit;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--text-heading);
  border-radius: 2px;
  transition: all 0.3s;
}

.mobile-menu {
  display: none;
  background: white;
  border-top: 1px solid var(--border-light);
  padding: 16px 24px;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-menu a, .mobile-menu button {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  display: block;
  width: 100%;
  text-align: left;
}

.mobile-menu a:hover {
  background: var(--bg-section);
}

.btn-mobile-cta {
  text-align: center !important;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
  padding: 140px 0 100px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(16,185,129,0.07) 0%, transparent 70%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(16,185,129,0.05) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 {
  max-width: 800px;
  margin: 0 auto 20px;
}

.hero p {
  font-size: clamp(1rem, 1vw + 0.5rem, 1.2rem);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.hero-trust {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hero-trust::before {
  content: '✓';
  color: var(--primary-500);
  font-weight: 700;
}

/* Mockup placeholder */
.hero-mockup {
  margin: 60px auto 0;
  max-width: 900px;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-section) 0%, var(--primary-50) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--primary-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--primary-400);
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
}

.hero-mockup::after {
  content: '📱  App Preview';
  font-size: 1.5rem;
  opacity: 0.5;
}

/* ========================================
   HOW IT WORKS
   ======================================== */
.section {
  padding: 100px 0;
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 60px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: 12px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.step-card {
  text-align: center;
  padding: 40px 24px;
}

.step-icon {
  font-size: 3rem;
  margin-bottom: 24px;
  display: block;
}

.step-card h3 {
  margin-bottom: 12px;
}

.step-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary-600);
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 50%;
  margin-bottom: 20px;
}

/* ========================================
   FEATURES
   ======================================== */
.feature-subtitle {
  font-size: 1.2rem;
  color: var(--text-heading);
  font-weight: 600;
  margin: 60px 0 0;
  padding-top: 40px;
  border-top: 1px solid var(--border-light);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.feature-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  transition: all 0.3s ease;
}

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

.feature-icon {
  font-size: 2.2rem;
  margin-bottom: 20px;
  display: block;
}

.feature-card h3 {
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

/* ========================================
   STATS
   ======================================== */
.stats-section {
  background: var(--primary-800);
  padding: 80px 0;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.stat-item {}

.stat-number {
  font-size: clamp(2rem, 1vw + 1.5rem, 3rem);
  font-weight: 800;
  color: var(--primary-300);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--primary-100);
  margin-top: 8px;
  opacity: 0.8;
}

/* ========================================
   TESTIMONIALS
   ======================================== */
.testimonials-section {
  background: var(--bg-section);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.testimonial-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  transition: all 0.3s ease;
}

.testimonial-card:hover {
  box-shadow: var(--shadow-md);
}

.testimonial-quote {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-body);
  margin-bottom: 24px;
  font-style: italic;
  position: relative;
  padding-left: 24px;
  border-left: 3px solid var(--primary-300);
}

.testimonial-author h4 {
  margin-bottom: 4px;
  font-size: 1rem;
}

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

/* ========================================
   PRICING
   ======================================== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: start;
}

.pricing-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
}

.pricing-card:hover {
  box-shadow: var(--shadow-md);
}

.pricing-card.highlighted {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-xl), 0 0 0 1px var(--primary-400);
  transform: scale(1.03);
}

.pricing-card.highlighted::before {
  content: attr(data-popular);
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-600);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: var(--radius-pill);
}

.pricing-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.pricing-price {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.1;
}

.pricing-price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.pricing-features {
  text-align: left;
  margin-bottom: 32px;
}

.pricing-features li {
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-body);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pricing-features li::before {
  content: '✓';
  color: var(--primary-500);
  font-weight: 700;
  font-size: 0.85rem;
}

.pricing-card .btn {
  width: 100%;
}

/* ========================================
   FAQ
   ======================================== */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

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

.faq-question {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 24px 40px 24px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.5;
  position: relative;
  transition: color 0.2s;
}

.faq-question:hover {
  color: var(--primary-700);
}

.faq-question::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--primary-400);
  font-weight: 300;
  transition: opacity 0.3s;
}

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

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

.faq-answer p {
  padding-bottom: 24px;
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

.faq-item.open .faq-answer {
  max-height: 200px;
}

/* ========================================
   CTA SECTION
   ======================================== */
.cta-section {
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-900) 100%);
  padding: 100px 0;
  text-align: center;
  color: white;
}

.cta-section h2 {
  color: white;
  margin-bottom: 16px;
}

.cta-section p {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-bottom: 36px;
}

/* ========================================
   FOOTER
   ======================================== */
.site-footer {
  background: var(--bg-light);
  border-top: 1px solid var(--border-light);
  padding: 60px 0 30px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.footer-brand .logo {
  margin-bottom: 16px;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-col h4 {
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.footer-col li {
  margin-bottom: 10px;
}

.footer-col a {
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--primary-600);
}

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

/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  padding: 40px;
  margin: 16px;
  position: relative;
  animation: modalIn 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-light);
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-heading);
}

.modal h2 {
  margin-bottom: 28px;
  text-align: center;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-white);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.modal .btn {
  width: 100%;
  margin-top: 8px;
}

.modal-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.modal-switch a {
  color: var(--primary-600);
  font-weight: 600;
  cursor: pointer;
}

.modal-switch a:hover {
  color: var(--primary-800);
  text-decoration: underline;
}

/* Auth error message inside modal */
.auth-error-msg {
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  text-align: center;
  display: none;
}

/* Trial modal info text */
.trial-info {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 8px;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Trial success message */
.modal-success {
  text-align: center;
  padding: 24px 0;
}

.modal-success .success-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.modal-success h3 {
  color: var(--primary-600);
  margin-bottom: 8px;
}

/* User badge in header when logged in */
.user-badge {
  color: var(--text-heading) !important;
  font-weight: 600 !important;
  cursor: default !important;
  border-color: var(--primary-300) !important;
}

/* Logout button */
#btn-logout {
  border-color: #fecaca !important;
  color: #dc2626 !important;
}
#btn-logout:hover {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .pricing-card.highlighted {
    transform: scale(1);
  }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-actions .btn { display: none; }
  .hamburger { display: flex; }

  .steps-grid,
  .features-grid,
  .testimonials-grid,
  .pricing-grid,
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .hero {
    padding: 120px 0 60px;
  }

  .section {
    padding: 60px 0;
  }

  .cta-section {
    padding: 60px 0;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
