:root {
  /* Brand Colors */
  --primary-color: #fa9f34;
  /* Trustworthy deep automotive blue */
  --primary-hover: #e08a26;
  --secondary-color: #2db37b;
  /* Emerald green for money/success */
  --bg-color: #f4f6fc;

  /* Text & Cards */
  --card-bg: #ffffff;
  --text-main: #2d3748;
  --text-muted: #718096;
  --border-color: #e2e8f0;

  /* Effects */
  --focus-ring: rgba(250, 159, 52, 0.2);
  --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main);
  margin: 0;
  padding: 0 0 1.5rem 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: url('background1.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: var(--bg-color);
  /* Fallback */
  position: relative;
  min-height: 100vh;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(43, 22, 6, 0.6);
  /* Deep orange/brown overlay giving sophisticated vibe and ensuring perfect readability */
  z-index: -1;
}

.banner-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
  margin-bottom: 30px;
}

.main-banner {
  max-width: 100%;
  height: auto;
  max-height: 100px;
  display: block;
}

.container {
  max-width: 1800px;
  width: 98%;
  margin: 0 auto;
}

/* Grid Layout */
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}

/* Responsive Stacking */
@media (max-width: 1400px) {
  .calculator-grid {
    gap: 1rem;
  }
}

@media (max-width: 1100px) {
  .calculator-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 850px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }

  body {
    padding: 0.5rem;
  }

  .container {
    width: 100%;
  }
}

/* Card General Styling */
.card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

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

.card h3 {
  margin-top: 0;
  font-size: 1.15rem;
  color: var(--primary-color);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================================
   BLOCK 1: Form Inputs & Fields 
   ========================================= */

/* Internal 2-Column Grid for the Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1rem;
}

/* Items that must span entirely across the 2 columns */
.full-span {
  grid-column: 1 / -1;
}

/* Ensure no massive bottom margins inside grid items */
.form-grid .form-group {
  display: flex;
  flex-direction: column;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: #4a5568;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text-main);
  background-color: #f8f9fa;
  outline: none;
  transition: all 0.25s ease;
  box-sizing: border-box;
  font-family: inherit;
  appearance: auto;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

fieldset {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  background: rgba(248, 250, 252, 0.5);
  /* Semi-transparent to let glassmorphism bleed through slightly */
  margin: 0;
}

legend {
  font-weight: 600;
  color: var(--primary-color);
  padding: 0 0.5rem;
  font-size: 0.9rem;
}

.radio-group {
  display: flex;
  gap: 1.5rem;
}

.checkbox-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.95rem;
  margin-bottom: 0;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  transition: all 0.25s ease;
  position: relative;
  text-align: center;
}

.checkbox-label:hover {
  border-color: var(--primary-color);
  background-color: rgba(250, 159, 52, 0.05);
}

.checkbox-label:has(input[type="checkbox"]:checked),
.checkbox-label:has(input[type="radio"]:checked) {
  background-color: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 4px 10px rgba(250, 159, 52, 0.25);
  transform: translateY(-1px);
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1.1rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.2s, transform 0.1s;
  margin-top: 1rem;
  box-shadow: 0 4px 6px rgba(250, 159, 52, 0.3);
}

button:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 6px 8px rgba(250, 159, 52, 0.4);
}

button:active {
  transform: translateY(2px);
}

button:disabled {
  background-color: #a0aec0;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* =========================================
   BLOCK 2: Details List
   ========================================= */
.costs-list {
  display: flex;
  flex-direction: column;
}

.cost-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--border-color);
}

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

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

.cost-value {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  transition: color 0.3s ease;
}

.cost-item.text-muted .cost-label,
.cost-item.text-muted .cost-value {
  color: #adb5bd;
}

.cost-divider {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.75px;
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--border-color);
}

.cost-divider:first-child {
  margin-top: 0;
}

.highlight-value {
  color: #000000;
}

/* =========================================
   BLOCK 3: Final Total 
   ========================================= */
.total-card {
  background: linear-gradient(135deg, #4a2805 0%, #a65e07 50%, #fa9f34 100%);
  color: white;
  border: none;
  position: relative;
  overflow: hidden;
}

.total-card h3 {
  color: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.total-card .cost-item {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.total-card .cost-label {
  color: rgba(255, 255, 255, 0.8);
}

.total-card .cost-value {
  color: #fff;
  font-size: 1.2rem;
}

.grand-total-container {
  margin-top: 2rem;
  text-align: center;
  padding: 2rem 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.grand-total-label {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
}

.grand-total-value {
  font-size: 3.5rem;
  font-weight: 800;
  color: #10b981;
  /* Perfect modern emerald green */
  text-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  line-height: 1;
}

.print-btn {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  margin-top: 1.5rem;
  box-shadow: none;
}

.print-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Custom Select Dropdown */
.custom-select-wrapper {
  position: relative;
}

.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: bold;
  user-select: none;
  z-index: 2;
}

.custom-select-clear:hover {
  color: var(--primary-color);
}

.custom-select-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  z-index: 100;
  box-shadow: var(--shadow-hover);
}

.custom-select-list li {
  padding: 0.8rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.95rem;
  transition: background-color 0.2s;
}

.custom-select-list li:last-child {
  border-bottom: none;
}

.custom-select-list li:hover {
  background-color: #e2e8f0;
  color: var(--primary-color);
}

/* =========================================
   USA MAP COMPONENT
   ========================================= */

/* Third column wrapper — stacks total + map vertically */
.third-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-self: stretch;
}

/* Map card inside third column expands to fill remaining height */
.third-column .map-card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.third-column .usa-map-container {
  flex: 1;
  height: auto;
  min-height: 220px;
}

.map-card {
  padding: 0 !important;
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
}

.map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, #a65e07 0%, #fa9f34 100%);
  border-top: none;
}

.map-footer h3 {
  margin: 0;
  padding: 0;
  border-bottom: none;
  color: #ffffff;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.map-state-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.4s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-state-label.active {
  color: #ffffff;
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.map-label-pin {
  font-size: 1rem;
}

.map-label-abbr {
  opacity: 0.7;
  font-weight: 400;
}

.usa-map-container {
  width: 100%;
  height: 420px;
  background: #f0f4f8;
  position: relative;
  z-index: 1;
}

@media (max-width: 850px) {
  .usa-map-container {
    height: 300px;
  }

  .map-footer {
    flex-direction: column;
    gap: 0.4rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .usa-map-container {
    height: 240px;
  }
}

/* Leaflet Tooltip Custom Style */
.map-tooltip {
  background: rgba(250, 159, 52, 0.92) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 6px 12px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.3px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

.map-tooltip::before {
  border-top-color: rgba(250, 159, 52, 0.92) !important;
}

/* Override Leaflet default controls styling */
.leaflet-control-zoom a {
  background-color: rgba(255, 255, 255, 0.92) !important;
  color: var(--primary-color) !important;
  border-color: var(--border-color) !important;
  font-weight: 700 !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
  font-size: 16px !important;
  transition: all 0.2s ease !important;
}

.leaflet-control-zoom a:hover {
  background-color: var(--primary-color) !important;
  color: #ffffff !important;
}

/* Smooth path transitions for state boundaries */
.leaflet-interactive {
  transition: fill 0.3s ease, fill-opacity 0.3s ease, stroke 0.2s ease;
}