/* =====================================================
   RUCHE CONFIGURATEUR — styles isolés
   ===================================================== */

/* Bouton déclencheur sur la fiche produit */
.ruche-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, oklch(0.74 0.16 78) 0%, oklch(0.58 0.14 65) 100%);
    color: oklch(0.22 0.02 60);
    border: none;
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px oklch(0.74 0.16 78 / .3);
}
.ruche-open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px oklch(0.74 0.16 78 / .4);
}

/* Overlay modal */
.ruche-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: stretch;
}
.ruche-modal-overlay[hidden] { display: none; }

.ruche-modal-inner {
    position: relative;
    width: 100%;
    height: 100%;
    background: oklch(0.97 0.015 85);
    overflow: hidden;
}

.ruche-modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border: 1px solid oklch(0.88 0.02 80);
    background: oklch(0.99 0.008 85 / .8);
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: oklch(0.22 0.02 60);
    backdrop-filter: blur(6px);
    transition: background 0.15s;
}
.ruche-modal-close:hover { background: oklch(0.93 0.02 85); }

/* Zone de montage React */
#ruche-configurateur-root {
    width: 100%;
    height: 100%;
}

/* =====================================================
   STYLES DU CONFIGURATEUR (repris du prototype)
   ===================================================== */
#ruche-configurateur-root {
    --bg: oklch(0.97 0.015 85);
    --bg-2: oklch(0.94 0.02 85);
    --ink: oklch(0.22 0.02 60);
    --ink-soft: oklch(0.45 0.02 60);
    --line: oklch(0.88 0.02 80);
    --line-strong: oklch(0.78 0.02 75);
    --honey: oklch(0.74 0.16 78);
    --honey-deep: oklch(0.58 0.14 65);
    --card: oklch(0.99 0.008 85);
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: var(--ink);
    background: var(--bg);
}

#ruche-configurateur-root *, #ruche-configurateur-root *::before, #ruche-configurateur-root *::after { box-sizing: border-box; }
#ruche-configurateur-root .serif { font-family: 'Fraunces', serif; }
#ruche-configurateur-root .mono  { font-family: 'JetBrains Mono', monospace; }

/* Layout */
#ruche-configurateur-root .stage {
    display: grid;
    grid-template-columns: 1fr 460px;
    min-height: 100vh;
}
@media (max-width: 1100px) {
    #ruche-configurateur-root .stage { grid-template-columns: 1fr; }
}

/* Preview panel */
#ruche-configurateur-root .preview {
    position: relative;
    background: radial-gradient(1200px 600px at 30% 20%, oklch(0.99 0.01 85) 0%, transparent 60%), linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
}
#ruche-configurateur-root .preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(oklch(0.88 0.02 80) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .35;
    mask-image: radial-gradient(ellipse at center, #000 40%, transparent 75%);
}
#ruche-configurateur-root .preview-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; flex: 1; }
#ruche-configurateur-root .hive-wrap { width: min(760px, 96%); aspect-ratio: 1/0.95; position: relative; display: flex; align-items: center; justify-content: center; border-radius: 20px; overflow: hidden; }
#ruche-configurateur-root .hive-svg { width: 100%; height: 100%; filter: drop-shadow(0 24px 30px oklch(0.2 0.02 60 / .18)); }
#ruche-configurateur-root .hive-3d { width: 100%; height: 100%; position: relative; }
#ruche-configurateur-root .hive-3d canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; }
#ruche-configurateur-root .hive-3d canvas:active { cursor: grabbing; }
#ruche-configurateur-root .hive-3d .loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); background: oklch(0.97 0.015 85 / 0.6); backdrop-filter: blur(4px); }
#ruche-configurateur-root .hive-3d .err { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; font-size: 13px; color: oklch(0.5 0.15 25); background: oklch(0.97 0.015 85 / 0.9); }

/* Meta strip */
#ruche-configurateur-root .meta { display: flex; gap: 24px; margin-top: 6px; padding: 12px 20px; background: oklch(0.99 0.008 85 / .7); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(8px); flex-wrap: wrap; }
#ruche-configurateur-root .meta .item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
#ruche-configurateur-root .meta .dot { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-strong); flex-shrink: 0; }
#ruche-configurateur-root .meta b { color: var(--ink); font-weight: 600; }

