/* ============================================================
   CALCULATEUR PBXware
   ============================================================ */

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2.5rem;
  margin-top: 2rem;
  align-items: start;
}

@media (max-width: 968px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   FORM — Blocs étapes
   ============================================================ */
.calc-block {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: border-color 0.15s;
}
.calc-block:hover {
  border-color: var(--color-accent-light);
}
.calc-block__header {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-soft);
}
.calc-block__number {
  width: 36px; height: 36px;
  background: var(--color-accent);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.calc-block__title {
  font-size: 1.1rem; font-weight: 700;
  color: var(--color-text);
}
.calc-block__hint {
  font-size: 0.85rem; color: var(--color-text-muted);
  margin-top: 0.2rem;
}
.calc-block__body {
  padding: 1.5rem 1.6rem;
}

/* ============================================================
   COUNTER nombre de postes
   ============================================================ */
.calc-counter {
  display: flex; align-items: center; gap: 0.5rem;
}
.calc-counter__btn {
  width: 44px; height: 44px;
  border: 2px solid var(--color-accent);
  background: white;
  color: var(--color-accent-darker);
  font-size: 1.5rem; font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}
.calc-counter__btn:hover {
  background: var(--color-accent);
  color: white;
}
.calc-counter__btn:active {
  transform: scale(0.95);
}
.calc-counter__input {
  width: 90px;
  height: 44px;
  font-size: 1.3rem; font-weight: 700;
  text-align: center;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  -moz-appearance: textfield;
}
.calc-counter__input::-webkit-outer-spin-button,
.calc-counter__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.calc-counter__label {
  color: var(--color-text-body);
  font-size: 0.95rem;
  margin-left: 0.5rem;
}

/* ============================================================
   PHONES — cards radio
   ============================================================ */
.calc-phones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}
.calc-phone {
  cursor: pointer;
  position: relative;
}
.calc-phone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.calc-phone__card {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.1rem;
  background: white;
  transition: all 0.15s;
  height: 100%;
  display: flex; flex-direction: column;
}
.calc-phone:hover .calc-phone__card {
  border-color: var(--color-accent-light);
  transform: translateY(-2px);
}
.calc-phone input:checked + .calc-phone__card {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  box-shadow: 0 0 0 4px rgba(61, 200, 198, 0.15);
}
.calc-phone__category {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent-darker);
  margin-bottom: 0.3rem;
}
.calc-phone__model {
  font-size: 1.05rem; font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.4rem;
}
.calc-phone__desc {
  font-size: 0.83rem;
  color: var(--color-text-body);
  line-height: 1.45;
  flex: 1;
  margin-bottom: 0.8rem;
}
.calc-phone__price {
  font-size: 0.95rem;
  color: var(--color-text);
  border-top: 1px solid var(--color-border-soft);
  padding-top: 0.7rem;
}
.calc-phone__price strong {
  color: var(--color-accent-darker);
  font-size: 1.1rem;
}

/* ============================================================
   OPTIONS — cards checkbox
   ============================================================ */
