@import "./base.css";

/* ── Reset & base ──────────────────────────────────── */
html, body { margin: 0; }

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  overflow-y: auto;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

html.dark body { background: #0a1412; color: #f1f5f9; }

/* ── Shell — layout vertical ───────────────────────── */
.buy-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════════
   HEADER VERT COMPACT  (~28% de l'écran)
══════════════════════════════════════════════════ */
.buy-header {
  flex-shrink: 0;
  padding: 0 20px 32px;
  background:
    radial-gradient(ellipse 90% 70% at 105% -5%, rgba(251, 191, 36, 0.24) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at -5% 110%, rgba(110, 231, 183, 0.2) 0%, transparent 50%),
    linear-gradient(155deg, #068561 0%, #065f46 55%, #054d38 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}

html.dark .buy-header {
  background:
    radial-gradient(ellipse 90% 70% at 105% -5%, rgba(251, 191, 36, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at -5% 110%, rgba(110, 231, 183, 0.1) 0%, transparent 50%),
    linear-gradient(155deg, #071f18 0%, #041410 55%, #030e0b 100%);
}

/* Topbar */
.buy-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 14px;
  gap: 12px;
}

.buy-back {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.14);
  color: #fff;
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 120ms ease;
  flex-shrink: 0;
}
.buy-back:active { transform: scale(0.94); }
.buy-back svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }

.buy-topbar-brand { display: flex; align-items: center; gap: 7px; }
.buy-brand-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: #fbbf24;
  box-shadow: 0 0 10px rgba(251,191,36,0.7);
}
.buy-brand-label { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }

/* Theme btn */
.buy-theme-btn {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.14);
  color: #fff;
  cursor: pointer; padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 120ms ease;
  flex-shrink: 0;
}
.buy-theme-btn:active { transform: scale(0.94); }
.buy-theme-icon { width: 20px; height: 20px; stroke: currentColor; fill: none; }
.buy-icon-moon { display: none; }
html.dark .buy-icon-sun { display: none; }
html.dark .buy-icon-moon { display: block; }

/* Hero copy */
.buy-header-copy { padding: 0; }
.buy-eyebrow {
  margin: 0 0 5px;
  font-size: 10px; font-weight: 900;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255,255,255,0.58);
}
.buy-header-title {
  margin: 0;
  font-size: clamp(26px, 7vw, 36px);
  font-weight: 900; letter-spacing: -0.04em; line-height: 1;
  color: #fff;
}
.buy-header-sub {
  margin: 4px 0 0;
  font-size: 12px; font-weight: 600; line-height: 1.4;
  color: rgba(255,255,255,0.65);
}
.buy-header-sub:empty { display: none; }
.buy-router-hint {
  margin: 5px 0 0;
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.38);
}
.buy-router-hint:empty { display: none; }

