/**
 * Modales panier → commande → succès
 * Palette Sugar Paper
 */

.ckm-root {
  --ckm-rose: #E5488A;
  --ckm-turquoise: #20C5C7;
  --ckm-orange: #F77F00;
  --ckm-texte: #3d2800;
  --ckm-fond: #ffffff;
  position: fixed;
  inset: 0;
  z-index: 12100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  font-family: 'Poppins', system-ui, sans-serif;
}

.ckm-root[hidden] {
  display: none !important;
}

.ckm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 20, 32, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: ckmFade 0.28s ease;
}

@keyframes ckmFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ckm-stage {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(92dvh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--ckm-fond);
  border-radius: 20px;
  border: 1px solid rgba(229, 72, 138, 0.16);
  box-shadow: 0 24px 64px rgba(42, 20, 32, 0.22);
  overflow: hidden;
  animation: ckmPop 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.ckm-body {
  flex: 1 1 auto;
  min-height: 220px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.ckm-panel {
  display: none;
  padding: 16px;
}

.ckm-panel.is-active {
  display: block;
  animation: ckmSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ckmPop {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.ckm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(229, 72, 138, 0.12);
  background: linear-gradient(180deg, #fff 0%, #fffafc 100%);
  flex-shrink: 0;
}

.ckm-header__title {
  flex: 1;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ckm-texte);
}

.ckm-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: rgba(229, 72, 138, 0.08);
  color: var(--ckm-texte);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.ckm-icon-btn:hover {
  background: rgba(229, 72, 138, 0.16);
  transform: translateY(-1px);
}

.ckm-icon-btn[hidden] {
  display: none !important;
}

.ckm-panel.is-active.ckm-dir-back {
  animation-name: ckmSlideBack;
}

@keyframes ckmSlideIn {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}

@keyframes ckmSlideBack {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: none; }
}

.ckm-flash {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.ckm-flash--success {
  background: rgba(32, 197, 199, 0.12);
  border: 1px solid rgba(32, 197, 199, 0.28);
}

.ckm-flash--error {
  background: rgba(229, 72, 138, 0.1);
  border: 1px solid rgba(229, 72, 138, 0.28);
}

.ckm-empty {
  text-align: center;
  padding: 48px 16px;
}

.ckm-empty__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(229, 72, 138, 0.1);
  color: var(--ckm-rose);
  font-size: 1.6rem;
}

.ckm-empty__title {
  font-weight: 700;
  margin: 0 0 6px;
}

.ckm-empty__text {
  color: rgba(61, 40, 0, 0.65);
  margin: 0 0 18px;
}

.ckm-item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(229, 72, 138, 0.1);
}

.ckm-item__img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 12px;
  background: #f7f3f5;
}

.ckm-item__name {
  margin: 0 0 2px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ckm-texte);
}

.ckm-item__cat,
.ckm-item__opts {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(61, 40, 0, 0.6);
}

.ckm-item__perso {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.ckm-item__perso-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ckm-rose);
  white-space: nowrap;
}

.ckm-item__perso-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(229, 72, 138, 0.35);
}

.ckm-recap-item__perso {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ckm-rose);
}

.ckm-recap-item__perso img {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 4px;
  border: 1px solid rgba(229, 72, 138, 0.35);
}

.ckm-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  vertical-align: -1px;
}

.ckm-item__price {
  margin: 4px 0 0;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ckm-rose);
}

.ckm-item__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.ckm-qty-form {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(229, 72, 138, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.ckm-qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: var(--ckm-texte);
}

.ckm-qty-input {
  width: 42px;
  border: none;
  text-align: center;
  font-weight: 700;
  background: transparent;
}

.ckm-item__remove {
  border: none;
  background: rgba(229, 72, 138, 0.08);
  color: var(--ckm-rose);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
}

.ckm-item__line {
  margin-left: auto;
  font-weight: 700;
  font-size: 0.88rem;
}

.ckm-summary {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fffafc, #ffffff);
  border: 1px solid rgba(229, 72, 138, 0.14);
}

.ckm-summary__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.ckm-summary__row--muted {
  color: rgba(61, 40, 0, 0.55);
}

.ckm-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(229, 72, 138, 0.25);
  font-size: 1.05rem;
}

