/* ============================================================
   Auto Perfectionnement – Client Dashboard v1.5.0
   ============================================================ */

.apcd-wrap {
  --ap-red:     #e8292d;
  --ap-red-h:   #c4191d;
  --ap-pink:    #fff0f0;
  --ap-border:  #e4e8ef;
  --ap-text:    #0f172a;
  --ap-muted:   #64748b;
  --ap-bg:      #f8fafc;
  --ap-white:   #ffffff;
  --ap-shadow:  0 2px 10px rgba(15,23,42,.09);
  --ap-radius:  14px;
  --ap-rsm:     9px;

  display: grid;
  grid-template-columns: 250px minmax(0,1fr);
  gap: 28px;
  width: 100%;
  min-height: 420px;
  background: var(--ap-bg);
  color: var(--ap-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  box-sizing: border-box;
}
.apcd-wrap * { box-sizing: border-box; }

/* ── Sidebar ── */
.apcd-sidebar { padding: 22px 10px 18px 14px; background: var(--ap-bg); }

.apcd-nav {
  appearance: none;
  width: 100%; height: 44px;
  border: 0; border-radius: var(--ap-rsm);
  background: transparent; color: var(--ap-text);
  display: flex; align-items: center; gap: 11px;
  padding: 0 14px; margin: 0 0 6px;
  font-size: 14.5px; font-weight: 500;
  line-height: 1; cursor: pointer; text-align: left;
  transition: background .14s, color .14s;
}
.apcd-nav svg { width: 17px; height: 17px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex:0 0 17px; }
.apcd-nav:hover { background: var(--ap-pink); color: var(--ap-red); }
.apcd-nav.is-active { background: var(--ap-red); color: #fff; }
.apcd-nav.is-active:hover { background: var(--ap-red-h); }

/* ── Main ── */
.apcd-main { padding: 22px 32px 70px 0; min-width: 0; }
.apcd-panel { display: none; }
.apcd-panel.is-active { display: block; }
.apcd-panel h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 10px; }
.apcd-subtitle { font-size: 15px; color: #374151; margin: 0 0 28px; }

/* ── Cards ── */
.apcd-card {
  background: var(--ap-white);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
}

/* ── Stats ── */
.apcd-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px,1fr));
  gap: 16px; margin-bottom: 32px;
}
.apcd-stat-card {
  height: 142px; padding: 20px 22px;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.apcd-stat-icon {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--ap-pink); color: var(--ap-red);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.apcd-stat-icon svg { width: 20px; height: 20px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.apcd-stat-card strong { font-size: 32px; font-weight: 800; line-height: .95; margin: 0 0 10px; }
.apcd-stat-card span:last-child { font-size: 14px; color: var(--ap-muted); }

/* ── Buttons ── */
.apcd-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 42px; padding: 0 20px; border-radius: var(--ap-rsm);
  background: var(--ap-red); border: 0; color: #fff !important;
  text-decoration: none !important; font-size: 14.5px; font-weight: 600;
  box-shadow: 0 6px 14px rgba(232,41,45,.2); cursor: pointer;
  transition: background .15s, transform .12s;
}
.apcd-primary:hover { background: var(--ap-red-h); transform: translateY(-1px); color: #fff !important; }
.apcd-primary:active { transform: translateY(0); }
.apcd-primary svg { width: 16px; height: 16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.apcd-small { min-height: 38px; padding: 0 18px; font-size: 13.5px; }

.apcd-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--ap-border); background: var(--ap-white);
  color: var(--ap-text) !important; border-radius: var(--ap-rsm);
  padding: 8px 14px; text-decoration: none !important; font-weight: 600; font-size: 13.5px;
  transition: border-color .15s, background .15s;
}
.apcd-secondary:hover { border-color: var(--ap-red); background: var(--ap-pink); }

/* ── Panel head ── */
.apcd-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }

