/* ============================================================
   KING PHARMA — Client Dashboard Pages CSS
   ============================================================ */

/* Page visibility */
.db-page { display: none; }
.db-page.active { display: block; animation: dbFadeIn .4s ease both; }

/* ======================== FORM CARDS ======================== */
.cp-form-card {
  background: var(--db-card); border-radius: 16px;
  padding: 32px; box-shadow: var(--shadow-card);
  max-width: 720px;
}

/* ======================== INPUTS ======================== */
.cp-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--db-text-sec); margin-bottom: 6px;
  font-family: var(--font-heading);
}
.cp-input {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--db-border);
  border-radius: 12px; font-size: 14px; font-family: var(--font-body);
  color: var(--db-text); background: var(--db-white);
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.cp-input:focus {
  outline: none; border-color: var(--db-accent);
  box-shadow: 0 0 0 3px rgba(0,201,123,.12);
}
textarea.cp-input { resize: vertical; min-height: 80px; }
select.cp-input { cursor: pointer; appearance: auto; }

/* ======================== STEP INDICATOR ======================== */
.cp-step-indicator {
  display: flex; gap: 8px; margin-bottom: 32px;
  padding-bottom: 24px; border-bottom: 1px solid var(--db-border);
}
.cp-step {
  flex: 1; text-align: center; padding: 10px; border-radius: 10px;
  font-size: 13px; font-weight: 600; font-family: var(--font-heading);
  color: var(--db-text-muted); background: var(--db-bg);
  transition: all .3s;
}
.cp-step.active {
  background: var(--db-accent); color: #fff;
  box-shadow: 0 2px 8px rgba(0,201,123,.3);
}

/* Step content */
.cp-step-content { display: none; }
.cp-step-content.active { display: block; animation: dbFadeIn .3s ease; }

/* ======================== RADIO GROUP ======================== */
.cp-radio-group { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.cp-radio {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px; border: 1.5px solid var(--db-border); border-radius: 12px;
  cursor: pointer; transition: all .2s;
}
.cp-radio:hover { border-color: var(--db-accent); background: var(--db-accent-light); }
.cp-radio input[type="radio"] { display: none; }
.cp-radio-mark {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--db-border); flex-shrink: 0;
  position: relative; transition: all .2s; margin-top: 2px;
}
.cp-radio input:checked ~ .cp-radio-mark {
  border-color: var(--db-accent);
}
.cp-radio input:checked ~ .cp-radio-mark::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--db-accent);
}
.cp-radio div strong { display: block; font-size: 14px; color: var(--db-text); font-family: var(--font-heading); }
.cp-radio div small { font-size: 12px; color: var(--db-text-sec); }

/* ======================== PRICE BOX ======================== */
.cp-price-box {
  background: var(--db-accent-light); border-radius: 12px;
  padding: 20px; margin-top: 20px;
  border-left: 4px solid var(--db-accent);
}
.cp-price-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.cp-price-row span { font-size: 14px; color: var(--db-text-sec); }
.cp-price-row strong { font-size: 20px; color: var(--db-accent); font-family: var(--font-heading); }
.cp-price-box small { font-size: 12px; color: var(--db-text-muted); }

/* ======================== ORDER FILTERS ======================== */
.cp-filters {
  display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}
.cp-filter {
  padding: 8px 20px; border-radius: 999px; border: 1.5px solid var(--db-border);
  background: var(--db-white); font-size: 13px; font-weight: 600;
  font-family: var(--font-heading); color: var(--db-text-sec);
  cursor: pointer; transition: all .2s;
}
.cp-filter:hover { border-color: var(--db-accent); color: var(--db-accent); }
.cp-filter.active {
  background: var(--db-accent); color: #fff; border-color: var(--db-accent);
}
.cp-empty {
  text-align: center; padding: 48px; color: var(--db-text-muted);
  font-size: 15px; background: var(--db-card); border-radius: 16px;
}

