/* ============================================
   GreenTax.in — Global Styles
   Clean, professional design system
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Primary — Rich green (eco/sustainability) */
  --color-primary: #16a34a;
  --color-primary-dark: #15803d;
  --color-primary-darker: #166534;
  --color-primary-light: #22c55e;
  --color-primary-50: #f0fdf4;
  --color-primary-100: #dcfce7;

  /* Secondary — Blue for EV pages */
  --color-secondary: #2563eb;
  --color-secondary-dark: #1d4ed8;
  --color-secondary-50: #eff6ff;

  /* Tertiary — Orange for green tax pages */
  --color-tertiary: #ea580c;
  --color-tertiary-dark: #c2410c;
  --color-tertiary-50: #fff7ed;

  /* Accent — Warm amber for CTAs and highlights */
  --color-accent: #f59e0b;
  --color-accent-dark: #d97706;
  --color-accent-light: #fbbf24;
  --color-accent-50: #fffbeb;

  /* Neutrals — warm off-whites to reduce eye strain */
  --color-text: #1a1a2e;
  --color-text-secondary: #3d3d5c;
  --color-text-muted: #7c7c9a;
  --color-text-light: #b5b5c9;
  --color-bg: #fafaf8;
  --color-bg-soft: #f4f3f0;
  --color-bg-muted: #eceae6;
  --color-border: #ddd9d2;
  --color-border-light: #eceae6;

  /* Dark sections */
  --color-dark: #0f172a;
  --color-dark-soft: #1e293b;

  /* Status */
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-warning: #ca8a04;
  --color-warning-bg: #fefce8;

  /* Typography */
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radii */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-3xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* Layout */
  --max-width: 1200px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ---------- Utility Classes ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .container { padding: 0 var(--space-6); }
}

@media (min-width: 1024px) {
  .container { padding: 0 var(--space-8); }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
}

.btn-accent {
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-accent:hover {
  background: var(--color-accent-dark);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-50);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1rem;
  border-radius: var(--radius-xl);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.8125rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Form Inputs ---------- */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #ffffff;
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

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

.input:disabled {
  background: var(--color-bg-muted);
  cursor: not-allowed;
}

.label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

/* ---------- Cards ---------- */
.card {
  background: #ffffff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border);
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
}

.badge-primary {
  background: var(--color-primary-50);
  color: var(--color-primary-dark);
}

.badge-accent {
  background: var(--color-accent-50);
  color: var(--color-accent-dark);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  padding: var(--space-4) 0;
  list-style: none;
}

.breadcrumb a {
  color: var(--color-text-muted);
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.breadcrumb .separator {
  color: var(--color-text-light);
}

.breadcrumb .current {
  color: var(--color-text);
  font-weight: 600;
}

/* ---------- Prose / Article Content ---------- */
.prose {
  max-width: 72ch;
  line-height: 1.85;
  color: var(--color-text-secondary);
  font-size: 1.0625rem;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--color-text);
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.prose h1 { font-size: 2.25rem; font-weight: 900; margin-top: 0; }
.prose h2 { font-size: 1.5rem; font-weight: 800; }
.prose h3 { font-size: 1.25rem; font-weight: 700; }

.prose p { margin-bottom: 1.25em; }

.prose a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: rgba(22, 163, 74, 0.3);
  text-underline-offset: 2px;
}
.prose a:hover {
  text-decoration-color: var(--color-primary);
}

.prose ul, .prose ol {
  padding-left: 1.5em;
  margin-bottom: 1.25em;
}

.prose li { margin-bottom: 0.5em; }

.prose strong {
  color: var(--color-text);
  font-weight: 700;
}

.prose blockquote {
  border-left: 3px solid var(--color-primary);
  padding: var(--space-4) var(--space-6);
  margin: 1.5em 0;
  background: var(--color-bg-soft);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  font-style: italic;
}

.prose .lead {
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

/* ---------- Grid Helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Section ---------- */
.section {
  padding: var(--space-16) 0;
}

.section-lg {
  padding: var(--space-24) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-header h2 {
  font-size: 1.875rem;
  font-weight: 900;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.section-header p {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  max-width: 640px;
  margin: 0 auto;
}

.section-header .accent-bar {
  width: 48px;
  height: 4px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  margin: var(--space-4) auto 0;
}

@media (min-width: 768px) {
  .section-header h2 {
    font-size: 2.25rem;
  }
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-2xl);
  background: #ffffff;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table-wrap th {
  padding: var(--space-4) var(--space-6);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  background: var(--color-bg-soft);
  border-bottom: 1px solid var(--color-border-light);
}

.table-wrap td {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

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

/* ---------- Alerts ---------- */
.alert {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
}

.alert-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid #bbf7d0;
}

.alert-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid #fecaca;
}

.alert-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid #fde68a;
}

/* ---------- Animations ---------- */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

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

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}

.animate-fade-in { animation: fade-in 0.25s ease-out forwards; }
.animate-fade-up { animation: fade-up 0.6s ease-out forwards; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-marquee { animation: marquee 30s linear infinite; }
.animate-ping { animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }

/* ---------- Dark Section ---------- */
.dark-section {
  background: var(--color-dark);
  color: #fff;
}

.dark-section h2, .dark-section h3 {
  color: #fff;
}

.dark-section p {
  color: #94a3b8;
}

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--color-border-light);
  border: none;
}

/* ---------- Live Indicator ---------- */
.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
}

.live-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-primary-light);
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.live-dot::after {
  content: '';
  position: relative;
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
}

/* ---------- Details/Accordion ---------- */
details {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  background: #ffffff;
  transition: box-shadow 0.2s;
}

details:hover {
  box-shadow: var(--shadow);
}

details summary {
  cursor: pointer;
  padding: var(--space-5) var(--space-6);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--color-text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details summary::-webkit-details-marker { display: none; }

details[open] summary {
  border-bottom: 1px solid var(--color-border-light);
}

details > div, details > p {
  padding: var(--space-4) var(--space-6) var(--space-5);
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* ---------- Responsive Visibility ---------- */
.hide-mobile { display: none; }
.hide-desktop { display: block; }

@media (min-width: 768px) {
  .hide-mobile { display: block; }
  .hide-desktop { display: none; }
}

/* Fix for inline-flex on desktop */
.hide-mobile-inline { display: none; }
@media (min-width: 768px) {
  .hide-mobile-inline { display: inline-flex; }
}

/* ---------- Spinner ---------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
