/* ═══════════════════════════════════════════
   MyEdlo Plugin — Feuille de style principale
   Couleurs : #0B1D49 | #0067B9 | #15C0F2 | #FFC200
═══════════════════════════════════════════ */

:root {
  --me-primary:   #0B1D49;
  --me-secondary: #0067B9;
  --me-accent:    #15C0F2;
  --me-cta:       #FFC200;
  --me-cta-hover: #e6af00;
  --me-text:      #1a1a1a;
  --me-border:    #d8e4ef;
  --me-radius:    14px;
  --me-shadow:    0 4px 20px rgba(11,29,73,.10);
}

/* ── Conteneur principal ── */
#myedlo-app {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: var(--me-text);
  width: 100%;
  padding: 24px 16px;
  line-height: 1.5;
  box-sizing: border-box;
}

/* ── En-tête ── */
.myedlo-header {
  text-align: center;
  margin-bottom: 32px;
}
.myedlo-header h2 {
  color: var(--me-primary);
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 8px;
  font-weight: 700;
}
.myedlo-header p {
  color: var(--me-secondary);
  margin: 0;
  font-size: .95rem;
}

/* ═══ ÉTAPE 1 — Workspace ═══ */

.myedlo-workspace {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

/* ── Container de pages (remplace le flex direct du canvas-wrapper) ── */
.myedlo-canvas-container {
  flex: 1 1 0;
  min-width: 0;
}

/* ── Zone de canvas + template ── */
.myedlo-canvas-wrapper {
  position: relative;
  box-shadow: var(--me-shadow);
  border-radius: var(--me-radius);
  overflow: hidden;
  background: #f7f9fc;
}

.myedlo-template-img {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 10;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Zones cliquables ── */
.myedlo-zone {
  position: absolute;
  z-index: 25;
  cursor: pointer;
  border-radius: 6%;
  overflow: hidden;
  outline: none;
  transition: box-shadow .15s;
}
.myedlo-zone:focus-visible {
  box-shadow: 0 0 0 3px var(--me-accent);
}

.myedlo-zone-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Photo uploadée */
.myedlo-zone-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.myedlo-zone.has-photo .myedlo-zone-photo {
  display: block;
}

/* Placeholder (pas encore de photo) */
.myedlo-zone-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(21,192,242,.07);
  border: 2px dashed rgba(21,192,242,.40);
  border-radius: 6%;
  transition: background .18s, border-color .18s;
}
.myedlo-zone:hover .myedlo-zone-placeholder,
.myedlo-zone.drag-over .myedlo-zone-placeholder {
  background: rgba(21,192,242,.18);
  border-color: var(--me-accent);
}
.myedlo-zone.has-photo .myedlo-zone-placeholder {
  display: none;
}
.myedlo-zone-icon {
  font-size: 1.6em;
  line-height: 1;
  color: var(--me-accent);
  font-weight: 300;
}
.myedlo-zone-num {
  font-size: .65em;
  color: var(--me-secondary);
  font-weight: 600;
  opacity: .75;
}

/* Drag-over highlight */
.myedlo-zone.drag-over {
  box-shadow: 0 0 0 3px var(--me-accent);
}

/* Masque pendant l'upload */
.myedlo-zone-uploading-mask {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.65);
  z-index: 20;
  align-items: center;
  justify-content: center;
}
.myedlo-zone.uploading .myedlo-zone-uploading-mask {
  display: flex;
}

.myedlo-mini-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(11,29,73,.15);
  border-top-color: var(--me-cta);
  border-radius: 50%;
  animation: myedlo-spin .7s linear infinite;
}

/* Input file caché */
.myedlo-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 6;
}

/* ── Sidebar ── */
.myedlo-sidebar {
  width: 270px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Barre de progression */
.myedlo-progress-block {}
.myedlo-progress-bar {
  height: 8px;
  background: var(--me-border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.myedlo-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--me-secondary), var(--me-accent));
  border-radius: 4px;
  transition: width .4s ease;
}
#myedlo-progress-text {
  font-size: .82rem;
  color: var(--me-secondary);
  margin: 0;
  font-weight: 500;
}

