:root {
  --color-primary: #006400; /* Dark Green */
  --color-primary-dark: #004d00;
  --color-secondary: #1E40AF; /* Blue */
  --color-secondary-dark: #1E3A8A;
  --color-danger: #B91C1C; /* Red */
  --color-danger-dark: #991B1B;
  --color-neutral: #6B7280; /* Medium Gray */
  --color-neutral-dark: #4B5563;
  --color-text-dark: #111827; /* Near Black */
  --color-text-body: #374151; /* Dark Gray */
  --color-text-light: #6B7280; /* Medium Gray */
  --color-bg-light: #f9fafb; /* Very Light Gray */
  --color-bg-white: #ffffff;
  --color-border: #e5e7eb; /* Light Gray Border */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --side-padding: 1rem;
}
@media (min-width: 769px) { :root { --side-padding: 1.5rem; } }

/* Base Reset & Smooth Scroll */
html, body { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  margin: 0;
  background: var(--color-bg-light);
  color: var(--color-text-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.65;
  padding: 0 var(--side-padding);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
*, *::before, *::after { box-sizing: border-box; }

/* --- Hero Section --- */
.hero-section {
  display: flex; align-items: center; text-align: center;
  padding: 4rem 1rem;
  background-color: #e8f5e9; /* Light green */
  border-bottom: 1px solid var(--color-border);
  margin: 0 calc(-1 * var(--side-padding));
  margin-bottom: 2rem;
}
.hero-content { max-width: 800px; margin: 0 auto; padding: 0 1rem; }
.hero-content h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  color: var(--color-text-dark);
  font-weight: 700; margin: 0 0 1rem 0; line-height: 1.25;
  border: none; padding: 0;
}
.hero-content p {
  font-size: 1.15rem; font-weight: 400; color: var(--color-text-body);
  margin: 0 0 1.75rem 0;
}

/* --- Hero Buttons --- */
.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* --- Main Container & Typography --- */
.main-container {
  max-width: 1000px;
  margin: 0 auto;
  padding-bottom: 3rem;
  flex-grow: 1;
  width: 100%;
}
h1, h2, h3 { color: var(--color-text-dark); font-weight: 600; }
h1 { text-align: center; margin-top: 0; }
h2 { margin-top: 1rem; }
h3 { margin-top: 25px; border-bottom: none; font-size: 1.2em; }

/* --- Card Layout --- */
.card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-top: 1.5rem;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.card-header h2 {
  margin: 0; padding: 0; border: none;
  font-size: 1.5rem; line-height: 1.25;
}
.card-body { padding: 1.5rem; }

/* --- Inputs, Selects, Textareas --- */
input[type="text"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.6;
}
textarea:focus, input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 100, 0, 0.15);
}
textarea { min-height: 200px; resize: vertical; }
select { background-color: var(--color-bg-white); }
label {
  display: block;
  font-weight: 500;
  color: var(--color-text-dark);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* --- Button System (pill / curved) --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;            /* no !important here */
  border: 1px solid transparent;
  border-radius: 9999px !important;  /* curved buttons everywhere */
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:disabled { background: #D1D5DB; color: var(--color-text-light); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-secondary { background: var(--color-secondary); border-color: var(--color-secondary); }
.btn-secondary:hover:not(:disabled) { background: var(--color-secondary-dark); border-color: var(--color-secondary-dark); }
.btn-danger { background: var(--color-danger); border-color: var(--color-danger); }
.btn-danger:hover:not(:disabled) { background: var(--color-danger-dark); border-color: var(--color-danger-dark); }
.btn-neutral { background: var(--color-neutral); border-color: var(--color-neutral); }
.btn-neutral:hover:not(:disabled) { background: var(--color-neutral-dark); border-color: var(--color-neutral-dark); }

/* Outline buttons must be white bg + green text (works for <a> and <button>) */
.btn-outline,
.btn-outline:link,
.btn-outline:visited {
  background: var(--color-bg-white) !important;
  color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}
.btn-outline:hover:not(:disabled),
.btn-outline:focus-visible {
  background: #f0fdf4 !important;
  color: var(--color-primary-dark) !important;
  border-color: var(--color-primary-dark) !important;
}
.btn-outline svg { fill: currentColor; } /* icons follow text color */

.button-group { display: flex; flex-wrap: wrap; gap: 10px; }

/* Ensure hero "How It Works" outline btn & example preset buttons are white + green */
.hero-buttons .btn.btn-outline,
#example-buttons .btn.btn-outline,
.hero-buttons .btn.btn-outline:link,
#example-buttons .btn.btn-outline:link,
.hero-buttons .btn.btn-outline:visited,
#example-buttons .btn.btn-outline:visited {
  background: #ffffff !important;
  color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}
#example-buttons .btn.btn-outline:hover:not(:disabled),
.hero-buttons .btn.btn-outline:hover:not(:disabled) {
  background: #f0fdf4 !important;
  color: var(--color-primary-dark) !important;
  border-color: var(--color-primary-dark) !important;
}

/* --- Analyze Button --- */
.analyze-button-container { margin-top: 1.5rem; text-align: center; }
#analyzeButton { padding: 12px 28px; font-size: 1rem; font-weight: 700; }

/* --- Loading Spinner --- */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
#analyzeButton.btn-loading .spinner { display: inline-block; }
#analyzeButton .btn-icon { display: inline-flex; align-items: center; }
#analyzeButton.btn-loading .btn-icon { display: none; }
#analyzeButton .spinner + .btn-text { margin-left: 8px; }
#analyzeButton .btn-icon + .btn-text { margin-left: 8px; }
#analyzeButton.btn-loading .btn-text { display: inline-block; }

/* --- Checkbox Options --- */
.options-container { margin-top: 1.5rem; }
.checkbox-item { display: flex; align-items: center; }
.checkbox-item input[type="checkbox"] {
  width: auto; margin-right: 8px;
  accent-color: var(--color-primary);
  height: 16px; width: 16px;
}
.checkbox-item label { margin-bottom: 0; font-weight: 400; color: var(--color-text-body); }

/* --- Error Handling --- */
.error-message {
  color: var(--color-danger);
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
  margin-top: 5px;
}

/* --- Analysis Summary Card --- */
.summary-card { margin-bottom: 1.5rem; }
.summary-card .card-header { padding: 1.25rem 1.5rem; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
}
.summary-item {
  background-color: var(--color-bg-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--color-border);
}
.summary-item-label {
  font-size: 0.9rem; font-weight: 500; color: var(--color-text-light);
  margin-bottom: 0.5rem; display: block;
}
.summary-item-value {
  font-size: 1.5rem; font-weight: 700; color: var(--color-primary);
  word-break: break-word;
}
.summary-item-value.dark { color: var(--color-text-dark); }
.summary-item-value.small { font-size: 1.1rem; color: var(--color-text-body); }

/* --- Dashboard & Results --- */
#results-area { margin-top: 2rem; padding-top: 2rem; border-top: 1px dashed var(--color-border); }
#resultsTitle {
  font-size: 1.5rem; font-weight: 600; color: var(--color-text-dark);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.75rem; margin-top: 0; margin-bottom: 1rem;
}
.results-header {
  display: flex; justify-content: flex-end; align-items: center;
  flex-wrap: wrap; gap: 15px; margin-bottom: 1.5rem;
}