/* ======================== TRACKING ======================== */
.cp-tracking-steps {
  display: flex; align-items: center; padding: 32px 0;
  overflow-x: auto;
}
.cp-track-step { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 90px; }
.cp-track-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; font-family: var(--font-heading);
  background: var(--db-bg); color: var(--db-text-muted);
  border: 2px solid var(--db-border); transition: all .3s;
}
.cp-track-step.done .cp-track-dot {
  background: var(--db-accent); color: #fff; border-color: var(--db-accent);
}
.cp-track-step.current .cp-track-dot {
  box-shadow: 0 0 0 4px rgba(0,201,123,.25);
  animation: trackPulse 2s infinite;
}
@keyframes trackPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(0,201,123,.2); }
  50% { box-shadow: 0 0 0 8px rgba(0,201,123,.1); }
}
.cp-track-label { font-size: 11px; color: var(--db-text-sec); text-align: center; font-weight: 500; }
.cp-track-step.done .cp-track-label { color: var(--db-accent); font-weight: 600; }
.cp-track-line {
  flex: 1; height: 3px; background: var(--db-border);
  min-width: 20px; margin-bottom: 24px;
}

/* Map placeholder */
.cp-suivi-map {
  margin-top: 24px; border-radius: 16px; overflow: hidden;
  border: 1.5px solid var(--db-border);
}
.cp-map-placeholder {
  height: 250px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  gap: 8px;
}
.cp-map-placeholder p { font-family: var(--font-heading); font-weight: 600; color: var(--db-text); font-size: 15px; }
.cp-map-placeholder small { color: var(--db-text-sec); font-size: 13px; }

/* ======================== NOTIFICATIONS (composant unifié 4 espaces) ========================
   Couleurs par TYPE (info, success, warning, error, payment, etc.) — découplé du rôle.
   Icônes Material Symbols Outlined via ligature CSS (zéro JS).
   Variables locales --notif-tint/--notif-color permettent de teinter
   l'ombre/bordure de la carte selon le type de la notification.            */
.cp-notif-card {
  --notif-tint: 16,185,129;        /* fallback : accent vert (rgb sans rgba) */
  --notif-color: var(--db-accent); /* couleur d'accent du type */
  --notif-bg: var(--db-accent-light);

  display: flex; gap: 16px; padding: 18px 56px 18px 18px;
  background: var(--db-card); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.08);
  cursor: pointer;
  border: 1px solid var(--db-border);
  border-left: 4px solid transparent;
  position: relative; overflow: hidden;
  transition:
    transform .25s cubic-bezier(.22,1,.36,1),
    box-shadow .25s ease,
    background .25s ease,
    border-color .25s ease;
}

/* Ruban diagonal très subtil dans le coin (touche premium) */
.cp-notif-card::before {
  content: ''; position: absolute; top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right,
              rgba(var(--notif-tint), .08) 0%,
              rgba(var(--notif-tint), 0) 70%);
  pointer-events: none;
  transition: opacity .25s ease;
}

.cp-notif-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 4px 8px rgba(15,23,42,.04),
    0 24px 48px -16px rgba(var(--notif-tint), .25);
  border-color: rgba(var(--notif-tint), .35);
}
.cp-notif-card:active { transform: translateY(-1px); transition-duration: .08s; }

/* Chevron qui apparaît au hover (indique l'interactivité) */
.cp-notif-card .cp-notif-chevron {
  position: absolute; top: 50%; right: 18px;
  transform: translate(8px, -50%);
  opacity: 0;
  font-family: 'Material Symbols Outlined'; font-size: 20px;
  color: var(--notif-color);
  transition: transform .25s cubic-bezier(.22,1,.36,1), opacity .2s ease;
  font-feature-settings: 'liga';
  pointer-events: none;
}
.cp-notif-card .cp-notif-chevron::before { content: 'chevron_right'; }
.cp-notif-card:hover .cp-notif-chevron { opacity: 1; transform: translate(0, -50%); }

