/* ==========================================================================
   ScanAIPro - Tithe & Offering Calculator Modern Production Design System
   ========================================================================== */

:root {
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-600: #475569;
  --slate-800: #1e293b;
  --white: #ffffff;
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 10px 10px -5px rgba(15, 23, 42, 0.06);
}

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

html {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.6;
  color: var(--slate-800);
  background-color: var(--slate-50);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Accessibility: Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 10000;
  background: var(--amber-500);
  color: var(--navy-900);
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid var(--navy-900);
}

/* Container */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Nav */
.site-header {
  background: var(--navy-900);
  color: var(--white);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-logo span {
  color: var(--amber-500);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--slate-200);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav-links a:hover, .nav-links a:focus {
  color: var(--amber-500);
}

.language-switch {
  display: flex;
  background: var(--navy-800);
  padding: 3px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--slate-200);
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--amber-500);
  color: var(--navy-900);
}

/* Breadcrumbs */
.breadcrumb-bar {
  background: var(--slate-100);
  padding: 0.6rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--slate-200);
}

.breadcrumb-list {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  color: var(--slate-600);
}

.breadcrumb-list a {
  color: var(--slate-600);
  text-decoration: none;
}

.breadcrumb-list a:hover {
  color: var(--navy-900);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--slate-400);
}

/* Hero Section */
.hero-section {
  padding: 3rem 0 2rem 0;
  background: linear-gradient(180deg, var(--slate-100) 0%, var(--slate-50) 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  background: var(--amber-100);
  color: var(--amber-600);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.hero-title {
  font-size: 2.5rem;
  line-height: 1.15;
  font-weight: 900;
  color: var(--navy-900);
  letter-spacing: -0.03em;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--slate-600);
  max-width: 520px;
}

.hero-media {
  text-align: center;
}

.hero-image {
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  object-fit: cover;
  border: 4px solid var(--white);
}

/* Main Tool Zone */
.tool-section {
  padding: 1.5rem 0 3rem 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: start;
}

.calculator-card, .results-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--slate-200);
}

.card-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--navy-900);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy-800);
  margin-bottom: 0.4rem;
}

.input-row {
  display: flex;
  gap: 0.75rem;
}

.form-control, .form-select {
  width: 100%;
  min-height: 50px;
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
  font-family: inherit;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background-color: var(--slate-50);
  color: var(--navy-900);
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--amber-500);
  background-color: var(--white);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}

.form-control.input-error {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.error-text {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  display: none;
  font-weight: 600;
}

/* Range Slider */
.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--slate-200);
  outline: none;
  accent-color: var(--amber-500);
}

.slider-val-badge {
  background: var(--navy-900);
  color: var(--amber-500);
  font-weight: 800;
  padding: 0.3rem 0.75rem;
  border-radius: 12px;
  font-size: 0.95rem;
  min-width: 55px;
  text-align: center;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--amber-500);
}

/* Buttons */
.btn-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 50px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--amber-500);
  color: var(--navy-900);
  flex: 2;
}

.btn-primary:hover, .btn-primary:focus {
  background: var(--amber-600);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--slate-200);
  color: var(--slate-700);
  flex: 1;
}

.btn-outline:hover, .btn-outline:focus {
  background: var(--slate-100);
  border-color: var(--slate-300);
}

.btn-whatsapp {
  background: var(--emerald-600);
  color: var(--white);
}

.btn-whatsapp:hover, .btn-whatsapp:focus {
  background: var(--emerald-700);
}

/* Result Breakdown */
.results-card {
  background: var(--navy-900);
  color: var(--white);
  border: none;
}

.results-card .card-title {
  color: var(--white);
  border-bottom: 1px solid var(--navy-800);
  padding-bottom: 0.75rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.result-row.total-row {
  border-bottom: 2px dashed var(--amber-500);
  margin-top: 0.5rem;
  padding-top: 1rem;
}

.result-label {
  font-size: 0.95rem;
  color: var(--slate-200);
}

.total-row .result-label {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--amber-500);
}

.result-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--white);
}

.total-row .result-value {
  font-size: 1.6rem;
  color: var(--amber-500);
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.result-actions .btn {
  font-size: 0.85rem;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
}

.disclaimer-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 1.25rem;
  line-height: 1.4;
}

/* History Drawer */
.history-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--slate-200);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.history-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy-800);
}

.btn-link {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-card {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-card:hover {
  background: var(--amber-100);
  border-color: var(--amber-500);
}

.history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--slate-600);
}

.history-giving {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-top: 0.2rem;
  color: var(--navy-900);
}

.history-empty {
  font-size: 0.85rem;
  color: var(--slate-600);
  font-style: italic;
}

