/* ==========================================================================
   BIJLI DARPAN - Electricity Bill Calculator
   Theme: Precision Instrument / Fintech Utility
   ========================================================================== */

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  padding: 0;
  margin: 0;
  color: #0f172a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.billing-container {
  max-width: 1200px;
  margin: 14px auto 36px auto;
  padding: 0 20px;
  width: 100%;
  flex: 1;
}

/* Precision Instrument Console Header */
.billing-console-header {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(11, 23, 42, 0.03);
}

.billing-console-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.billing-status-pill {
  display: inline-flex;
  align-items: center;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.billing-console-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #0b172a;
  margin: 0;
  line-height: 1.2;
}

.billing-console-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.billing-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 4px 10px;
  border-radius: 6px;
}

.billing-live-badge .live-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #b45309;
  text-transform: uppercase;
}

.billing-live-badge .live-amount {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0a3663;
  font-variant-numeric: tabular-nums;
}

.btn-quick-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #0a3663;
  color: #ffffff !important;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s ease;
}

.btn-quick-nav:hover {
  background: #0284c7;
  color: #ffffff !important;
}

.btn-quick-nav-subtle {
  background: #f1f5f9;
  color: #475569 !important;
  border: 1px solid #cbd5e1;
}

.btn-quick-nav-subtle:hover {
  background: #e2e8f0;
  color: #0b172a !important;
}

.billing-discom-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  margin: 0;
}

.billing-discom-selector select {
  border: 0;
  background: transparent;
  color: #0b172a;
  font: inherit;
  cursor: pointer;
  outline: none;
}

/* Sections & Cards */
.page-section {
  margin-top: 14px;
  padding: 18px 20px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(11, 23, 42, 0.04);
}

.page-section-title {
  margin: 0 0 12px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: #0a3663;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}


.input-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.input-heading-row .page-section-title {
  margin: 0;
}

.discom-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.discom-control label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.discom-control select {
  width: 120px;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 600;
  color: #0a3663;
  border: 1px solid #cbd5e1;
}

/* Forms & Grids */
.form-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}

.input-section .form-container {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.column {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .form-container,
  .input-section .form-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .form-container,
  .input-section .form-container {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: 9px;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 3px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Inputs & Selects */
input,
select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  color: #0f172a;
  background: #ffffff;
  transition: all 0.15s ease;
}

input:focus,
select:focus {
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

input[readonly] {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
  border-color: #e2e8f0;
  cursor: default;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  appearance: textfield;
  -moz-appearance: textfield;
  font-variant-numeric: tabular-nums;
}

/* Buttons */
button {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s ease;
  font-family: 'Inter', sans-serif;
}

button:hover {
  background: #0369a1;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.fetch-btn {
  background: #0a3663;
  color: #ffffff;
  border: none;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  transition: all 0.15s ease;
}

.fetch-btn:hover {
  background: #072242;
  box-shadow: 0 4px 12px rgba(10, 54, 99, 0.25);
}

.add-btn-pay {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  transition: all 0.15s ease;
}

.add-btn-pay:hover {
  background: #0369a1;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.remove-btn {
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 0;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.remove-btn:hover {
  background: #dc2626;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* Specific Payments Rows Layout */
#paymentsContainer {
  margin-bottom: 12px;
}

#paymentsContainer .form-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  margin-bottom: 8px;
}

#paymentsContainer .form-row .form-group {
  margin-bottom: 0;
}

#paymentsContainer .form-row .form-group:first-child {
  flex: 1.5;
  min-width: 125px;
}

#paymentsContainer .form-row .form-group:nth-child(2) {
  flex: 1;
  min-width: 65px;
}

#paymentsContainer .form-row .form-group:nth-child(3) {
  flex: 0.95;
  min-width: 60px;
}

#paymentsContainer input.paymentDate {
  padding: 8px 6px;
  font-size: 0.84rem;
  letter-spacing: -0.2px;
}

#paymentsContainer input.amount,
#paymentsContainer input.lpscAdj {
  padding: 8px 6px;
  font-size: 0.86rem;
}

#paymentsContainer .remove-btn {
  flex-shrink: 0;
  width: 28px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  margin: 0;
}

