/* ==========================================================================
   8th Pay Commission Calculator - Production Stylesheet (8thpc.in)
   ========================================================================== */

:root {
  --primary: #0f2744;
  --primary-hover: #16365c;
  --primary-light: #f0f4f9;
  --accent: #0284c7;
  --accent-light: #e0f2fe;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border: #d8e2ec;
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;

  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

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

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

/* Header */
.site-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 2rem 0 1.5rem;
}

.site-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.025em;
  margin-bottom: 0.35rem;
}

.site-subtitle {
  font-size: 0.98rem;
  color: var(--text-muted);
  max-width: 780px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.6rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--bg-subtle);
}

.step-badge {
  background: var(--primary);
  color: #ffffff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Form Controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

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

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group .field-hint {
  font-size: 0.78rem;
  color: var(--text-light);
}

.form-control {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-control.is-invalid {
  border-color: var(--danger);
  background-color: #fff8f8;
}

.invalid-feedback {
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 500;
}

/* Basic Pay Badge */
.basic-preview-chip {
  display: inline-flex;
  align-items: center;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.35rem;
}

/* Fitment Factor Card */
.highlight-field-card {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  border: 1.5px solid #86efac;
}

.highlight-field-card .card-title {
  color: #166534;
}

.highlight-field-card .step-badge {
  background: #166534;
}

/* Dynamic Rows */
.dynamic-row {
  display: grid;
  grid-template-columns: 1fr 140px 100px 40px;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.btn-remove-row {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.btn-remove-row:hover {
  background: #fca5a5;
}

.btn-add-row {
  background: var(--bg-subtle);
  color: var(--primary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-add-row:hover {
  background: var(--primary-light);
  border-color: #93c5fd;
}

/* Buttons */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.9rem 1.8rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.85rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

/* Results */
.results-section {
  display: none;
  margin-top: 2rem;
  animation: fadeIn 0.3s ease-in-out;
}

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

.results-header-banner {
  background: linear-gradient(135deg, #0f2744 0%, #1e3a8a 100%);
  color: #ffffff;
  padding: 1.85rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.results-banner-title {
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-banner-figure {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0.35rem 0;
  font-family: var(--font-sans);
}

.results-banner-disclaimer {
  font-size: 0.82rem;
  opacity: 0.8;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.kpi-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.3rem;
}

.kpi-subtext {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* Comparison Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  margin-bottom: 1.5rem;
}

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

.table-custom th, .table-custom td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--bg-subtle);
}

.table-custom th {
  background-color: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-main);
}

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

.table-custom .text-right {
  text-align: right;
}

.table-custom tr.highlight-row {
  background-color: var(--primary-light);
  font-weight: 700;
}

.badge-positive {
  color: var(--success);
  font-weight: 700;
}

/* Accordions */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

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

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  width: 100%;
  padding: 1.1rem 1.25rem;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-header:hover {
  background-color: var(--bg-subtle);
}

.accordion-content {
  padding: 1.25rem;
  display: none;
  font-size: 0.92rem;
  color: var(--text-muted);
  border-top: 1px solid var(--bg-subtle);
  background: #fafbfc;
  line-height: 1.7;
}

.accordion-content.is-open {
  display: block;
}

/* Alerts & Notices */
.alert {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  font-size: 0.92rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

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

.alert-info {
  background-color: var(--primary-light);
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* Informational Content */
.info-section {
  margin: 3.5rem 0;
}

.info-section h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.4rem;
}

.info-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.25rem 0 0.5rem;
}

.info-section p, .info-section li {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.85rem;
}

.info-section ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

/* Footer */
.site-footer {
  background-color: #0f172a;
  color: #94a3b8;
  padding: 3rem 0 2rem;
  font-size: 0.88rem;
  border-top: 1px solid #1e293b;
}

.site-footer a {
  color: #38bdf8;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-disclaimer-box {
  background: #1e293b;
  border-left: 4px solid #f59e0b;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  color: #cbd5e1;
}

/* Responsive */
@media (max-width: 768px) {
  .dynamic-row {
    grid-template-columns: 1fr 1fr;
  }
  .dynamic-row select {
    grid-column: span 1;
  }
  .btn-remove-row {
    grid-column: span 2;
  }
  .results-banner-figure {
    font-size: 1.95rem;
  }
  .site-title {
    font-size: 1.45rem;
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: #ffffff;
    color: #000000;
  }
  .site-header, .action-buttons, .accordion, .matrix-filter-bar, .info-section, .site-footer {
    display: none !important;
  }
  .results-section {
    display: block !important;
  }
  .results-header-banner {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000;
  }
  .card {
    border: 1px solid #999999;
    box-shadow: none;
    page-break-inside: avoid;
  }
}