/**
 * Personnalisation native — champs de personnalisation sur la fiche produit.
 *
 * CSS EXTERNE uniquement (jamais inline <style>) : WP Rocket RUCSS supprime
 * les styles inline jugés inutilisés. Cf. doctrine grille B2B (CLAUDE.md pt 9).
 */

/* Évite le flash des éléments Alpine avant initialisation. */
[x-cloak] {
    display: none !important;
}

/* ── Panneau de personnalisation ─────────────────────────────────────────── */
.al-perso {
    margin: 1.25rem 0;
    padding: 1.1rem 1.35rem;
    border: 1px solid #d8dae0;
    border-radius: var(--al-radius, 8px);
    background: var(--al-surface, #fafafa);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.al-perso__field {
    margin: 0 0 1rem;
}

.al-perso__field:last-child {
    margin-bottom: 0;
}

.al-perso__legend,
.al-perso__label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.95rem;
    /* Défend contre la règle globale `label { color: muted }` du thème
       (style.css:60) qui grisaille sinon nos labels. Classe > élément. */
    color: var(--al-gray, #374151);
}

.al-perso__field--radio {
    border: none;
    padding: 0;
    margin: 0 0 1rem;
}

.al-perso__radio {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 1.25rem;
    cursor: pointer;
    font-weight: 400;
    /* Idem : neutralise le rétrécissement + grisaille de `label {}` global. */
    font-size: 0.95rem;
    color: var(--al-gray, #374151);
}

.al-perso__select {
    width: 100%;
    max-width: 360px;
    padding: 0.55rem 0.7rem;
    border: 1px solid #c4c8cf;
    border-radius: var(--al-radius, 4px);
    background: #fff;
    font-size: 0.95rem;
    color: var(--al-gray, #374151);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.al-perso__select:hover {
    border-color: #009ad6; /* bleu de marque (survol) */
}

.al-perso__select:focus {
    outline: none;
    border-color: #0073aa; /* bleu de marque (focus) */
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.18);
}

.al-perso__conditional {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--al-border, #e2e2e2);
}

.al-perso__field--file .al-perso__file-input {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--al-gray, #374151);
}

.al-perso__file-input::file-selector-button {
    margin-right: 0.6rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid #c4c8cf;
    border-radius: var(--al-radius, 4px);
    background: #f3f4f6;
    color: var(--al-gray, #374151);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.al-perso__file-input::file-selector-button:hover {
    background: #eaf6fc;
    border-color: #009ad6; /* bleu de marque (survol) */
}

/* ── Rappel doux « joindre un visuel » (fiche produit, au clic Commander) ──── */
.al-perso-reminder {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #f0d98a;
    border-left: 4px solid #e2b134; /* or de marque */
    border-radius: var(--al-radius, 6px);
    background: #fdf6e3;
}

.al-perso-reminder__text {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #6f5410; /* or foncé lisible */
}

.al-perso-reminder__continue {
    padding: 0.5rem 1rem;
    border: 1px solid #e2b134;
    border-radius: var(--al-radius, 4px);
    background: #e2b134; /* or de marque */
    color: #3a2c06;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.al-perso-reminder__continue:hover {
    background: #d5a422;
    border-color: #d5a422;
}

.al-perso__file-status {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--al-gray, #374151);
}

.al-perso__file-done {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--al-border, #cfe6cf);
    border-radius: var(--al-radius, 4px);
    background: #f2faf2;
    font-size: 0.9rem;
}

.al-perso__file-name {
    font-weight: 600;
    color: var(--al-gray, #374151);
    word-break: break-all;
}

.al-perso__file-remove {
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--al-border, #ccc);
    border-radius: var(--al-radius, 4px);
    background: #fff;
    font-size: 0.82rem;
    cursor: pointer;
}

.al-perso__file-error {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.88rem;
    color: #b00020;
}

/* ── Modal d'aperçu du visuel (panier / checkout) ────────────────────────── */
body.al-perso-preview-open {
    overflow: hidden;
}

.al-perso-preview-overlay {
    position: fixed;
    inset: 0;
    /* Au-dessus du drawer WooFlyCart (z-index 99999999) : le lien visuel s'y trouve. */
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.72);
}

.al-perso-preview-overlay[hidden] {
    display: none;
}

.al-perso-preview-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: min(92vw, 720px);
    max-height: 90vh;
    padding: 1.25rem;
    background: #fff;
    border-radius: var(--al-radius, 8px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.al-perso-preview-img {
    max-width: 100%;
    max-height: 74vh;
    object-fit: contain;
    border: 1px solid var(--al-border, #e2e2e2);
    border-radius: 4px;
    /* Damier : rend visible la transparence (logos SVG/PNG) au lieu d'un rendu « sale ». */
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #ececec 25%, transparent 25%),
        linear-gradient(-45deg, #ececec 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ececec 75%),
        linear-gradient(-45deg, transparent 75%, #ececec 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.al-perso-preview-name {
    margin: 0;
    max-width: 100%;
    font-size: 0.9rem;
    color: var(--al-gray, #374151);
    text-align: center;
    word-break: break-all;
}

.al-perso-preview-close {
    position: absolute;
    top: -0.75rem;
    right: -0.75rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 1.35rem;
    line-height: 1;
    color: var(--al-gray, #374151);
    cursor: pointer;
}

.al-perso-file-link {
    cursor: zoom-in;
}

.al-perso__hint {
    display: block;
    color: var(--al-gray-muted, #777);
    font-size: 0.82rem;
    line-height: 1.35;
}