/* Liste des zones */
.myedlo-zone-list {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--me-border);
  border-radius: var(--me-radius);
  background: #fff;
  box-shadow: var(--me-shadow);
}
.myedlo-zone-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--me-border);
  transition: background .12s;
}
.myedlo-zone-item:last-child { border-bottom: none; }
.myedlo-zone-item:hover      { background: #f0f7ff; }

.myedlo-zone-thumb {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: var(--me-border) center/cover no-repeat;
  flex-shrink: 0;
  border: 1px solid var(--me-border);
}
.myedlo-zone-label {
  font-size: .82rem;
  color: var(--me-primary);
  font-weight: 500;
  flex: 1;
}
.myedlo-zone-status {
  font-size: .85rem;
  color: #c0c8d8;
  transition: color .15s;
}
.myedlo-zone-status.done {
  color: #22c55e;
}

/* ═══ Boutons ═══ */
.myedlo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 24px;
  border: 2px solid transparent;
  border-radius: 9999px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .18s, transform .15s, box-shadow .18s, color .18s;
  letter-spacing: .02em;
  width: 100%;
}
.myedlo-btn-cta {
  background: var(--me-cta);
  color: var(--me-primary);
  border-color: var(--me-cta);
}
.myedlo-btn-cta:hover:not(:disabled) {
  background: var(--me-cta-hover);
  border-color: var(--me-cta-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255,194,0,.35);
}
.myedlo-btn-cta:disabled {
  opacity: .38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.myedlo-btn-secondary {
  background: transparent;
  color: var(--me-primary);
  border-color: var(--me-primary);
}
.myedlo-btn-secondary:hover {
  background: var(--me-primary);
  color: #fff;
}

/* ═══ ÉTAPE 2 — Confirmation ═══ */

.myedlo-warning-box {
  background: #fffbec;
  border: 1.5px solid var(--me-cta);
  border-radius: var(--me-radius);
  padding: 14px 20px;
  color: #7a5c00;
  font-size: .9rem;
  margin-top: 18px;
  text-align: left;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.myedlo-preview-wrapper {
  display: flex;
  justify-content: center;
  margin: 32px 0;
}
#myedlo-preview-canvas {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  border: 1px solid var(--me-border);
  border-radius: var(--me-radius);
  box-shadow: var(--me-shadow);
}

.myedlo-confirm-actions {
  display: flex;
  gap: 14px;
  max-width: 520px;
  margin: 0 auto 32px;
}
.myedlo-confirm-actions .myedlo-btn {
  width: auto;
  flex: 1;
}

/* ═══ Loader global ═══ */
.myedlo-loader {
  position: fixed;
  inset: 0;
  background: rgba(11,29,73,.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  color: #fff;
  backdrop-filter: blur(4px);
}
.myedlo-loader p {
  margin: 16px 0 0;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: .03em;
}
.myedlo-spinner {
  width: 52px;
  height: 52px;
  border: 5px solid rgba(255,255,255,.25);
  border-top-color: var(--me-cta);
  border-radius: 50%;
  animation: myedlo-spin .8s linear infinite;
}

@keyframes myedlo-spin {
  to { transform: rotate(360deg); }
}

/* ═══ Mon Compte — bouton PDF ═══ */
.woocommerce-orders-table .button.myedlo_pdf,
.woocommerce-MyAccount-orders .button[href*="myedlo-pdf"] {
  background: var(--me-secondary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .8rem;
  padding: 6px 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.woocommerce-orders-table .button.myedlo_pdf:hover,
.woocommerce-MyAccount-orders .button[href*="myedlo-pdf"]:hover {
  background: var(--me-primary);
}

/* ═══ Zones circulaires ═══ */
.myedlo-zone.is-circle {
  border-radius: 50%;
}
.myedlo-zone.is-circle .myedlo-zone-placeholder {
  border-radius: 50%;
}
.myedlo-zone.is-circle .myedlo-zone-photo {
  border-radius: 50%;
}

/* ═══ Zones optionnelles ═══ */
.myedlo-zone.is-optional .myedlo-zone-placeholder {
  border-color: rgba(255,194,0,.55);
  background: rgba(255,194,0,.06);
}
.myedlo-zone.is-optional:hover .myedlo-zone-placeholder {
  border-color: var(--me-cta);
  background: rgba(255,194,0,.14);
}
.myedlo-zone-badge-opt {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--me-cta);
  color: var(--me-primary);
  font-size: .6em;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  line-height: 1.4;
  z-index: 8;
  pointer-events: none;
}

/* ═══ Navigation pages ═══ */
.myedlo-page-panel {
  display: none;
}
.myedlo-page-panel.active {
  display: block;
}
.myedlo-page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 18px 0 10px;
}
.myedlo-page-nav button {
  background: transparent;
  border: 2px solid var(--me-primary);
  color: var(--me-primary);
  border-radius: 9999px;
  padding: 8px 20px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.myedlo-page-nav button:hover:not(:disabled) {
  background: var(--me-primary);
  color: #fff;
}
.myedlo-page-nav button:disabled {
  opacity: .35;
  cursor: default;
}
#myedlo-page-indicator {
  font-size: .9rem;
  font-weight: 600;
  color: var(--me-primary);
  min-width: 72px;
  text-align: center;
}

/* ═══ Formulaire pro ═══ */
#myedlo-step-pro-form h2 {
  color: var(--me-primary);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 6px;
  text-align: center;
}
#myedlo-step-pro-form p {
  text-align: center;
  color: var(--me-secondary);
  font-size: .9rem;
  margin: 0 0 24px;
}
.myedlo-field {
  margin-bottom: 16px;
}
.myedlo-field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--me-primary);
  margin-bottom: 5px;
}
.myedlo-field input[type="text"],
.myedlo-field input[type="email"],
.myedlo-field input[type="tel"] {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--me-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .95rem;
  color: var(--me-text);
  transition: border-color .15s;
  outline: none;
}
.myedlo-field input:focus {
  border-color: var(--me-accent);
}
.myedlo-pro-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.myedlo-pro-form-actions .myedlo-btn {
  flex: 1;
  width: auto;
}