/* ── État LU : discret, sans ostentation ── */
.cp-notif-card.read { background: var(--db-card); }
.cp-notif-card.read::before { opacity: .35; }
.cp-notif-card.read .cp-notif-title { font-weight: 600; color: var(--db-text-sec); }
.cp-notif-card.read .cp-notif-type-dot { filter: saturate(.65) opacity(.85); }

/* ── État NON LU : accent fort, glow tinté ── */
.cp-notif-card.unread {
  border-left-color: var(--notif-color);
  background: linear-gradient(135deg,
              rgba(var(--notif-tint), .06) 0%,
              var(--db-card) 60%);
  box-shadow:
    0 1px 2px rgba(15,23,42,.04),
    0 12px 32px -14px rgba(var(--notif-tint), .35);
}
.cp-notif-card.unread .cp-notif-title { font-weight: 700; color: var(--db-text); }

/* Pastille "non lu" pulsée — anneau halo + cœur plein */
.cp-notif-card.unread::after {
  content: ''; position: absolute; top: 16px; right: 16px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--notif-color);
  box-shadow: 0 0 0 0 rgba(var(--notif-tint), .55);
  animation: cpNotifPulse 1.8s ease-out infinite;
}
@keyframes cpNotifPulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--notif-tint), .55); }
  70%  { box-shadow: 0 0 0 10px rgba(var(--notif-tint), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--notif-tint), 0); }
}

/* ── Badge ICÔNE : dégradé + ombre teintée par type ── */
.cp-notif-dot-wrap { padding-top: 1px; }
.cp-notif-type-dot {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,
              rgba(var(--notif-tint), .18) 0%,
              rgba(var(--notif-tint), .08) 100%);
  color: var(--notif-color);
  flex-shrink: 0;
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(var(--notif-tint), .15),
    0 6px 14px -6px rgba(var(--notif-tint), .45);
  transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .25s ease;
}
.cp-notif-card:hover .cp-notif-type-dot {
  transform: scale(1.06) rotate(-3deg);
  box-shadow:
    inset 0 0 0 1px rgba(var(--notif-tint), .25),
    0 10px 22px -8px rgba(var(--notif-tint), .6);
}
.cp-notif-type-dot::before {
  font-family: 'Material Symbols Outlined';
  font-weight: 500; font-style: normal; font-size: 22px; line-height: 1;
  letter-spacing: normal; text-transform: none; white-space: nowrap;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga';
  content: 'notifications';
}