.calc-options {
  display: grid;
  gap: 0.6rem;
}
.calc-option {
  cursor: pointer;
}
.calc-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.calc-option__card {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  background: white;
  transition: all 0.15s;
  position: relative;
  padding-left: 3rem;
}
.calc-option__card::before {
  content: '';
  position: absolute;
  left: 1rem; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px;
  border: 2px solid var(--color-border);
  border-radius: 6px;
  background: white;
  transition: all 0.15s;
}
.calc-option__card::after {
  content: '✓';
  position: absolute;
  left: 1.1rem; top: 50%; transform: translateY(-50%);
  font-size: 1rem; font-weight: 800;
  color: white;
  opacity: 0;
  transition: opacity 0.15s;
}
.calc-option input:checked + .calc-option__card {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}
.calc-option input:checked + .calc-option__card::before {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.calc-option input:checked + .calc-option__card::after {
  opacity: 1;
}
.calc-option__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 0.3rem;
}
.calc-option__title {
  font-weight: 700; color: var(--color-text);
  font-size: 0.95rem;
}
.calc-option__price {
  font-size: 0.82rem;
  color: var(--color-accent-darker);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.calc-option__desc {
  font-size: 0.83rem;
  color: var(--color-text-body);
  line-height: 1.45;
}

/* ============================================================
   RESULT — sticky sidebar
   ============================================================ */
.calc-result {
  position: sticky;
  top: 1.5rem;
  background: white;
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(8, 35, 56, 0.08);
}
.calc-result__header {
  background: var(--color-accent);
  color: white;
  padding: 1.2rem 1.4rem;
}
.calc-result__title {
  font-size: 1.15rem; font-weight: 800;
}
.calc-result__subtitle {
  font-size: 0.78rem;
  opacity: 0.9;
  margin-top: 0.2rem;
}
.calc-result__body {
  padding: 1rem 1.4rem;
  max-height: 320px;
  overflow-y: auto;
  border-bottom: 1px solid var(--color-border);
}
.calc-breakdown__row {
  display: flex; justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.88rem;
  border-bottom: 1px dashed var(--color-border-soft);
  gap: 1rem;
}
.calc-breakdown__row:last-child { border-bottom: 0; }
.calc-breakdown__label {
  color: var(--color-text-body);
  line-height: 1.4;
}
.calc-breakdown__amount {
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap;
}
.calc-breakdown__row--discount .calc-breakdown__label,
.calc-breakdown__row--discount .calc-breakdown__amount {
  color: #1F8584;
  font-style: italic;
}
.calc-breakdown__row--recurring .calc-breakdown__label,
.calc-breakdown__row--recurring .calc-breakdown__amount {
  color: var(--color-text-muted);
  font-size: 0.83rem;
}

.calc-result__total {
  padding: 1rem 1.4rem;
  background: var(--color-bg-soft);
}
.calc-result__line {
  display: flex; justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.92rem;
  color: var(--color-text-body);
}
.calc-result__line strong {
  color: var(--color-text);
  font-weight: 700;
}
.calc-result__line--total {
  font-size: 1.05rem;
  border-top: 2px solid var(--color-border);
  margin-top: 0.4rem;
  padding-top: 0.7rem;
}
.calc-result__line--total strong {
  font-size: 1.4rem;
  color: var(--color-accent-darker);
  font-weight: 800;
}
.calc-result__recurring {
  display: flex; justify-content: space-between;
  padding: 0.6rem 0 0;
  margin-top: 0.6rem;
  border-top: 1px dashed var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.calc-result__recurring strong {
  color: var(--color-accent-darker);
  font-weight: 700;
}

.calc-result__actions {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1.2rem 1.4rem;
  border-top: 1px solid var(--color-border);
}
.calc-result__actions .btn {
  justify-content: center;
  text-align: center;
}

.calc-result__note {
  padding: 0.8rem 1.4rem 1.2rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.45;
  border-top: 1px solid var(--color-border-soft);
  background: var(--color-bg-soft);
}

/* ============================================================
   MODALE EMAIL
   ============================================================ */
.modal-overlay[hidden] {
  /* L'attribut hidden HTML doit avoir priorité sur display:flex */
  display: none !important;
}
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(8, 35, 56, 0.7);
  z-index: 9100;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.2rem;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1.2rem;
  background: transparent; border: 0;
  width: 36px; height: 36px;
  font-size: 1.4rem; line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover {
  background: var(--color-bg-soft);
  color: var(--color-text);
}
.modal-box h2 {
  font-size: 1.4rem; color: var(--color-text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.modal-box > p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

@media (max-width: 600px) {
  .calc-phones { grid-template-columns: 1fr; }
  .calc-result { position: relative; top: 0; }
  .calc-block__body { padding: 1.2rem 1rem; }
  .calc-counter__label { display: none; }
  .calc-counter { flex-wrap: wrap; }
}