/* ═══ Aperçu multi-pages ═══ */
.myedlo-preview-pages {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
}
.myedlo-preview-page-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--me-secondary);
  text-align: center;
  margin-bottom: 6px;
}

/* ═══ Sélecteur de design ═══ */
.myedlo-selector-root {
  font-family: var(--me-font, inherit);
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 0 32px;
}
.myedlo-design-selector {
  padding: 0;
}
.myedlo-selector-title {
  color: #0B1D49;
  font-size: 1.55rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 8px;
}
.myedlo-selector-subtitle {
  color: var(--me-secondary, #555);
  font-size: .95rem;
  text-align: center;
  margin: 0 0 28px;
}
.myedlo-design-cards {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap;
  gap: 24px;
  justify-content: center;
  align-items: stretch;
}
.myedlo-design-card {
  flex: 1 1 0;
  max-width: 280px;
  cursor: pointer;
  border: 2.5px solid var(--me-border);
  border-radius: var(--me-radius);
  overflow: hidden;
  transition: border-color .18s, transform .16s, box-shadow .18s;
  background: #fff;
  display: flex !important;
  flex-direction: column !important;
}
.myedlo-design-card:hover {
  border-color: var(--me-accent);
  transform: translateY(-5px);
  box-shadow: 0 10px 28px rgba(11,29,73,.14);
}
.myedlo-design-card-img-wrap {
  flex: 1 1 auto;
  overflow: hidden;
}
.myedlo-design-card-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}
.myedlo-design-card img {
  width: 100%;
  height: auto;
  display: block;
}
.myedlo-design-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 16px;
  background: #fff;
}
.myedlo-design-card-label {
  text-align: center;
  font-weight: 700;
  color: var(--me-primary);
  font-size: .95rem;
  margin: 0;
}
.myedlo-design-card-cta {
  background: #FFC200;
  color: #0B1D49;
  border: none;
  border-radius: 9999px;
  padding: 10px 24px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  width: 100%;
  transition: background .15s, transform .12s;
  pointer-events: none; /* click handled on parent card */
}
.myedlo-design-card:hover .myedlo-design-card-cta {
  background: #e6af00;
  transform: scale(1.03);
}
.myedlo-product-wrapper {
  min-height: 120px;
}

/* ═══ Responsive ═══ */
@media (max-width: 860px) {
  .myedlo-workspace {
    flex-direction: column;
  }
  .myedlo-sidebar {
    width: 100%;
    position: static;
  }
  .myedlo-zone-list {
    max-height: 260px;
  }
  .myedlo-confirm-actions {
    flex-direction: column;
  }
}
@media (max-width: 480px) {
  #myedlo-app { padding: 12px 8px; }
}

/* ── Bandeau avertissement mobile ── */
.myedlo-mobile-warning {
  display: none;
}
@media (max-width: 768px) {
  .myedlo-mobile-warning {
    display: block;
    background: #FFF3CD;
    color: #856404;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: bold;
  }
}