/* ── Reservation list ── */
.apcd-table-card { min-height: 90px; padding: 0; }
.apcd-empty { width: 100%; text-align: center; color: var(--ap-muted); font-size: 16px; padding: 40px 10px; }
.apcd-reservation-list { width: 100%; }
.apcd-reservation-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto auto;
  gap: 16px; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.apcd-reservation-row:hover { background: #fafbfc; }
.apcd-reservation-row:last-child { border-bottom: 0; }
.apcd-reservation-row strong { display: block; font-size: 14.5px; margin-bottom: 4px; }
.apcd-reservation-row span   { font-size: 13.5px; color: var(--ap-muted); }
.apcd-reservation-row small  { display: block; margin-top: 4px; color: #94a3b8; font-size: 12px; }
.apcd-price { font-weight: 800; color: var(--ap-text) !important; white-space: nowrap; }

/* ── Status badges ── */
.apcd-status, .apcd-badge {
  display: inline-flex; align-items: center;
  border-radius: 999px; background: #1e293b; color: #fff !important;
  font-size: 11.5px !important; font-weight: 700;
  padding: 5px 11px; white-space: nowrap;
}
.apcd-status.is-confirmed { background: #16a34a !important; }
.apcd-status.is-pending   { background: #d97706 !important; }
.apcd-badge.en_cours  { background: #d97706 !important; }
.apcd-badge.acquis    { background: #0ea5e9 !important; }
.apcd-badge.maitrise  { background: var(--ap-red) !important; }
.apcd-badge.non_acquis{ background: #1e293b !important; }
.apcd-status.active   { background: #16a34a !important; }
.apcd-status.expired, .apcd-status.used, .apcd-status.cancelled { background: #1e293b !important; }

/* ── Pay button ── */
.apcd-pay-btn {
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  min-height: 38px !important; padding: 0 18px !important;
  border: 0 !important; border-radius: var(--ap-rsm) !important;
  background: var(--ap-red) !important; color: #fff !important;
  text-decoration: none !important; font-size: 13.5px !important; font-weight: 700 !important;
  box-shadow: 0 6px 14px rgba(232,41,45,.2) !important;
  cursor: pointer !important; white-space: nowrap !important;
  transition: background .15s !important;
}
.apcd-pay-btn:hover { background: var(--ap-red-h) !important; }
.apcd-pay-btn:disabled { opacity: .6 !important; cursor: wait !important; }

.apcd-credit-note {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: #ecfdf5; color: #047857;
  padding: 5px 10px; font-weight: 700; font-size: 12px; white-space: nowrap;
}

/* ── Credits ── */
.apcd-credit-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.apcd-credit-card { min-height: 180px; padding: 0; }
.apcd-credit-help {
  margin: 16px 16px 0; padding: 12px 14px;
  border-radius: var(--ap-rsm);
  background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; font-size: 13px;
}
.apcd-credit-help strong { color: #c2410c; }
.apcd-credit-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 13px; padding: 42px 20px;
  color: var(--ap-muted); text-align: center;
}
.apcd-credit-empty svg { width: 48px; height: 48px; fill:none; stroke:#9ca3af; stroke-width:2; }
.apcd-credit-empty p { font-size: 16px; margin: 0; }
.apcd-credit-list { width: 100%; padding: 0; }
.apcd-credit-row {
  display: grid; grid-template-columns: minmax(0,1fr) auto;
  gap: 18px; align-items: center;
  padding: 18px 20px; border-bottom: 1px solid #f1f5f9;
}
.apcd-credit-row:last-child { border-bottom: 0; }
.apcd-credit-info strong { display: block; font-size: 15px; margin-bottom: 5px; }
.apcd-credit-info span   { display: block; font-size: 14px; color: var(--ap-text); margin-bottom: 4px; }
.apcd-credit-info small  { display: block; font-size: 12.5px; color: var(--ap-muted); margin-bottom: 10px; }
.apcd-credit-progress { height: 7px; border-radius: 999px; background: #ffe0e1; overflow: hidden; }
.apcd-credit-progress span { display: block; height: 100%; background: var(--ap-red); border-radius: 999px; transition: width .4s; }

/* ── Documents upload ── */
.apcd-upload-card { padding: 24px 22px 20px; margin-bottom: 24px; }
.apcd-upload-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 13px; align-items: end; }
.apcd-field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; color: var(--ap-muted); text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
.apcd-field select {
  width: 100%; height: 42px; border: 1px solid var(--ap-border);
  border-radius: var(--ap-rsm); background: #fff; padding: 0 14px;
  font-size: 14px; color: var(--ap-text);
  box-shadow: 0 1px 4px rgba(15,23,42,.07); outline: none;
  transition: border-color .15s;
}
.apcd-field select:focus { border-color: var(--ap-red); }
.apcd-upload-trigger { height: 42px; min-width: 140px; }
.apcd-upload-trigger svg, .apcd-primary svg { width: 16px; height: 16px; fill:none; stroke:currentColor; stroke-width:2; }
.apcd-upload-message { font-size: 13.5px; margin-top: 10px; color: var(--ap-muted); }

/* ── Doc grid ── */
.apcd-doc-list { min-height: 70px; padding: 0; }
.apcd-doc-grid { width: 100%; padding: 6px; }
.apcd-doc-row {
  display: grid; grid-template-columns: 36px minmax(0,1fr) auto auto;
  gap: 13px; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid #f1f5f9;
}
.apcd-doc-row:last-child { border-bottom: 0; }
.apcd-doc-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--ap-pink); color: var(--ap-red);
  display: flex; align-items: center; justify-content: center;
}
.apcd-doc-icon svg { width: 17px; height: 17px; fill:none; stroke:currentColor; stroke-width:2; }
.apcd-doc-row strong { display: block; font-size: 14px; }
.apcd-doc-row span { display: block; font-size: 12.5px; color: var(--ap-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apcd-doc-row a { color: var(--ap-red); font-weight: 700; text-decoration: none; font-size: 13px; }
.apcd-doc-row a:hover { text-decoration: underline; }
.apcd-delete-doc {
  border: 0; background: #1e293b; color: #fff;
  border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer;
  transition: background .14s;
}
.apcd-delete-doc:hover { background: #0f172a; }

/* ── Skills / Progress ── */
.apcd-progress-card {
  background: #fff; border: 1px solid #ffbfc1; border-radius: 12px;
  box-shadow: 0 2px 6px rgba(232,41,45,.08);
  padding: 18px 20px; margin: 0 0 24px;
}
.apcd-progress-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 9px; }
.apcd-progress-head strong { color: var(--ap-red); font-size: 15px; }
.apcd-progress { height: 8px; border-radius: 999px; background: #ffd2d4; overflow: hidden; }
.apcd-progress span { display: block; height: 100%; background: var(--ap-red); border-radius: 999px; transition: width .4s; }
.apcd-progress-card small { display: block; font-size: 12.5px; color: var(--ap-muted); margin-top: 10px; }

.apcd-info-box {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid #ffc1c3; border-left: 4px solid var(--ap-red);
  background: #fff9f9; color: var(--ap-text);
  border-radius: var(--ap-rsm); padding: 13px 15px; margin: 0 0 20px;
  font-size: 13.5px; line-height: 1.5;
}
.apcd-info-box strong { color: var(--ap-red); }

.apcd-skill-group { margin-bottom: 20px; padding: 20px 18px; }
.apcd-skill-group h2 { font-size: 17px; font-weight: 800; margin: 0 0 15px; }
.apcd-skill-edit-row { border-bottom: 1px solid #f1f5f9; padding: 12px 0; }
.apcd-skill-edit-row:last-child { border-bottom: 0; }
.apcd-skill-title { display: grid; grid-template-columns: 18px minmax(0,1fr) auto; gap: 11px; align-items: center; margin-bottom: 10px; }
.apcd-skill-title strong { font-size: 13.5px; }

.apcd-circle { width: 14px; height: 14px; border: 2px solid #cbd5e1; border-radius: 50%; display: inline-block; transition: background .2s, border-color .2s; }
.apcd-circle.en_cours  { border-color: #d97706; background: #fef9c3; }
.apcd-circle.acquis    { border-color: #0ea5e9; background: #0ea5e9; }
.apcd-circle.maitrise  { border-color: var(--ap-red); background: var(--ap-red); }
.apcd-circle.non_acquis{ background: #fff; }

.apcd-skill-options { display: flex; flex-wrap: wrap; gap: 7px; margin-left: 29px; }
.apcd-skill-option input { position: absolute; opacity: 0; pointer-events: none; }
.apcd-skill-option span {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 26px; padding: 0 11px;
  border: 1px solid var(--ap-border); border-radius: 8px;
  background: #fff; color: var(--ap-text); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .14s, border-color .14s, color .14s;
}
.apcd-skill-option span:hover { border-color: var(--ap-red); color: var(--ap-red); }
.apcd-skill-option.is-active span { background: var(--ap-red); color: #fff; border-color: var(--ap-red); }

.apcd-note-toggle {
  border: 0; background: transparent; color: var(--ap-muted);
  font-size: 12px; font-weight: 600; cursor: pointer; padding: 0 8px;
}
.apcd-note-toggle:hover { color: var(--ap-red); }
.apcd-skill-note {
  display: none; margin: 10px 0 0 29px;
  width: calc(100% - 29px); min-height: 60px;
  border: 1px solid var(--ap-border); border-radius: var(--ap-rsm);
  padding: 9px 12px; font-size: 13.5px; resize: vertical;
}
.apcd-skill-note:focus { outline: none; border-color: var(--ap-red); }
.apcd-skill-edit-row.is-note-open .apcd-skill-note,
.apcd-skill-note:not(:placeholder-shown) { display: block; }

.apcd-skill-savebar { display: flex; align-items: center; gap: 13px; margin: 20px 0 0; }
.apcd-skill-save-message { font-size: 13.5px; color: #16a34a; font-weight: 600; }

.apcd-login-required {
  padding: 28px; background: #fff;
  border: 1px solid var(--ap-border); border-radius: var(--ap-radius);
}
.apcd-login-required a {
  display: inline-flex; margin-top: 12px;
  background: var(--ap-red); color: #fff; padding: 11px 18px;
  border-radius: var(--ap-rsm); text-decoration: none; font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .apcd-wrap { grid-template-columns: 1fr; }
  .apcd-sidebar { padding: 14px; display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
  .apcd-nav { margin: 0; }
  .apcd-main { padding: 10px 14px 40px; }
  .apcd-stats { grid-template-columns: repeat(2,1fr); }
  .apcd-upload-form { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .apcd-sidebar { grid-template-columns: 1fr 1fr; }
  .apcd-stats { grid-template-columns: 1fr; }
  .apcd-reservation-row { grid-template-columns: 1fr; }
  .apcd-pay-btn { justify-self: start !important; }
  .apcd-doc-row { grid-template-columns: 34px 1fr; gap: 10px; }
  .apcd-doc-row a, .apcd-delete-doc { justify-self: start; }
  .apcd-skill-options, .apcd-skill-note { margin-left: 0; width: 100%; }
  .apcd-panel h1 { font-size: 22px; }
}