.add-btn {
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-btn:hover {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

#response {
  margin-top: 10px;
  text-align: center;
  font-weight: 500;
  font-size: 0.88rem;
}

/* Reading Mode Toggle */
.reading-toggle {
  display: flex;
  gap: 6px;
  margin: 6px 0 14px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.reading-toggle button {
  flex: 1;
  margin-top: 0;
  background: transparent;
  color: #64748b;
  border: none;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.reading-toggle button.active {
  background: #ffffff;
  color: #0284c7;
  box-shadow: 0 2px 6px rgba(11, 23, 42, 0.08);
}

/* Meter Change Section */
.meter-section {
  background: #f0fdf4;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 15px;
  border: 1px solid #bbf7d0;
}

.meter-section h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #166534;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

.meter-change-row {
  background: #ffffff;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0284c7;
}

.required-field {
  border: 1px solid #ef4444 !important;
  box-shadow: 0 0 0 1px #ef4444;
}

.required-label::after {
  content: " *";
  color: #ef4444;
}

/* Results & Output Grids */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.input-card,
.results-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(11, 23, 42, 0.03);
  height: 100%;
}

.input-card h4,
.results-card h4 {
  margin-top: 0;
  margin-bottom: 12px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0a3663;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Slabs Table - Perfectly Aligned Matrix */
.slabs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 3px;
  margin-top: 4px;
}

.slabs-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #64748b;
  padding: 2px 4px 5px 4px;
  border-bottom: 1px solid #e2e8f0;
}

.slabs-table th:not(:first-child) {
  text-align: right;
}

.slabs-table td {
  padding: 2px 3px;
}

.slabs-table td input {
  padding: 4px 6px;
  font-size: 0.84rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 100%;
}

.slab-badge-col {
  vertical-align: middle;
}

.slab-pill {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.grand-total-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border: 1px solid #cbd5e1;
}

input#grandTotalFinal {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0a3663;
  background: #fffbeb !important;
  border: 1.5px solid #f59e0b !important;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.12);
}

@media (max-width: 980px) {
  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .results-grid > .grand-total-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
  .results-grid > .grand-total-card {
    grid-column: auto;
  }
}

/* Manual & Tariff Reference Section */
.manual-section {
  margin-top: 45px;
  margin-bottom: 25px;
}

.manual-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 32px 36px;
  box-shadow: 0 4px 14px rgba(11, 23, 42, 0.04);
  margin-bottom: 28px;
}

.manual-card h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #0a3663;
  font-size: 1.45rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.manual-card h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: #1e293b;
  font-size: 1.15rem;
  margin-top: 22px;
  margin-bottom: 10px;
}

.manual-card p {
  color: #475569;
  font-size: 0.96rem;
  line-height: 1.7;
  margin-bottom: 15px;
}

.manual-card ul {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 16px;
  padding-left: 24px;
}

.manual-card li {
  margin-bottom: 6px;
}

.table-manual {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 24px 0;
  font-size: 0.92rem;
}

.table-manual th {
  background: #0a3663;
  color: #ffffff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}

.table-manual td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.table-manual tr:nth-child(even) td {
  background: #f8fafc;
}

.worked-example-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 22px 26px;
  margin: 20px 0;
}

.worked-example-title {
  font-weight: 700;
  color: #166534;
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.worked-example-box p {
  color: #14532d;
  margin-bottom: 8px;
  font-size: 0.94rem;
}

.worked-example-box code {
  background: #dcfce7;
  color: #15803d;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}


/* Small Collapsible Window Inline of FPPA */
.fppa-calc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0369a1;
  font-size: 0.75rem;
  padding: 3px 6px;
  min-width: 26px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.fppa-calc-toggle:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0284c7;
}

.fppa-calc-toggle.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.fppa-calc-window {
  margin-top: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 2px 8px rgba(11, 23, 42, 0.05);
  font-size: 0.78rem;
}

.fppa-calc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 5px;
  margin-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.fppa-calc-title {
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
}

.fppa-calc-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}

.fppa-calc-close:hover {
  color: #ef4444;
  background: #fee2e2;
}

.fppa-formula-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.fppa-formula-line {
  color: #334155;
  font-weight: 600;
}

.fppa-base-line {
  margin-top: 2px;
  font-size: 0.7rem;
  color: #64748b;
}

.fppa-calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  margin-top: 2px;
}

.fppa-calc-table th {
  padding: 3px 2px;
  border-bottom: 1px solid #cbd5e1;
  color: #64748b;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.fppa-calc-table td {
  padding: 3px 2px;
  border-bottom: 1px solid #f1f5f9;
  font-variant-numeric: tabular-nums;
}

.fppa-calc-table tfoot td {
  font-weight: 700;
  border-top: 1px solid #cbd5e1;
  border-bottom: none;
  padding-top: 5px;
  color: #0f172a;
}