.ckm-summary__total strong {
  color: var(--ckm-rose);
}

.ckm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s, filter 0.18s;
}

.ckm-btn:hover {
  transform: translateY(-1px);
}

.ckm-btn--primary {
  background: var(--ckm-rose);
  color: #fff;
  box-shadow: 0 8px 20px rgba(229, 72, 138, 0.28);
}

.ckm-btn--ghost {
  background: rgba(61, 40, 0, 0.06);
  color: var(--ckm-texte);
}

.ckm-btn--whatsapp {
  background: #25D366;
  color: #fff;
  margin: 8px 0 14px;
}

.ckm-checkout__grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 16px;
}

.ckm-field {
  margin-bottom: 14px;
}

.ckm-field label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.ckm-field input,
.ckm-field select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid rgba(229, 72, 138, 0.2);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.ckm-field input:focus,
.ckm-field select:focus {
  outline: none;
  border-color: var(--ckm-rose);
  box-shadow: 0 0 0 3px rgba(229, 72, 138, 0.14);
}

.ckm-checkout__recap {
  padding: 14px;
  border-radius: 16px;
  background: #fffafc;
  border: 1px solid rgba(229, 72, 138, 0.12);
  height: fit-content;
}

.ckm-checkout__recap-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.ckm-recap-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.78rem;
}

.ckm-recap-item img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
}

.ckm-recap-item strong {
  display: block;
}

.ckm-recap-item em {
  font-style: normal;
  font-weight: 700;
}

.cmd-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  background: rgba(229, 72, 138, 0.08);
  border-radius: 12px;
}

.cmd-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border: 2px solid rgba(229, 72, 138, 0.22);
  border-radius: 10px;
  background: #fff;
  color: var(--ckm-texte);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.cmd-mode-btn.is-active {
  background: var(--ckm-rose);
  color: #fff;
  border-color: var(--ckm-rose);
}

.cmd-mode-panel { display: none; }
.cmd-mode-panel.is-visible { display: block; }

.cmd-retrait-info {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(32, 197, 199, 0.1);
  border: 1px dashed rgba(32, 197, 199, 0.4);
  font-size: 0.86rem;
  margin-bottom: 12px;
}

.commande-geo-box {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(229, 72, 138, 0.16);
  background: #fff;
}

.commande-geo-map {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  background: #f3f0e8;
}

.commande-geo-map .leaflet-container {
  width: 100%;
  height: 100%;
  min-height: 200px;
}

.btn-commande-geo-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: var(--ckm-turquoise);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: inherit;
}

.commande-geo-status {
  font-size: 0.8rem;
  padding: 8px 10px;
  border-radius: 8px;
  display: none;
}

.ckm-success {
  text-align: center;
  padding: 28px 12px 12px;
}

.ckm-success__icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ckm-rose), var(--ckm-orange));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 10px 24px rgba(229, 72, 138, 0.3);
}

.ckm-success__title {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.ckm-success__numero {
  display: inline-block;
  margin: 8px 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(229, 72, 138, 0.1);
  font-weight: 700;
}

.ckm-success__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ckm-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(4px);
}

.ckm-loader[hidden] { display: none !important; }

.ckm-loader__card {
  text-align: center;
  padding: 24px;
}

.ckm-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(229, 72, 138, 0.2);
  border-top-color: var(--ckm-rose);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: ckmSpin 0.8s linear infinite;
}

@keyframes ckmSpin { to { transform: rotate(360deg); } }

body.ckm-open {
  overflow: hidden;
}

body.ckm-open #bottomNav,
body.ckm-open .social-floating {
  display: none !important;
}