/* Config panel */
#ruche-configurateur-root .panel { background: var(--card); border-left: 1px solid var(--line); padding: 28px 30px 120px; overflow-y: auto; max-height: 100vh; }
#ruche-configurateur-root .panel h1 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 28px; line-height: 1.15; margin: 2px 0 6px; letter-spacing: -0.01em; }
#ruche-configurateur-root .panel .lede { font-size: 14px; color: var(--ink-soft); margin-bottom: 22px; line-height: 1.55; }

/* Steps */
#ruche-configurateur-root .step { margin-top: 22px; padding-top: 22px; border-top: 1px dashed var(--line-strong); }
#ruche-configurateur-root .step:first-of-type { border-top: 0; padding-top: 0; margin-top: 8px; }
#ruche-configurateur-root .step-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
#ruche-configurateur-root .step-num { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--honey-deep); letter-spacing: .1em; }
#ruche-configurateur-root .step-title { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 500; }
#ruche-configurateur-root .step-help { font-size: 12.5px; color: var(--ink-soft); margin-top: -8px; margin-bottom: 12px; }

/* Shapes */
#ruche-configurateur-root .shapes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#ruche-configurateur-root .shape { cursor: pointer; border: 1.5px solid var(--line); background: oklch(0.99 0.008 85); border-radius: 14px; padding: 14px 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: all .18s ease; position: relative; }
#ruche-configurateur-root .shape:hover { border-color: var(--line-strong); }
#ruche-configurateur-root .shape.active { border-color: var(--honey-deep); background: oklch(0.98 0.03 85); box-shadow: 0 0 0 3px oklch(0.74 0.16 78 / .15); }
#ruche-configurateur-root .shape svg { width: 58px; height: 44px; }
#ruche-configurateur-root .shape span { font-size: 13px; font-weight: 500; }
#ruche-configurateur-root .shape small { font-size: 11px; color: var(--ink-soft); }
#ruche-configurateur-root .shape.active::after { content: "✓"; position: absolute; top: 8px; right: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--honey-deep); color: #fff; font-size: 11px; display: grid; place-items: center; }

/* Swatches */
#ruche-configurateur-root .swatch-row { display: flex; flex-wrap: wrap; gap: 10px; }
#ruche-configurateur-root .swatch { cursor: pointer; width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); position: relative; transition: transform .12s ease; padding: 0; background-clip: padding-box; }
#ruche-configurateur-root .swatch:hover { transform: translateY(-2px); }
#ruche-configurateur-root .swatch.active { border-color: var(--ink); box-shadow: 0 0 0 3px oklch(0.22 0.02 60 / .12); }
#ruche-configurateur-root .swatch.active::after { content: ""; position: absolute; inset: 6px; border: 2px solid #fff; border-radius: 7px; mix-blend-mode: overlay; }
#ruche-configurateur-root .swatch-label { margin-top: 8px; font-size: 12px; color: var(--ink-soft); }
#ruche-configurateur-root .swatch-label b { color: var(--ink); font-weight: 500; }

/* Uploader */
#ruche-configurateur-root .uploader { border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 18px; display: flex; align-items: center; gap: 14px; background: oklch(0.98 0.01 85); cursor: pointer; transition: all .15s ease; }
#ruche-configurateur-root .uploader:hover { border-color: var(--honey-deep); background: oklch(0.97 0.02 85); }
#ruche-configurateur-root .uploader.has-file { border-style: solid; border-color: var(--honey-deep); background: oklch(0.98 0.03 85); }
#ruche-configurateur-root .uploader-icon { width: 44px; height: 44px; border-radius: 10px; background: oklch(0.93 0.03 85); display: grid; place-items: center; flex-shrink: 0; }
#ruche-configurateur-root .uploader-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; padding: 4px; }
#ruche-configurateur-root .uploader-text { flex: 1; font-size: 13px; }
#ruche-configurateur-root .uploader-text b { display: block; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
#ruche-configurateur-root .uploader-text span { color: var(--ink-soft); font-size: 12px; }
#ruche-configurateur-root .uploader .remove { background: none; border: 0; color: var(--ink-soft); font-size: 12px; cursor: pointer; text-decoration: underline; }

