/* ═══════════════════════════════════════════════════════════════
   VEHICA PURCHASE SYSTEM — CSS v1.0.4
   Popup mode paysage — déclenché par #buyButton existant
═══════════════════════════════════════════════════════════════ */

/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
  --vp-primary:     #1a1a2e;
  --vp-accent:      #e63946;
  --vp-accent2:     #2563eb;
  --vp-gold:        #f4a261;
  --vp-green:       #22c55e;
  --vp-bg:          #ffffff;
  --vp-bg2:         #f8fafc;
  --vp-border:      #e2e8f0;
  --vp-text:        #1e293b;
  --vp-muted:       #64748b;
  --vp-radius:      12px;
  --vp-shadow:      0 25px 60px rgba(0,0,0,0.35);
  --vp-transition:  0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── OVERLAY ─────────────────────────────────────────────────── */
.vp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--vp-transition), visibility var(--vp-transition);
}

.vp-overlay.vp-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* ── POPUP (MODE PAYSAGE) ────────────────────────────────────── */
.vp-popup {
  display: flex;
  flex-direction: row;        /* ← PAYSAGE : deux colonnes côte à côte */
  width: min(900px, 96vw);
  max-height: 90vh;
  background: var(--vp-bg);
  border-radius: var(--vp-radius);
  box-shadow: var(--vp-shadow);
  overflow: hidden;
  transform: scale(0.92) translateY(20px);
  transition: transform var(--vp-transition);
}

.vp-overlay.vp-overlay--visible .vp-popup {
  transform: scale(1) translateY(0);
}

/* ── LEFT PANEL ──────────────────────────────────────────────── */
.vp-popup__left {
  width: 320px;
  min-width: 280px;
  background: var(--vp-primary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.vp-popup__car-visual {
  width: 100%;
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
  background: #0f0f1a;
}

.vp-popup__car-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.3s;
}

.vp-popup__car-img:hover { opacity: 1; }

.vp-popup__car-noimg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: linear-gradient(135deg, #0f0f1a 0%, #1e1e3a 100%);
}

.vp-popup__car-info {
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.vp-popup__car-title {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.3;
}

.vp-popup__car-price-label {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0 0 2px;
}

.vp-popup__car-price {
  color: var(--vp-gold);
  font-size: 26px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.5px;
}

/* ── TABS ────────────────────────────────────────────────────── */
.vp-popup__tabs {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.vp-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}

.vp-tab:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.vp-tab.vp-tab--active {
  background: var(--vp-accent);
  border-color: var(--vp-accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(230,57,70,0.4);
}

.vp-tab__icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.vp-tab__label { font-weight: 600; }

/* ── RIGHT PANEL ─────────────────────────────────────────────── */
.vp-popup__right {
  flex: 1;
  overflow-y: auto;
  padding: 32px 32px 28px;
  position: relative;
  background: var(--vp-bg);
}

/* ── CLOSE BUTTON ────────────────────────────────────────────── */
.vp-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--vp-bg2);
  color: var(--vp-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  z-index: 2;
}

.vp-close:hover {
  background: var(--vp-accent);
  color: #fff;
}

/* ── PANEL ───────────────────────────────────────────────────── */
.vp-panel__title {
  font-size: 20px;
  font-weight: 800;
  color: var(--vp-text);
  margin: 0 0 4px;
}

.vp-panel__subtitle {
  color: var(--vp-muted);
  font-size: 13px;
  margin: 0 0 20px;
}

/* ── BREAKDOWN ───────────────────────────────────────────────── */
.vp-breakdown {
  background: var(--vp-bg2);
  border: 1px solid var(--vp-border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 22px;
}

.vp-breakdown__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--vp-border);
  color: var(--vp-text);
}

.vp-breakdown__row:last-child { border-bottom: none; }

.vp-breakdown__row--fees {
  background: #fff8e1;
  color: #92400e;
  font-weight: 500;
}

.vp-breakdown__row--total {
  background: #d1fae5;
  color: #065f46;
  font-size: 16px;
  font-weight: 800;
}

.vp-breakdown__row--deposit {
  background: #dbeafe;
  color: #1e3a8a;
  font-weight: 700;
  font-size: 15px;
}

.vp-breakdown__row--remaining {
  background: #fef3c7;
  color: #78350f;
  font-weight: 500;
}

/* ── FORM ────────────────────────────────────────────────────── */
.vp-form { display: flex; flex-direction: column; gap: 12px; }

.vp-form__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vp-form__row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--vp-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vp-form__row .req { color: var(--vp-accent); }

.vp-form__row input,
.vp-form__row textarea {
  border: 1.5px solid var(--vp-border);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--vp-text);
  background: var(--vp-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
  font-family: inherit;
  outline: none;
}

.vp-form__row input:focus,
.vp-form__row textarea:focus {
  border-color: var(--vp-accent2);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.vp-form__row input.vp-error {
  border-color: var(--vp-accent);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.12);
}

/* ── SUBMIT BUTTONS ──────────────────────────────────────────── */
.vp-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  margin-top: 4px;
  letter-spacing: 0.2px;
}