/* ── Mapping TYPE → couleur + icône (déclenche --notif-tint via cascade) ── */
.cp-notif-card[class*="cp-notif-card"] { /* précédence */ }
.cp-notif-card:has(.cp-notif-type-dot.info),
.cp-notif-card:has(.cp-notif-type-dot.statut_change)        { --notif-tint: 59,130,246; --notif-color:#3B82F6; }
.cp-notif-card:has(.cp-notif-type-dot.success),
.cp-notif-card:has(.cp-notif-type-dot.code_pin),
.cp-notif-card:has(.cp-notif-type-dot.paiement_recu),
.cp-notif-card:has(.cp-notif-type-dot.paiement_recu_admin),
.cp-notif-card:has(.cp-notif-type-dot.paiement)             { --notif-tint: 16,185,129; --notif-color:#10B981; }
.cp-notif-card:has(.cp-notif-type-dot.warning),
.cp-notif-card:has(.cp-notif-type-dot.promo),
.cp-notif-card:has(.cp-notif-type-dot.paiement_initie)      { --notif-tint: 245,158,11; --notif-color:#F59E0B; }
.cp-notif-card:has(.cp-notif-type-dot.error),
.cp-notif-card:has(.cp-notif-type-dot.echec),
.cp-notif-card:has(.cp-notif-type-dot.paiement_echec)       { --notif-tint: 239,68,68;  --notif-color:#EF4444; }
.cp-notif-card:has(.cp-notif-type-dot.candidature)          { --notif-tint: 99,102,241; --notif-color:#6366F1; }

/* Repli pour navigateurs sans :has() — couleurs sur le badge directement.
   La carte reste verte par défaut mais le badge est bien teinté. */
.cp-notif-type-dot.info,
.cp-notif-type-dot.statut_change         { --notif-tint: 59,130,246; --notif-color:#3B82F6;
                                            background:linear-gradient(135deg,#DBEAFE,#EFF6FF); color:#3B82F6; }
.cp-notif-type-dot.success,
.cp-notif-type-dot.code_pin,
.cp-notif-type-dot.paiement_recu,
.cp-notif-type-dot.paiement_recu_admin,
.cp-notif-type-dot.paiement              { --notif-tint: 16,185,129; --notif-color:#10B981;
                                            background:linear-gradient(135deg,#D1FAE5,#ECFDF5); color:#10B981; }
.cp-notif-type-dot.warning,
.cp-notif-type-dot.promo,
.cp-notif-type-dot.paiement_initie       { --notif-tint: 245,158,11; --notif-color:#F59E0B;
                                            background:linear-gradient(135deg,#FEF3C7,#FFF7ED); color:#F59E0B; }
.cp-notif-type-dot.error,
.cp-notif-type-dot.echec,
.cp-notif-type-dot.paiement_echec        { --notif-tint: 239,68,68;  --notif-color:#EF4444;
                                            background:linear-gradient(135deg,#FEE2E2,#FEF2F2); color:#EF4444; }
.cp-notif-type-dot.candidature           { --notif-tint: 99,102,241; --notif-color:#6366F1;
                                            background:linear-gradient(135deg,#E0E7FF,#EEF2FF); color:#6366F1; }

/* Icônes par type (ligature Material Symbols) */
.cp-notif-type-dot.info::before               { content:'info'; }
.cp-notif-type-dot.success::before            { content:'check_circle'; }
.cp-notif-type-dot.warning::before,
.cp-notif-type-dot.promo::before              { content:'local_offer'; }
.cp-notif-type-dot.error::before,
.cp-notif-type-dot.echec::before,
.cp-notif-type-dot.paiement_echec::before     { content:'error'; }
.cp-notif-type-dot.statut_change::before      { content:'local_shipping'; }
.cp-notif-type-dot.code_pin::before           { content:'password'; }
.cp-notif-type-dot.paiement_recu::before,
.cp-notif-type-dot.paiement_recu_admin::before,
.cp-notif-type-dot.paiement::before           { content:'payments'; }
.cp-notif-type-dot.paiement_initie::before    { content:'hourglass_top'; }
.cp-notif-type-dot.candidature::before        { content:'badge'; }

/* ── Corps texte ── */
.cp-notif-body { flex: 1; min-width: 0; }
.cp-notif-title {
  font-family: var(--font-heading);
  font-weight: 700; font-size: 14.5px;
  color: var(--db-text);
  margin-bottom: 4px;
  letter-spacing: -.01em;
}
.cp-notif-msg {
  font-size: 13.5px; color: var(--db-text-sec);
  line-height: 1.55; word-break: break-word;
}
.cp-notif-time {
  font-size: 11.5px; color: var(--db-text-muted);
  margin-top: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.cp-notif-time::before {
  content: 'schedule'; font-family: 'Material Symbols Outlined';
  font-size: 14px; line-height: 1; font-feature-settings: 'liga';
  opacity: .7;
}

/* ── Apparition en cascade (légère) ── */
.cp-notif-card.db-fade-in { animation: cpNotifIn .42s cubic-bezier(.22,1,.36,1) both; }
@keyframes cpNotifIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Mobile : badge légèrement plus petit, chevron caché */
@media (max-width: 640px) {
  .cp-notif-card { padding: 14px 18px 14px 14px; border-radius: 14px; gap: 12px; }
  .cp-notif-type-dot { width: 38px; height: 38px; border-radius: 11px; }
  .cp-notif-type-dot::before { font-size: 19px; }
  .cp-notif-card .cp-notif-chevron { display: none; }
}

/* Préférence : moins d'animation pour les utilisateurs sensibles */
@media (prefers-reduced-motion: reduce) {
  .cp-notif-card,
  .cp-notif-card .cp-notif-chevron,
  .cp-notif-type-dot { transition: none; }
  .cp-notif-card.unread::after,
  .cp-notif-card.db-fade-in { animation: none; }
}

/* ======================== SUPPORT ======================== */
.cp-support-options {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.cp-support-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 24px 16px; border-radius: 14px;
  border: 1.5px solid var(--db-border); text-decoration: none;
  color: var(--db-text); transition: all .2s; text-align: center;
}
.cp-support-card:hover { border-color: var(--db-accent); background: var(--db-accent-light); transform: translateY(-2px); }
.cp-support-card h4 { font-family: var(--font-heading); font-size: 14px; font-weight: 600; margin: 0; }
.cp-support-card p { font-size: 12px; color: var(--db-text-sec); margin: 0; }

/* ======================== TOAST ======================== */
.cp-toast {
  position: fixed; bottom: -60px; left: 50%; transform: translateX(-50%);
  background: var(--db-primary); color: #fff; padding: 14px 28px;
  border-radius: 12px; font-size: 14px; font-weight: 500;
  font-family: var(--font-heading); z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transition: bottom .4s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
}
.cp-toast.show { bottom: 32px; }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 768px) {
  .cp-form-card { padding: 20px; }
  .cp-support-options { grid-template-columns: 1fr; }
  .cp-step-indicator { flex-direction: column; }
  .cp-tracking-steps { flex-wrap: nowrap; padding: 16px 0; }
  .db-order-details { grid-template-columns: 1fr !important; }
  .cp-toast.show { bottom: 80px; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE EXTRA — client-pages.css
   ════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .cp-form-card { padding: 28px 24px; border-radius: 16px; }
}
@media (max-width: 768px) {
  .cp-form-card { padding: 24px 18px; border-radius: 14px; margin-bottom: 16px; }
  .cp-step-indicator { gap: 8px; padding: 14px; margin-bottom: 20px; }
  .cp-step { font-size: 12px; }
  .cp-label { font-size: 13px; }
  .cp-input { padding: 12px 14px; font-size: 16px; min-height: 44px; }
  .cp-radio-group { gap: 8px; }
  .cp-radio { padding: 14px; border-radius: 10px; min-height: 60px; }
  .cp-radio div strong { font-size: 14px; }
  .cp-radio div small { font-size: 12px; }
  .cp-tracking-steps { flex-direction: column; gap: 0; padding: 0; }
  .cp-track-step { flex-direction: row; align-items: center; padding: 12px 0; }
  .cp-track-line { width: 2px; height: 16px; margin: 0 0 0 14px; }
  .cp-track-label { font-size: 13px; margin-left: 12px; }
  .cp-price-box { padding: 16px; }
  .cp-suivi-map iframe { height: 200px !important; }
  .cp-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .cp-filter { white-space: nowrap; min-height: 36px; }
  .cp-support-card { padding: 18px 16px; min-height: 110px; }
  .cp-notif-card { padding: 14px 16px; }
  .cp-notif-title { font-size: 14px; }
  .cp-notif-msg { font-size: 13px; }
  .cp-empty { padding: 32px 16px; font-size: 14px; }
}
@media (max-width: 640px) {
  .cp-form-card { padding: 20px 16px; border-radius: 12px; }
  .cp-step { font-size: 11px; }
  .cp-step-indicator { gap: 4px; padding: 10px; }
  .cp-suivi-map iframe { height: 180px !important; }
  .cp-tracking-steps { padding: 8px 0; }
}
@media (max-width: 480px) {
  .cp-form-card { padding: 18px 14px; }
  .cp-radio { padding: 12px 14px; }
  .cp-price-box { padding: 14px; border-radius: 12px; }
}
@media (max-width: 380px) {
  .cp-step-indicator { display: none; }
  .cp-form-card { padding: 16px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .cp-step-content.active { animation: none !important; }
}
