/* ==========================================================================
   Committee / Kameti Calculator — World-Class Production CSS Engine
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Nastaliq+Urdu:wght@400;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-dark: #070d14;
  --bg-card: #0f1926;
  --bg-card-hover: #162436;
  --border-color: rgba(255, 255, 255, 0.12);
  --border-gold: rgba(245, 158, 11, 0.4);
  
  --primary-emerald: #10b981;
  --primary-emerald-glow: rgba(16, 185, 129, 0.35);
  --accent-gold: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-danger: #ef4444;
  
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-urdu: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Inter', serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-glow: 0 0 40px rgba(16, 185, 129, 0.2);
  --shadow-card: 0 12px 35px -5px rgba(0, 0, 0, 0.55);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: rgba(0, 0, 0, 0.12);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Reduced Motion Support for 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;
  }
}

/* WCAG 2.2 AA Focus Rings & Accessibility Utilities */
:focus-visible {
  outline: 3px solid var(--primary-emerald);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--primary-emerald);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  z-index: 9999;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

.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;
}

/* RTL Support for Urdu */
[dir="rtl"] {
  font-family: var(--font-urdu), var(--font-sans);
  text-align: right;
}
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 {
  font-family: var(--font-urdu), var(--font-heading);
  line-height: 1.8;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 13, 20, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 0;
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.92);
}

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

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  min-height: 44px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 14px var(--primary-emerald-glow);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 0.25rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary-emerald);
}

.lang-toggle-btn, .theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle-btn {
  padding: 0.6rem;
  width: 44px;
}

.lang-toggle-btn:hover, .theme-toggle-btn:hover {
  border-color: var(--primary-emerald);
  box-shadow: 0 0 14px var(--primary-emerald-glow);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  padding: 3.5rem 0 2.5rem;
  position: relative;
}

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

@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--primary-emerald);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #ffffff 40%, #9ca3af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-title {
  background: linear-gradient(135deg, #0f172a 40%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[dir="rtl"] .hero-title {
  font-family: var(--font-urdu);
  font-size: 2.25rem;
  background: none;
  -webkit-text-fill-color: var(--text-main);
}

.hero-subheadline {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 580px;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  padding: 0.95rem 2.2rem;
  min-height: 48px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.6);
}

.hero-image-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-glow), var(--shadow-card);
}

.hero-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* ==========================================================================
   Calculator Container Widget
   ========================================================================== */
.calculator-section {
  padding: 2rem 0 3.5rem;
}

.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  transition: box-shadow 0.3s ease;
}

@media (max-width: 768px) {
  .calc-card {
    padding: 1.25rem;
  }
}

.mode-selector {
  display: flex;
  background: var(--bg-dark);
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  gap: 0.5rem;
}

.mode-tab {
  flex: 1;
  padding: 0.85rem 1rem;
  min-height: 48px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.mode-tab.active {
  background: var(--primary-emerald);
  color: #ffffff;
  box-shadow: 0 4px 15px var(--primary-emerald-glow);
}

.inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-control {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.85rem 1rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--primary-emerald);
  box-shadow: 0 0 10px var(--primary-emerald-glow);
}

.bidding-inputs-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.bidding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

/* Key Metrics Cards */
.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  position: relative;
  transition: transform 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
}

.metric-card.accent-green { border-bottom: 3px solid var(--primary-emerald); }
.metric-card.accent-gold { border-bottom: 3px solid var(--accent-gold); }
.metric-card.accent-blue { border-bottom: 3px solid var(--accent-blue); }

.metric-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Results Table with Sticky Header & Zebra Rows */
.table-responsive {
  width: 100%;
  max-height: 520px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  transition: opacity 0.2s ease;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

[dir="rtl"] .results-table {
  text-align: right;
}

.results-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #09121d;
  color: var(--text-muted);
  padding: 1rem;
  font-weight: 700;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

[data-theme="light"] .results-table th {
  background: #f1f5f9;
}

.results-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
}

.results-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.results-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}

.badge-advance {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-saver {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-profit {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-loss {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.badge-even {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.text-green { color: #34d399; font-weight: 700; }
.text-red { color: #f87171; font-weight: 700; }
.text-blue { color: #60a5fa; font-weight: 700; }

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 1.25rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

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

.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary-emerald);
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  transition: opacity 0.3s ease;
}

[dir="rtl"] .toast-notification {
  right: auto;
  left: 2rem;
}

/* ==========================================================================
   Google AdSense Placement Units
   ========================================================================== */
.adsense-unit-wrapper {
  margin: 1.5rem 0;
  text-align: center;
  contain: layout;
  min-height: 90px;
}

.adsense-placeholder {
  min-height: 90px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 1rem;
}

/* ==========================================================================
   Mini How-To Guide
   ========================================================================== */
.how-to-section {
  padding: 3rem 0;
}

.section-heading {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 2.5rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  position: relative;
  transition: transform 0.2s;
}

.step-card:hover {
  transform: translateY(-4px);
}

.step-num {
  width: 42px;
  height: 42px;
  background: var(--primary-emerald);
  color: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
}

.step-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.step-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================================================
   SEO Article Section
   ========================================================================== */
.article-section {
  padding: 4rem 0;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.article-content {
  max-width: 900px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-muted);
}

.article-content h2 {
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  margin: 2.5rem 0 1rem;
}

.article-content p {
  margin-bottom: 1.25rem;
}

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

[dir="rtl"] .article-content ul, [dir="rtl"] .article-content ol {
  margin: 1rem 1.5rem 1.5rem 0;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.highlight-box {
  background: rgba(16, 185, 129, 0.08);
  border-left: 4px solid var(--primary-emerald);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
  color: var(--text-main);
}

[dir="rtl"] .highlight-box {
  border-left: none;
  border-right: 4px solid var(--primary-emerald);
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */
.faq-section {
  padding: 4rem 0;
}

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

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 1.25rem 1.5rem;
  min-height: 52px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.1rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[dir="rtl"] .faq-question {
  text-align: right;
}

.faq-icon {
  font-size: 1.25rem;
  transition: transform 0.3s;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.5rem;
  color: var(--text-muted);
}

.faq-item.active .faq-answer {
  max-height: 300px;
  padding: 0 1.5rem 1.25rem;
}

/* ==========================================================================
   Footer Section
   ========================================================================== */
.site-footer {
  background: #04080e;
  border-top: 1px solid var(--border-color);
  padding: 3.5rem 0 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

[data-theme="light"] .site-footer {
  background: #f1f5f9;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.footer-brand p {
  margin-top: 0.75rem;
  max-width: 360px;
  line-height: 1.6;
}

.footer-links-title {
  color: var(--text-main);
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links-list a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.footer-links-list a:hover {
  color: var(--primary-emerald);
}

.disclaimer-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 2rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-weight: 500;
}

/* Responsive Viewport Optimizations */
@media (max-width: 480px) {
  .hero-title {
    font-size: 1.85rem;
  }
  .mode-selector {
    flex-direction: column;
  }
  .calc-actions {
    flex-direction: column;
  }
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* Print & PDF Export Styles */
@media print {
  .site-header, .hero-section, .how-to-section, .article-section, .faq-section, .site-footer, .mode-selector, .calc-actions, .adsense-unit-wrapper {
    display: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .calc-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .results-table th {
    background: #e2e8f0 !important;
    color: #000000 !important;
  }
  .results-table td {
    color: #000000 !important;
  }
  @page {
    size: landscape;
    margin: 1cm;
  }
}