/* Mode compte pill */
.buy-account-pill {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.2);
}
.buy-account-pill-icon {
  width: 30px; height: 30px; border-radius: 10px;
  background: rgba(251,191,36,0.9); color: #065f46;
  display: grid; place-items: center; flex-shrink: 0;
}
.buy-account-pill-icon svg { width: 16px; height: 16px; }
.buy-account-pill-info { flex: 1; min-width: 0; display: grid; gap: 1px; }
.buy-account-pill-info strong { font-size: 13px; font-weight: 900; color: #fff; }
.buy-account-pill-info span { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.7); }
.buy-account-pill-tag {
  font-size: 9px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 8px;
  background: rgba(251,191,36,0.22); color: #fde68a;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════
   PANEL BLANC DOMINANT  (~72% de l'écran)
══════════════════════════════════════════════════ */
.buy-panel {
  flex: 1;
  margin-top: -22px;
  border-radius: 28px 28px 0 0;
  background: #ffffff;
  box-shadow: 0 -2px 30px rgba(6,95,70,0.14);
  display: flex; flex-direction: column;
  overflow: visible;
  position: relative; z-index: 3;
}
html.dark .buy-panel {
  background: #111c1a;
  box-shadow: 0 -2px 30px rgba(0,0,0,0.35);
}

/* Sections internes */
.buy-section { padding: 0 20px; }

/* Alert */
.buy-alert {
  display: none;
  margin: 14px 20px 0;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(239,68,68,0.2);
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px; font-weight: 700; line-height: 1.4;
}
html.dark .buy-alert { background: rgba(69,10,10,0.5); border-color: rgba(248,113,113,0.28); color: #fecaca; }

/* ── Téléphone ─────────────────────────────────────── */
.buy-phone-section {
  padding: 18px 20px 14px;
  flex-shrink: 0;
}
.buy-field-label {
  display: block; margin-bottom: 8px;
  font-size: 10px; font-weight: 900;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(15,23,42,0.42);
}
html.dark .buy-field-label { color: rgba(226,232,240,0.38); }

.buy-input-wrap { position: relative; display: flex; align-items: center; }
.buy-input-icon {
  position: absolute; left: 14px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  color: #065f46; pointer-events: none; z-index: 1;
}
html.dark .buy-input-icon { color: #6ee7b7; }
.buy-input-icon svg { width: 18px; height: 18px; }
.buy-input-prefix {
  position: absolute; left: 42px;
  font-size: 15px; font-weight: 900;
  color: #0f172a; pointer-events: none; z-index: 1;
}
html.dark .buy-input-prefix { color: #e2e8f0; }

.buy-input {
  width: 100%; min-height: 52px;
  border: none; border-radius: 16px;
  padding: 14px 16px 14px 84px;
  background: #f0fdf4;
  box-shadow: inset 0 0 0 1.5px rgba(6,95,70,0.16);
  color: #0f172a;
  font: inherit; font-size: 16px; font-weight: 800;
  outline: none;
  transition: box-shadow 180ms ease, transform 160ms ease;
}
html.dark .buy-input {
  background: rgba(6,28,24,0.8);
  box-shadow: inset 0 0 0 1.5px rgba(110,231,183,0.14);
  color: #f1f5f9;
}
.buy-input::placeholder { color: rgba(15,23,42,0.28); font-weight: 700; }
html.dark .buy-input::placeholder { color: rgba(226,232,240,0.26); }
.buy-input:focus {
  box-shadow: inset 0 0 0 2px #065f46, 0 0 0 4px rgba(6,95,70,0.1);
  transform: translateY(-1px);
}
html.dark .buy-input:focus {
  box-shadow: inset 0 0 0 2px #6ee7b7, 0 0 0 4px rgba(110,231,183,0.1);
}

/* ── Onglets catégories ─────────────────────────────── */
.buy-tabs-section {
  padding: 0 20px 12px;
  flex-shrink: 0;
}
.buy-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #f1f5f9;
  border-radius: 18px;
  padding: 5px;
}
html.dark .buy-tabs { background: rgba(255,255,255,0.06); }

.buy-tab {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  padding: 9px 6px;
  border: none; border-radius: 13px;
  background: transparent;
  color: rgba(15,23,42,0.45);
  cursor: pointer; font: inherit;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 120ms ease;
}
html.dark .buy-tab { color: rgba(226,232,240,0.38); }

.buy-tab:active { transform: scale(0.96); }

.buy-tab.is-active {
  background: #ffffff;
  color: #065f46;
  box-shadow: 0 2px 12px rgba(6,95,70,0.14), 0 1px 3px rgba(15,23,42,0.06);
}
html.dark .buy-tab.is-active {
  background: rgba(6,95,70,0.28);
  color: #6ee7b7;
  box-shadow: 0 2px 12px rgba(6,95,70,0.2);
}

.buy-tab-icon {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  flex-shrink: 0;
}
.buy-tab-label {
  font-size: 11px; font-weight: 900;
  letter-spacing: 0.02em;
}

/* ── Liste des forfaits ─────────────────────────────── */
.buy-plans-list {
  padding: 0 20px;
}

/* On cache toutes les plan-group par défaut,
   JS les filtre via data-group-key + is-visible */
.buy-plans-scroll {
  padding-bottom: 4px;
}

/* plan-group — généré par JS */
.plan-group { margin-bottom: 14px; }
.plan-group:not(.is-visible) { display: none; }

.plan-group-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.plan-group-label {
  font-size: 10px; font-weight: 900;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(15,23,42,0.35);
}
html.dark .plan-group-label { color: rgba(226,232,240,0.32); }
.plan-group-line { height: 1px; flex: 1; background: rgba(15,23,42,0.07); }
html.dark .plan-group-line { background: rgba(255,255,255,0.07); }

.plan-list { display: grid; gap: 8px; }

/* Plan option card */
.plan-option {
  width: 100%;
  border: 1.5px solid rgba(15,23,42,0.08);
  border-radius: 16px;
  padding: 14px 16px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  font: inherit; color: inherit;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 140ms ease;
  position: relative;
}
html.dark .plan-option { border-color: rgba(255,255,255,0.07); background: rgba(255,255,255,0.04); }

.plan-option:hover {
  border-color: rgba(6,95,70,0.2);
  background: #f8fffe;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(6,95,70,0.08);
}
html.dark .plan-option:hover { border-color: rgba(110,231,183,0.14); background: rgba(6,95,70,0.08); }

.plan-option.active {
  border-color: #065f46;
  background: #f0fdf4;
  box-shadow: 0 8px 24px rgba(6,95,70,0.14), inset 0 1px 0 rgba(255,255,255,0.8);
}
html.dark .plan-option.active {
  border-color: rgba(110,231,183,0.45);
  background: rgba(6,78,59,0.2);
  box-shadow: 0 8px 20px rgba(6,78,59,0.2);
}

/* Check indicator */
.plan-option::before {
  content: "";
  width: 20px; height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(15,23,42,0.15);
  background: transparent;
  flex-shrink: 0;
  transition: border-color 160ms ease, background 160ms ease;
  display: block;
}
html.dark .plan-option::before { border-color: rgba(255,255,255,0.15); }

.plan-option.active::before {
  background: #065f46;
  border-color: #065f46;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 6L9 17l-5-5' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 14px 14px;
  background-position: center;
  background-repeat: no-repeat;
}
html.dark .plan-option.active::before { background-color: #6ee7b7; border-color: #6ee7b7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 6L9 17l-5-5' stroke='%23065f46' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.plan-meta { flex: 1; min-width: 0; display: grid; gap: 3px; }
.plan-name { font-size: 14px; font-weight: 900; letter-spacing: -0.01em; }
.plan-sub { font-size: 11px; font-weight: 700; color: rgba(15,23,42,0.42); }
html.dark .plan-sub { color: rgba(226,232,240,0.42); }

/* plan-details et plan-badges : cachés dans la card (affichés dans le panel détail) */
.plan-details, .plan-badges { display: none; }

.plan-price {
  font-size: 16px; font-weight: 900; letter-spacing: -0.03em;
  white-space: nowrap; color: #065f46;
  flex-shrink: 0;
}
html.dark .plan-price { color: #6ee7b7; }

/* ── Panel détail (affiché sous la liste quand plan sélectionné) ── */
.buy-detail-panel {
  flex-shrink: 0;
  margin: 0 20px 4px;
  border-radius: 18px;
  background: #f0fdf4;
  border: 1.5px solid rgba(6,95,70,0.16);
  overflow: hidden;
  animation: detail-in 220ms ease;
}
html.dark .buy-detail-panel {
  background: rgba(6,78,59,0.16);
  border-color: rgba(110,231,183,0.18);
}

@keyframes detail-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.buy-detail-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(6,95,70,0.1);
}
html.dark .buy-detail-header { border-bottom-color: rgba(110,231,183,0.1); }

.buy-detail-check {
  width: 28px; height: 28px; border-radius: 999px;
  background: #065f46; color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
html.dark .buy-detail-check { background: #6ee7b7; color: #065f46; }
.buy-detail-check svg { width: 14px; height: 14px; }

.buy-detail-title-wrap { flex: 1; min-width: 0; display: grid; gap: 2px; }
.buy-detail-name { font-size: 13px; font-weight: 900; letter-spacing: -0.01em; }
.buy-detail-duration { font-size: 11px; font-weight: 700; color: rgba(15,23,42,0.5); }
html.dark .buy-detail-duration { color: rgba(226,232,240,0.5); }
.buy-detail-price { font-size: 18px; font-weight: 900; letter-spacing: -0.03em; color: #065f46; flex-shrink: 0; }
html.dark .buy-detail-price { color: #6ee7b7; }

/* Stats row */
.buy-detail-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.buy-detail-stat {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 10px 6px;
  border-right: 1px solid rgba(6,95,70,0.08);
}
.buy-detail-stat:last-child { border-right: none; }
html.dark .buy-detail-stat { border-right-color: rgba(110,231,183,0.08); }

.buy-detail-stat-icon {
  width: 28px; height: 28px; border-radius: 10px;
  background: rgba(6,95,70,0.1);
  color: #065f46;
  display: grid; place-items: center;
}
html.dark .buy-detail-stat-icon { background: rgba(110,231,183,0.12); color: #6ee7b7; }
.buy-detail-stat-icon svg { width: 14px; height: 14px; }

.buy-detail-stat-body { display: grid; gap: 1px; text-align: center; }
.buy-detail-stat-label { font-size: 9px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(15,23,42,0.38); }
html.dark .buy-detail-stat-label { color: rgba(226,232,240,0.36); }
.buy-detail-stat-value { font-size: 11px; font-weight: 900; letter-spacing: -0.01em; color: #065f46; }
html.dark .buy-detail-stat-value { color: #6ee7b7; }

/* ── CTA ───────────────────────────────────────────── */
.buy-cta {
  flex-shrink: 0;
  padding: 10px 20px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid rgba(15,23,42,0.06);
  position: sticky;
  bottom: 0;
  z-index: 5;
}
html.dark .buy-cta { background: #111c1a; border-top-color: rgba(255,255,255,0.05); }

.buy-pay-btn {
  width: 100%; min-height: 54px;
  border: none; border-radius: 18px;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, #068561, #065f46);
  color: #ffffff;
  font: inherit; font-size: 13px; font-weight: 900;
  letter-spacing: 0.05em; text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(6,95,70,0.28), inset 0 1px 0 rgba(255,255,255,0.16);
  transition: transform 120ms ease, box-shadow 180ms ease, filter 180ms ease, opacity 180ms ease;
}
.buy-pay-btn:disabled {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  box-shadow: none; cursor: not-allowed; opacity: 0.7;
}
html.dark .buy-pay-btn:disabled { background: rgba(255,255,255,0.1); opacity: 0.5; }
.buy-pay-btn:not(:disabled):hover { filter: brightness(1.06); box-shadow: 0 18px 34px rgba(6,95,70,0.34); }
.buy-pay-btn:not(:disabled):active { transform: scale(0.98); }
.buy-pay-icon { width: 20px; height: 20px; stroke: currentColor; fill: none; flex-shrink: 0; }
.buy-pay-arrow { width: 18px; height: 18px; stroke: currentColor; fill: none; flex-shrink: 0; margin-left: auto; }
#buy-pay-label { flex: 1; }

/* ── Responsive ────────────────────────────────────── */
@media (max-height: 720px) {
  .buy-header { padding-bottom: 26px; }
  .buy-header-title { font-size: 24px; }
  .buy-phone-section { padding: 14px 20px 10px; }
  .buy-tabs-section { padding-bottom: 8px; }
  .buy-tab { padding: 7px 6px; }
  .plan-option { padding: 11px 14px; }
  .buy-detail-panel { margin-bottom: 2px; }
  .buy-detail-stat { padding: 8px 4px; }
  .buy-cta { padding: 8px 20px max(12px, env(safe-area-inset-bottom)); }
  .buy-pay-btn { min-height: 50px; font-size: 12px; }
}

@media (max-height: 620px) {
  .buy-header { padding-bottom: 20px; }
  .buy-eyebrow { display: none; }
  .buy-header-title { font-size: 22px; }
  .buy-header-sub, .buy-router-hint { display: none; }
  .buy-input { min-height: 46px; font-size: 14px; }
  .buy-tab-icon { display: none; }
  .buy-tab-label { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .buy-detail-panel { animation: none; }
  .plan-option, .buy-pay-btn, .buy-input, .buy-back, .buy-theme-btn { transition: none; }
}