/* AI Stewardship Banner */
.ai-banner {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 100%);
  border: 2px solid var(--amber-500);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2.5rem 0;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-md);
}

.ai-banner-content {
  max-width: 650px;
}

.ai-banner-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--amber-500);
  margin-bottom: 0.5rem;
}

.ai-banner-sub {
  color: var(--slate-200);
  font-size: 1rem;
}

/* AI Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: var(--navy-900);
  color: var(--white);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--amber-500);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ai-prompts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ai-prompt-chip {
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  padding: 0.5rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-800);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-prompt-chip:hover {
  background: var(--amber-100);
  border-color: var(--amber-500);
  color: var(--navy-900);
}

.ai-input-row {
  display: flex;
  gap: 0.5rem;
}

.ai-response-card {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: none;
}

.ai-response-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--navy-900);
}

.ai-loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--amber-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* FAQ Strip */
.faq-section {
  padding: 3rem 0;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
}

.section-title {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--navy-900);
  text-align: center;
  margin-bottom: 2rem;
}

.faq-accordion {
  max-width: 850px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 1.25rem 1.5rem;
  background: var(--slate-50);
  border: none;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy-900);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.faq-answer {
  padding: 1.25rem 1.5rem;
  background: var(--white);
  font-size: 0.95rem;
  color: var(--slate-600);
  line-height: 1.6;
  border-top: 1px solid var(--slate-200);
}

/* Educational Article & Tables */
.article-section {
  padding: 4rem 0;
  background: var(--slate-50);
}

.article-container {
  max-width: 850px;
  margin: 0 auto;
  background: var(--white);
  padding: 3rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.article-table th {
  background: var(--navy-900);
  color: var(--white);
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 700;
}

.article-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--slate-200);
  color: var(--slate-700);
}

.article-table tr:nth-child(even) {
  background: var(--slate-50);
}

.eeat-badge-box {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: var(--slate-100);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  font-size: 0.85rem;
  border-left: 4px solid var(--amber-500);
}

.eeat-item strong {
  color: var(--navy-900);
}

.toc-box {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
}

.toc-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-900);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: decimal;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-list a {
  color: var(--amber-600);
  text-decoration: none;
  font-weight: 600;
}

.toc-list a:hover {
  text-decoration: underline;
}

.article-content h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--navy-900);
  margin: 2rem 0 1rem 0;
}

.article-content p {
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
  color: var(--slate-700);
  line-height: 1.7;
}

.swahili-glossary-box {
  background: #fffbeb;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin: 2rem 0;
}

.glossary-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--amber-600);
  margin-bottom: 0.75rem;
}

/* Related Tools */
.related-section {
  padding: 3rem 0;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
}

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

.tool-link-card {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.tool-link-card:hover {
  transform: translateY(-2px);
  border-color: var(--amber-500);
  box-shadow: var(--shadow-md);
}

.tool-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy-900);
  margin-bottom: 0.4rem;
}

.tool-card-desc {
  font-size: 0.85rem;
  color: var(--slate-600);
}

/* Footer */
.site-footer {
  background: var(--navy-900);
  color: var(--slate-400);
  padding: 3rem 0 2rem 0;
  margin-top: auto;
  font-size: 0.9rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  list-style: none;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--navy-800);
}

.footer-nav a {
  color: var(--slate-200);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--amber-500);
}

.footer-copyright {
  text-align: center;
  font-size: 0.85rem;
}

/* Sticky Mobile Bar */
.sticky-mobile-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy-900);
  border-top: 3px solid var(--amber-500);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 8888;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
}

.sticky-mobile-bar.visible {
  transform: translateY(0);
}

.sticky-info {
  display: flex;
  flex-direction: column;
}

.sticky-title {
  font-size: 0.75rem;
  color: var(--slate-400);
}

.sticky-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--amber-500);
}

.sticky-actions {
  display: flex;
  gap: 0.5rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--navy-900);
  color: var(--amber-500);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--amber-500);
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  z-index: 99999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .hero-grid, .tool-grid {
    grid-template-columns: 1fr;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .ai-banner {
    flex-direction: column;
    text-align: center;
  }
  
  .article-container {
    padding: 1.5rem;
  }
}

@media (max-width: 600px) {
  .main-nav .nav-links {
    display: none;
  }
  
  .result-actions {
    grid-template-columns: 1fr;
  }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Clean Print Stylesheet */
@media print {
  .site-header, .breadcrumb-bar, .ai-banner, .sticky-mobile-bar, .btn-group, .language-switch, .history-section, .related-section, .site-footer {
    display: none !important;
  }
  
  body {
    background: #fff !important;
    color: #000 !important;
  }
  
  .results-card {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
  }
  
  .result-label, .result-value {
    color: #000 !important;
  }
}