/* --- Table Styles --- */
#resultsTableContainer {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--color-bg-white);
}
table { width: 100%; border-collapse: collapse; }
th, td {
  border-bottom: 1px solid var(--color-border);
  padding: 14px 16px;
  text-align: left;
  font-size: 0.9rem;
  word-break: normal;
  overflow-wrap: break-word;
  vertical-align: middle;
}
th {
  background-color: var(--color-bg-light);
  font-weight: 600; color: var(--color-text-dark);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background-color: #f0fdf4; }

table th:nth-child(1) { width: 5%; }
table th:nth-child(2) { width: 5%; }
table th:nth-child(3) { width: 5%; }
table th:nth-child(5) { width: 20%; }
table th:nth-child(6) { width: 15%; }
table th:nth-child(9) { width: 20%; }

.status-match   { color: var(--color-primary); font-weight: 600; }
.status-mismatch{ color: var(--color-danger);  font-weight: 600; }
.status-partial { color: #B45309; font-weight: 600; }

/* Laghu/Guru Visualization */
.lg-viz { font-family: monospace; font-size: 1.1rem; letter-spacing: 1px; white-space: pre; }
.lg-viz .l { color: var(--color-text-light); }
.lg-viz .g { color: var(--color-text-dark); font-weight: 700; }
.lg-viz .sep { color: var(--color-border); }

.hidden { display: none; }

/* --- Footer/Info Section Styles --- */
#how-it-works { margin-top: 3rem; }
#how-it-works .card-header h2 {
  font-size: 1.5rem; font-weight: 600; color: var(--color-text-dark);
  border-bottom: none; padding-bottom: 0; margin-top: 0; margin-bottom: 0;
}
#how-it-works .card-body p,
#how-it-works .card-body li {
  font-size: 1rem; line-height: 1.7; color: var(--color-text-body); word-break: break-word;
}
#how-it-works .card-body ol,
#how-it-works .card-body ul { padding-left: 1.5rem; margin-left: 0; }
#how-it-works .card-body li { margin-bottom: 0.5rem; }
#how-it-works .card-body ul { margin-top: 0.5rem; margin-bottom: 0.5rem; }
#how-it-works .card-body li ul { margin-top: 0.5rem; }
#how-it-works .card-body a {
  color: var(--color-primary); text-decoration: none; font-weight: 500; transition: color 0.2s;
}
#how-it-works .card-body a:hover { color: var(--color-primary-dark); text-decoration: underline; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .results-header { flex-direction: column; align-items: stretch; }
  .results-header .button-group { justify-content: flex-end; }
}
@media (max-width: 480px) {
  .results-header .button-group { flex-wrap: nowrap; width: 100%; }
  .results-header .btn { flex-grow: 1; }
  .hero-section { padding: 2.5rem 1rem; }
  .hero-content p { font-size: 1rem; }
  .card-body { padding: 1rem; }
  .card-header { padding: 1rem; }
  .card-header h2 { font-size: 1.25rem; }
  .summary-grid { padding: 1rem; gap: 1rem; }
  table th, table td { padding: 10px 8px; font-size: 0.85rem; }
  .analyze-button-container .button-group { flex-direction: column; }
  .hero-buttons { flex-direction: column; }
}
/* ===== Fix button colors for GitHub Pages ===== */

/* Get Started – solid green, curved */
.hero-buttons .btn.btn-primary {
  background:#006400 !important;
  border-color:#006400 !important;
  color:#ffffff !important;
  border-radius:9999px !important;
}
.hero-buttons .btn.btn-primary:hover {
  background:#004d00 !important;
  border-color:#004d00 !important;
}

/* How It Works – white bg, green border, normal corners */
.hero-buttons .btn.btn-outline {
  background:#ffffff !important;
  color:#006400 !important;
  border:2px solid #006400 !important;
  border-radius:6px !important; /* not curved */
}
.hero-buttons .btn.btn-outline:hover {
  background:#f0fdf4 !important;
  color:#004d00 !important;
  border-color:#004d00 !important;
}

/* Example buttons (Anushtubh etc.) – white bg, curved green border */
#example-buttons .btn.btn-outline {
  background:#ffffff !important;
  color:#006400 !important;
  border:2px solid #006400 !important;
  border-radius:9999px !important; /* curved */
}
#example-buttons .btn.btn-outline:hover {
  background:#f0fdf4 !important;
  color:#004d00 !important;
  border-color:#004d00 !important;
}