/* Text field */
#ruche-configurateur-root .text-field { width: 100%; margin-top: 10px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; font: 500 14px/1.2 'Inter', sans-serif; color: var(--ink); background: oklch(0.99 0.008 85); outline: none; }
#ruche-configurateur-root .text-field:focus { border-color: var(--honey-deep); }
#ruche-configurateur-root .text-field-label { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 14px; }
#ruche-configurateur-root .text-area { min-height: 70px; resize: vertical; font-family: 'Inter', sans-serif; line-height: 1.45; padding: 10px 12px; }

/* Mode tabs */
#ruche-configurateur-root .mode-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
#ruche-configurateur-root .mode-tab { flex: 1; padding: 9px 12px; border: 0; background: transparent; border-radius: 8px; font: 500 13px 'Inter', sans-serif; color: var(--ink-soft); cursor: pointer; transition: all .12s ease; }
#ruche-configurateur-root .mode-tab.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px var(--line-strong); }

/* Font grid */
#ruche-configurateur-root .font-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
#ruche-configurateur-root .font-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: all .12s ease; min-height: 70px; }
#ruche-configurateur-root .font-chip:hover { border-color: var(--line-strong); }
#ruche-configurateur-root .font-chip.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
#ruche-configurateur-root .font-chip .font-sample { line-height: 1.1; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 26px; display: flex; align-items: center; }
#ruche-configurateur-root .font-chip .font-name { font-family: 'Inter', sans-serif; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
#ruche-configurateur-root .hint-inline { font-size: 11px; color: var(--ink-soft); margin-top: 6px; }
#ruche-configurateur-root .hint-inline b { color: var(--ink); }

/* Summary + CTA */
#ruche-configurateur-root .summary { margin-top: 28px; padding: 18px 20px; border-radius: 16px; background: linear-gradient(180deg, oklch(0.98 0.03 85) 0%, oklch(0.96 0.04 85) 100%); border: 1px solid oklch(0.85 0.06 85); }
#ruche-configurateur-root .sum-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed oklch(0.85 0.04 85); }
#ruche-configurateur-root .sum-row:last-child { border-bottom: 0; }
#ruche-configurateur-root .sum-row b { font-family: 'Fraunces', serif; font-weight: 500; }
#ruche-configurateur-root .total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding-top: 12px; border-top: 1px solid oklch(0.8 0.05 85); }
#ruche-configurateur-root .total .big { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 500; }
#ruche-configurateur-root .total .cap { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
#ruche-configurateur-root .cta { display: flex; gap: 10px; margin-top: 18px; }
#ruche-configurateur-root .btn { flex: 1; padding: 14px 18px; border-radius: 12px; border: 0; font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .1s ease; }
#ruche-configurateur-root .btn:hover { transform: translateY(-1px); }
#ruche-configurateur-root .btn.primary { background: var(--ink); color: var(--bg); }
#ruche-configurateur-root .btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line-strong); }
#ruche-configurateur-root .btn.primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Badge live */
#ruche-configurateur-root .badge-preview { position: absolute; top: 24px; right: 24px; display: flex; gap: 8px; align-items: center; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); z-index: 2; }
#ruche-configurateur-root .badge-preview .live { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.65 0.18 145); box-shadow: 0 0 0 4px oklch(0.65 0.18 145 / .2); }

/* Hint */
#ruche-configurateur-root .hint { position: absolute; bottom: 24px; left: 24px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; z-index: 2; }
#ruche-configurateur-root .hint .pill { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: oklch(0.99 0.008 85 / .7); backdrop-filter: blur(6px); font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: .05em; }

/* Notification succès */
#ruche-configurateur-root .ruche-success { position: absolute; inset: 0; background: oklch(0.97 0.015 85); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; z-index: 20; text-align: center; padding: 40px; }
#ruche-configurateur-root .ruche-success .big-check { font-size: 64px; }
#ruche-configurateur-root .ruche-success h2 { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 500; margin: 0; }
#ruche-configurateur-root .ruche-success p { color: var(--ink-soft); font-size: 15px; margin: 0; }

@media (max-width: 1100px) {
    #ruche-configurateur-root .panel { max-height: none; border-left: 0; border-top: 1px solid var(--line); }
}