.vp-submit:hover { transform: translateY(-1px); }
.vp-submit:active { transform: translateY(0); }
.vp-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.vp-submit--immediate {
  background: linear-gradient(135deg, #e63946, #c0392b);
  color: #fff;
  box-shadow: 0 4px 16px rgba(230,57,70,0.35);
}
.vp-submit--immediate:hover {
  box-shadow: 0 6px 22px rgba(230,57,70,0.5);
}

.vp-submit--delivery {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}
.vp-submit--delivery:hover {
  box-shadow: 0 6px 22px rgba(37,99,235,0.5);
}

/* ── NOTICES ─────────────────────────────────────────────────── */
.vp-form__notice {
  font-size: 11px;
  color: var(--vp-muted);
  margin: 0;
  line-height: 1.5;
}

.vp-success-msg {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
.vp-popup__left::-webkit-scrollbar,
.vp-popup__right::-webkit-scrollbar { width: 5px; }
.vp-popup__left::-webkit-scrollbar-track { background: transparent; }
.vp-popup__left::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }
.vp-popup__right::-webkit-scrollbar-track { background: transparent; }
.vp-popup__right::-webkit-scrollbar-thumb { background: var(--vp-border); border-radius: 10px; }

/* ── LOADING SPINNER ─────────────────────────────────────────── */
.vp-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vp-spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes vp-spin { to { transform: rotate(360deg); } }

/* ── LIGNE FRAIS DE LIVRAISON ────────────────────────────────── */
.vp-breakdown__row--delivery-fees {
  background: #fdf4e7;
  color: #7c4a00;
  font-weight: 500;
}

.vp-breakdown__row--due-now {
  background: #1a1a2e;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  border-bottom: none;
}

/* ── RESPONSIVE (portrait/mobile) ───────────────────────────── */
@media (max-width: 680px) {
  .vp-popup {
    flex-direction: column;
    max-height: 92vh;
    width: 98vw;
  }
  .vp-popup__left {
    width: 100%;
    min-width: unset;
    flex-shrink: 0;
  }
  .vp-popup__car-visual { height: 120px; }

  /* ── Onglets toujours visibles et côte à côte en mobile ── */
  .vp-popup__tabs {
    flex-direction: row !important;
    display: flex !important;
    padding: 10px 10px 0 !important;
    gap: 8px !important;
    flex: unset !important;
  }
  .vp-tab {
    flex: 1;
    padding: 10px 6px !important;
    font-size: 11px !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 4px !important;
  }
  .vp-tab__icon { font-size: 18px !important; }
  .vp-tab__label { font-size: 11px !important; line-height: 1.2 !important; }

  .vp-popup__right {
    padding: 16px 12px 24px !important;
    overflow-y: auto;
    flex: 1;
  }

  .vp-panel__title { font-size: 16px; }
  .vp-breakdown__row { font-size: 12px; padding: 8px 10px; }
  .vp-breakdown__row--total,
  .vp-breakdown__row--due-now { font-size: 13px; }
}
