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

/* ─── Base ─────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(rgba(0,0,0,0.75), rgba(0,0,0,0.75)),
              url("background.jpg") no-repeat center center fixed;
  background-size: cover;
  color: white;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ─── Layout ────────────────────────────────────────────── */
.container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 30px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(20px);
  border-radius: 20px;
}

.section { margin-bottom: 30px; }

.section h3 {
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 8px;
  margin-bottom: 15px;
  letter-spacing: 0.3px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Header ────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 35px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.logo { height: 110px; width: auto; }
.header h1 { font-size: 26px; font-weight: 600; }

/* ─── Form fields ───────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 12px;
  color: rgba(255,255,255,1);
  opacity: 1;
  line-height: 1.3;
}

.field input[type="number"] {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.25s;
}

.field input[type="number"]:focus {
  outline: none;
  border-color: #00c853;
  background: rgba(255,255,255,0.13);
}

input[type="number"]::placeholder { color: rgba(255,255,255,0.35); }

/* ─── Option buttons ────────────────────────────────────── */
.option-grid { display: grid; gap: 16px; }
.option-grid-2x2 { grid-template-columns: 1fr 1fr; }

.option-btn {
  padding: 18px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s;
  color: white;
  user-select: none;
}

.option-btn:hover { background: rgba(255,255,255,0.14); }
.option-btn.active { background: rgba(0,200,83,0.18); border-color: #00c853; }
.option-btn.ecs-btn.active { background: rgba(0,188,212,0.2); border-color: #00bcd4; }
.option-btn.disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.opt-label { font-size: 14px; font-weight: 600; }
.opt-sub   { font-size: 11px; opacity: 0.6; margin-top: 3px; }

.opt-icon,
.b-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 6px;
}

/* ─── Building selector ─────────────────────────────────── */
.building-selector { display: flex; gap: 16px; margin-bottom: 20px; }

.building-btn {
  flex: 1;
  padding: 18px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s;
  color: white;
}

.building-btn:hover { background: rgba(255,255,255,0.14); }
.building-btn.active { background: rgba(0,200,83,0.18); border-color: #00c853; }
.building-btn .b-label { font-size: 14px; font-weight: 600; }
.building-btn .b-sub   { font-size: 11px; opacity: 0.6; margin-top: 3px; }

/* ─── Battery selector ──────────────────────────────────── */
.battery-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.battery-btn {
  padding: 14px 10px;
  border-radius: 13px;
  background: rgba(255,255,255,0.08);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s;
  color: white;
}

.battery-btn:hover { background: rgba(255,255,255,0.14); }
.battery-btn.active { background: rgba(0,200,83,0.18); border-color: #00c853; }
.battery-btn.none-btn.active { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.4); }

.bat-icon  { font-size: 26px; margin-bottom: 5px; }
.bat-label { font-size: 13px; font-weight: 700; }
.bat-cap   { font-size: 11px; opacity: 0.65; margin-top: 2px; }
.bat-price { font-size: 11px; color: #00e676; margin-top: 3px; font-weight: 600; }

/* ─── MD Panel adjuster ─────────────────────────────────── */
.md-panel-adjuster-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.md-panel-label {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

.md-panel-adjuster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.md-icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 180ms ease, color 180ms ease;
}

.md-icon-btn svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.md-icon-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  transition: opacity 180ms ease;
}

.md-icon-btn:hover::before  { opacity: .08; }
.md-icon-btn:active::before { opacity: .16; }
.md-icon-btn:hover          { color: #fff; }
.md-icon-btn:active         { color: #69f0ae; }
.md-icon-btn:focus-visible  { outline: 2px solid #69f0ae; outline-offset: 2px; }

.md-input-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 20px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  min-width: 110px;
  transition: border-color 180ms ease, background 180ms ease;
}

.md-input-block:focus-within {
  border-color: #69f0ae;
  background: rgba(105,240,174,0.05);
}

.md-panel-input {
  width: 72px;
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  caret-color: #69f0ae;
  -moz-appearance: textfield;
}

.md-panel-input:focus { outline: none; }
.md-panel-input::selection { background: rgba(105,240,174,0.2); }

.md-panel-input::-webkit-outer-spin-button,
.md-panel-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.md-input-unit {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.md-panel-info {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  line-height: 1.8;
}

.md-panel-info strong {
  color: #fff;
  font-weight: 600;
}

/* ─── Conso preview ─────────────────────────────────────── */
.conso-preview {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  font-size: 12px;
  opacity: 0.8;
  line-height: 1.7;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ─── Calculate button ──────────────────────────────────── */
.btn-calc {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #00c853, #00a846);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 5px;
}

.btn-calc:hover  { opacity: 0.92; }
.btn-calc:active { transform: scale(0.99); }

.btn-calc .material-symbols-outlined {
  font-size: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

/* ─── Material symbols ──────────────────────────────────── */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.inline-icon {
  font-size: 16px;
  vertical-align: middle;
  margin-right: 4px;
}

/* ─── Result section ────────────────────────────────────── */
#result {
  display: none;
  margin-top: 28px;
  animation: fadeUp 0.4s ease;
}

#result.visible { display: block; }

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

.result-section { margin-bottom: 18px; }

.result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.result-title .material-symbols-outlined { font-size: 22px; }

.result-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.result-cards.four { grid-template-columns: repeat(4, 1fr); }
.result-cards.two  { grid-template-columns: repeat(2, 1fr); }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 13px;
  padding: 16px;
}

.card .card-label { font-size: 11px; opacity: 0.6; margin-bottom: 5px; }
.card .card-value { font-size: 20px; font-weight: 700; color: #00e676; line-height: 1.1; }
.card .card-value.red   { color: #ff7043; }
.card .card-value.amber { color: #ffb74d; }
.card .card-unit  { font-size: 12px; opacity: 0.7; margin-top: 2px; }

/* ─── Compare card ──────────────────────────────────────── */
.compare-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 13px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.compare-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
}

.compare-row.before {
  background: rgba(255,82,82,0.1);
  border: 1px solid rgba(255,82,82,0.25);
}

.compare-row.saving {
  background: rgba(0,200,83,0.1);
  border: 1px solid rgba(0,200,83,0.25);
}

.compare-row.after {
  background: rgba(0,188,212,0.1);
  border: 1px solid rgba(0,188,212,0.3);
}

.compare-label { font-size: 13px; font-weight: 600; }
.compare-sub   { font-size: 11px; opacity: 0.6; margin-top: 2px; }
.compare-value { font-size: 20px; font-weight: 800; white-space: nowrap; }

.compare-row.before  .compare-value { color: #ff7043; }
.compare-row.saving  .compare-value { color: #00e676; }
.compare-row.after   .compare-value { color: #00bcd4; }

.arrow-down { text-align: center; font-size: 20px; opacity: 0.5; margin: -4px 0; }

/* ─── ROI section ───────────────────────────────────────── */
.roi-section { margin-top: 35px; }

.roi-header {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 15px;
}

.roi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
}

.roi-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 22px;
  transition: 0.25s ease;
}

.roi-card:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,0.08);
}

.roi-best {
  border: 1px solid #00e676;
  box-shadow: 0 0 20px rgba(0,230,118,0.2);
}

.roi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.roi-battery { font-size: 13px; font-weight: 600; opacity: 0.7; }
.roi-badge   { font-size: 11px; font-weight: 700; color: #00e676; }

.roi-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}

.roi-years       { font-size: 38px; font-weight: 800; color: #00e676; }
.roi-years-label { font-size: 14px; opacity: 0.6; }

.roi-savings {
  font-size: 14px;
  font-weight: 600;
  color: #00e676;
  margin-bottom: 16px;
}

.roi-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  overflow: hidden;
}

.roi-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e676, #00c853);
  border-radius: 20px;
  transition: width 0.5s ease;
}

/* ─── Detail table ──────────────────────────────────────── */
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.detail-table tr td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.detail-table tr td:last-child {
  text-align: right;
  font-weight: 600;
  color: #b2dfdb;
  white-space: nowrap;
}

.detail-table tr.total td {
  border-top: 2px solid rgba(255,255,255,0.25);
  border-bottom: none;
  font-weight: 700;
  font-size: 14px;
  color: white;
  padding-top: 10px;
}

.detail-table tr.total td:last-child { color: #00e676; }
.detail-table tr.aide  td:last-child { color: #ff8a65; }
.detail-table tr.cost  td:last-child { color: #ff7043; }

/* ─── Alert ─────────────────────────────────────────────── */
.alert {
  background: rgba(255,82,82,0.15);
  border: 1px solid rgba(255,82,82,0.5);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: #ffcdd2;
}

/* ─── Autoconso badge ───────────────────────────────────── */
.autoconso-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-plafond { background: rgba(255,183,77,0.25); color: #ffb74d; border: 1px solid rgba(255,183,77,0.4); }
.badge-reel    { background: rgba(0,200,83,0.2);    color: #00e676; border: 1px solid rgba(0,200,83,0.4); }

/* ─── Projection section ────────────────────────────────── */
.projection-section { margin-top: 40px; }

.projection-header {
  text-align: center;
  font-size: 20px;
  margin-bottom: 25px;
  opacity: 0.9;
}

.projection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.projection-card {
  background: rgba(255,255,255,0.05);
  padding: 25px;
  border-radius: 18px;
  backdrop-filter: blur(10px);
}

.projection-title { font-size: 18px; margin-bottom: 15px; font-weight: 600; }
.projection-line  { margin: 8px 0; }
.projection-result { margin-top: 15px; font-size: 18px; }

/* ─── Comp25 card ───────────────────────────────────────── */
.comp25-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 22px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.comp25-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
  margin-bottom: 20px;
}

.comp25-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.comp25-row:last-child { border-bottom: none; padding-bottom: 0; }

.comp25-left {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 210px;
  flex-shrink: 0;
}

.comp25-icon          { font-size: 20px; }
.comp25-icon.positive { color: #00e676; }
.comp25-icon.negative { color: #ff7043; }

.comp25-label { font-size: 13px; font-weight: 600; opacity: 0.85; }

.comp25-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.comp25-track {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  overflow: hidden;
}

.comp25-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.comp25-fill.positive { background: linear-gradient(90deg, #00c853, #00e676); }
.comp25-fill.negative { background: linear-gradient(90deg, #ff5252, #ff7043); }

.comp25-value {
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  width: 140px;
  text-align: right;
  flex-shrink: 0;
}

.comp25-value.positive { color: #00e676; }
.comp25-value.negative { color: #ff7043; }

/* ─── Disclaimer ────────────────────────────────────────── */
.disclaimer { text-align: center; font-size: 11px; opacity: 0.5; margin-top: 18px; }

/* ─── Responsive — 768px ────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    margin: 10px;
    padding: 18px;
    border-radius: 16px;
  }

  .header { flex-direction: column; gap: 10px; }
  .logo { height: 70px; }
  .header h1 { font-size: 18px; text-align: center; }

  .grid,
  .result-cards,
  .result-cards.four,
  .result-cards.two,
  .projection-grid,
  .option-grid-2x2 {
    grid-template-columns: 1fr !important;
  }

  .roi-grid { grid-template-columns: 1fr; }

  .roi-card    { padding: 16px; }
  .roi-years   { font-size: 28px; }
  .roi-savings { font-size: 13px; }

  .md-panel-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 28px;
  }

  .compare-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .detail-table {
    display: block;
    overflow-x: auto;
  }
}

/* ─── Responsive — 700px ────────────────────────────────── */
@media (max-width: 700px) {
  .building-selector { flex-direction: column; }
  .battery-selector  { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Responsive — 600px ────────────────────────────────── */
@media (max-width: 600px) {
  .comp25-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .comp25-left     { width: 100%; }
  .comp25-bar-wrap { width: 100%; }
  .comp25-value    { width: auto; text-align: left; }
}

/* ─── Responsive — 450px ────────────────────────────────── */
@media (max-width: 450px) {
  .result-cards,
  .result-cards.four { grid-template-columns: 1fr; }
}

.contact-card {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}

.contact-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  margin-bottom: 12px;
}

.contact-fields {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-direction: column;
}

.contact-fields input {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  border: none;
  outline: none;
  background: rgba(255,255,255,0.08);
  color: white;
    width: 100%;
  box-sizing: border-box;
  font-size: 15px;
}

.contact-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 500;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  background: linear-gradient(135deg, #00c853, #00a846);
  color: white;

  transition: 0.2s;
}

.contact-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,114,255,0.3);
}
