/**
 * ============================================================================
 * ENTERPRISE REUSABLE EMI CALCULATOR STYLES
 * Luxury Dark Navy & Gold Theme | Modern Glassmorphism | Responsive
 * ============================================================================
 */

:root {
  --emi-primary: #0a2540;
  --emi-primary-dark: #06182a;
  --emi-gold: #d4af37;
  --emi-gold-light: #fef08a;
  --emi-gold-bg: rgba(212, 175, 55, 0.1);
  --emi-accent: #0284c7;
  --emi-border: #e2e8f0;
  --emi-card-bg: #ffffff;
  --emi-radius: 1.25rem;
  --emi-radius-sm: 0.75rem;
  --emi-shadow: 0 20px 45px -15px rgba(10, 37, 64, 0.12), 0 0 1px 1px rgba(10, 37, 64, 0.05);
}

/* Base EMI Calculator Container */
.emi-calculator-card {
  background: var(--emi-card-bg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--emi-radius);
  box-shadow: var(--emi-shadow);
  padding: 2.25rem;
  position: relative;
  overflow: hidden;
}

.emi-calculator-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0a2540 0%, var(--emi-gold) 50%, #0a2540 100%);
}

/* Header & Tabs */
.emi-calc-header {
  margin-bottom: 2rem;
}

.emi-preset-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.emi-preset-btn {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.emi-preset-btn:hover {
  background: #f1f5f9;
  color: var(--emi-primary);
  border-color: #cbd5e1;
}

.emi-preset-btn.active {
  background: var(--emi-primary);
  color: #ffffff;
  border-color: var(--emi-primary);
}

.emi-preset-btn.active i {
  color: var(--emi-gold);
}

/* Sliders & Input Rows */
.emi-control-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--emi-radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: all 0.2s ease;
}

.emi-control-group:hover,
.emi-control-group:focus-within {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(10, 37, 64, 0.05);
}

.emi-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.emi-control-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.emi-input-badge-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.emi-numeric-input {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--emi-primary);
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.35rem 0.65rem 0.35rem 1.8rem;
  width: 140px;
  text-align: right;
  outline: none;
  transition: all 0.2s ease;
}

.emi-numeric-input:focus {
  border-color: var(--emi-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.emi-input-symbol {
  position: absolute;
  left: 0.65rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #64748b;
  pointer-events: none;
}

/* Custom Range Slider */
.emi-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 9999px;
  background: #e2e8f0;
  outline: none;
  transition: background 0.15s ease;
  cursor: pointer;
  margin: 0.75rem 0 0.5rem;
}

.emi-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d4af37 100%);
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.emi-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.emi-range-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d4af37 100%);
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.emi-range-limits {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

/* Output Breakdown Box */
.emi-result-panel {
  background: linear-gradient(135deg, #0a2540 0%, #0d3b66 50%, #1e3a8a 100%);
  border-radius: var(--emi-radius);
  padding: 2rem;
  color: #ffffff;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 40px -10px rgba(10, 37, 64, 0.35);
  position: relative;
  overflow: hidden;
}

.emi-result-panel::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.emi-main-display {
  text-align: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 1.5rem;
}

.emi-main-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.emi-amount-huge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 2.4rem;
  color: #fef08a;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.emi-submetrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.emi-submetric-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
}

.emi-submetric-label {
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.emi-submetric-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

/* Pie Chart Container */
.emi-chart-wrapper {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto 1.25rem;
}

.emi-donut-chart {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.emi-donut-circle {
  fill: none;
  stroke-width: 22;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s cubic-bezier(0.16, 1, 0.3, 1), stroke-dashoffset 0.6s ease;
}

.emi-donut-principal {
  stroke: #38bdf8;
}

.emi-donut-interest {
  stroke: #f59e0b;
}

.emi-chart-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.emi-chart-ratio-num {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: #ffffff;
  line-height: 1;
}

.emi-chart-ratio-lbl {
  font-size: 0.65rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Legend */
.emi-legend-row {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.emi-legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #e2e8f0;
}

.emi-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.emi-legend-dot.dot-principal {
  background: #38bdf8;
}

.emi-legend-dot.dot-interest {
  background: #f59e0b;
}

/* Amortization Table */
.emi-amortization-section {
  margin-top: 3rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--emi-radius);
  box-shadow: var(--emi-shadow);
  padding: 2rem;
}

.emi-table-responsive {
  max-height: 460px;
  overflow-y: auto;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
}

.emi-table {
  width: 100%;
  margin-bottom: 0;
  font-size: 0.82rem;
  border-collapse: collapse;
}

.emi-table thead {
  position: sticky;
  top: 0;
  background: var(--emi-primary);
  color: #ffffff;
  z-index: 10;
}

.emi-table th {
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  white-space: nowrap;
}

.emi-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  font-weight: 500;
  white-space: nowrap;
}

.emi-table tbody tr:hover {
  background-color: #f8fafc;
}

.emi-table tbody tr.year-row-highlight {
  background-color: rgba(212, 175, 55, 0.08);
  font-weight: 700;
}

.emi-table tbody tr.year-row-highlight td {
  color: var(--emi-primary);
}

/* Export Buttons */
.btn-emi-action {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--emi-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-emi-action:hover {
  background: #f8fafc;
  border-color: var(--emi-gold);
  color: #b45309;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .emi-calculator-card {
    padding: 1.5rem;
  }
  .emi-result-panel {
    margin-top: 1.5rem;
    padding: 1.5rem;
  }
  .emi-amount-huge {
    font-size: 1.9rem;
  }
}