@media (max-width: 760px) {
  .ckm-root {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    align-items: flex-end;
  }

  .ckm-stage {
    width: 100%;
    max-height: min(92dvh, calc(100dvh - 16px));
    border-radius: 16px 16px 12px 12px;
  }

  .ckm-body {
    min-height: 0;
  }

  .ckm-header {
    padding: 8px 10px;
    gap: 6px;
  }

  .ckm-header__title {
    font-size: 0.92rem;
  }

  .ckm-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .ckm-panel {
    padding: 10px;
  }

  .ckm-checkout__grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ckm-field {
    margin-bottom: 8px;
  }

  .ckm-field label {
    font-size: 0.72rem;
    margin-bottom: 4px;
  }

  .ckm-field input,
  .ckm-field select {
    padding: 8px 10px;
    font-size: 0.82rem;
    border-radius: 8px;
  }

  .cmd-mode-switch {
    gap: 6px;
    margin-bottom: 10px;
    padding: 4px;
    border-radius: 10px;
  }

  .cmd-mode-btn {
    padding: 8px 6px;
    font-size: 0.75rem;
    gap: 5px;
    border-radius: 8px;
    border-width: 1.5px;
  }

  .cmd-retrait-info {
    padding: 8px 10px;
    font-size: 0.75rem;
    margin-bottom: 8px;
  }

  .commande-geo-box {
    padding: 8px;
    border-radius: 10px;
  }

  .commande-geo-map,
  .commande-geo-map .leaflet-container {
    height: 128px;
    min-height: 128px;
    margin-bottom: 6px;
  }

  .btn-commande-geo-refresh {
    padding: 6px 10px;
    font-size: 0.72rem;
    margin-bottom: 6px;
  }

  .commande-geo-status {
    font-size: 0.7rem;
    padding: 6px 8px;
  }

  .ckm-checkout__recap {
    padding: 10px;
    border-radius: 12px;
  }

  .ckm-checkout__recap-title {
    font-size: 0.82rem;
    margin-bottom: 8px;
  }

  .ckm-recap-item {
    grid-template-columns: 36px 1fr auto;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.7rem;
  }

  .ckm-recap-item img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
  }

  .ckm-summary__row {
    font-size: 0.75rem;
    margin-bottom: 5px;
  }

  .ckm-summary__total {
    margin: 8px 0 10px;
    padding-top: 8px;
    font-size: 0.92rem;
  }

  .ckm-btn {
    min-height: 40px;
    font-size: 0.82rem;
    border-radius: 10px;
    gap: 6px;
  }

  .ckm-success {
    padding: 12px 6px 6px;
  }

  .ckm-success__icon {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
    font-size: 1.1rem;
    box-shadow: 0 6px 14px rgba(229, 72, 138, 0.24);
  }

  .ckm-success__title {
    font-size: 1.05rem;
    margin-bottom: 4px;
  }

  .ckm-success__text {
    font-size: 0.78rem;
    margin: 0 0 6px;
  }

  .ckm-success__numero {
    margin: 4px 0;
    padding: 4px 10px;
    font-size: 0.78rem;
  }

  .ckm-success__montant {
    font-size: 0.95rem;
    margin: 4px 0 6px;
    font-weight: 700;
  }

  .ckm-btn--whatsapp {
    margin: 6px 0 8px;
  }

  .ckm-success__actions {
    gap: 6px;
  }

  .ckm-item {
    grid-template-columns: 56px 1fr;
    gap: 8px;
    padding: 8px 0;
  }

  .ckm-item__img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
  }

  .ckm-item__name {
    font-size: 0.82rem;
  }

  .ckm-summary {
    margin-top: 10px;
    padding: 10px;
    border-radius: 12px;
  }
}

@media (max-width: 420px) {
  .ckm-root {
    padding: max(4px, env(safe-area-inset-top)) 4px max(4px, env(safe-area-inset-bottom));
  }

  .ckm-stage {
    max-height: min(96dvh, 100%);
    border-radius: 14px 14px 8px 8px;
  }

  .ckm-header {
    padding: 6px 8px;
  }

  .ckm-header__title {
    font-size: 0.85rem;
  }

  .ckm-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .ckm-panel {
    padding: 8px;
  }

  .commande-geo-map,
  .commande-geo-map .leaflet-container {
    height: 108px;
    min-height: 108px;
  }

  .cmd-mode-btn {
    padding: 7px 4px;
    font-size: 0.7rem;
  }

  .ckm-btn {
    min-height: 36px;
    font-size: 0.76rem;
  }

  .ckm-success {
    padding: 8px 4px 4px;
  }

  .ckm-success__icon {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
    margin-bottom: 6px;
  }

  .ckm-success__title {
    font-size: 0.95rem;
  }

  .ckm-success__text {
    font-size: 0.72rem;
  }
}
