/* ============================================================
   Wishlist multi-listes — modal + page wishlist
   Utilisé avec Alpine.js
   ============================================================ */

/* --- Bouton cœur --- */
.wl-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    font-size: 18px;
    color: #ccc;
    transition: color .2s, transform .15s;
}
.wl-btn:hover          { color: #e55; transform: scale(1.15); }
.wl-btn.wl-active      { color: #e55; }
.wl-btn.wl-partial     { color: #f90; }

/* --- Overlay --- */
.wl-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    /* Claude 2026 - aligne sur pb-popup-overlay (10600) ; passe au-dessus du
       modal eclate-detail (10500) qu'on remonte pour rester au-dessus du
       modal de recherche (10000). */
    z-index: 10600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Boîte modale --- */
.wl-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    width: 340px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    font-size: 13px;
}

.wl-box-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.wl-box-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
}
.wl-box-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0 2px;
}
.wl-box-close:hover { color: #333; }

/* --- Nom produit --- */
.wl-product-name {
    padding: 8px 16px;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Quantité (Claude 2026) — éditable, stepper +/- + input numérique (mobile numpad) --- */
.wl-qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}
.wl-qty-label {
    font-size: 12px;
    font-weight: 600;
    color: #444;
}
.wl-qty-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}
.wl-qty-btn {
    background: #f4f4f4;
    border: 0;
    width: 32px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    transition: background .15s;
    padding: 0;
}
.wl-qty-btn:hover:not(:disabled) { background: #e8e8e8; }
.wl-qty-btn:disabled             { opacity: .5; cursor: default; }
.wl-qty-input {
    width: 56px;
    border: 0;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 15px;
    padding: 6px 0;
    font-family: inherit;
    /* Évite le spin natif (déjà type=text mais au cas où) */
    -moz-appearance: textfield;
}
.wl-qty-input::-webkit-outer-spin-button,
.wl-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wl-qty-input:focus {
    outline: none;
    background: #fffae6;
}

/* --- Liste des listes --- */
.wl-lists {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}

.wl-list-row {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 10px;
    cursor: pointer;
    transition: background .15s;
}
.wl-list-row:hover { background: #f7f7f7; }

.wl-list-row input[type=checkbox] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #e55;
    flex-shrink: 0;
}
.wl-list-name {
    flex: 1;
    color: #333;
}
.wl-list-count {
    color: #aaa;
    font-size: 11px;
}

/* --- Zone création nouvelle liste --- */
.wl-create-zone {
    padding: 10px 16px;
    border-top: 1px solid #eee;
}
.wl-create-toggle {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}
.wl-create-toggle:hover { text-decoration: underline; }

.wl-create-form {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.wl-create-form input {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 13px;
}
.wl-create-form input:focus {
    outline: none;
    border-color: var(--color-primary);
}
.wl-create-form button {
    background: #e55;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 13px;
}
.wl-create-form button:hover  { background: #c33; }
.wl-create-form button:disabled { opacity: .5; cursor: default; }

.wl-max-warning {
    color: #c55;
    font-size: 11px;
    margin-top: 6px;
}

/* --- Toast notification --- */
.wl-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}
.wl-toast.wl-toast-ok  { background: #2e7d32; }
.wl-toast.wl-toast-err { background: #c62828; }

/* --- Transitions Alpine.js --- */
[x-cloak] { display: none !important; }

/* overlay */
.wl-fade-enter-active, .wl-fade-leave-active { transition: opacity .2s; }
.wl-fade-enter-from,  .wl-fade-leave-to      { opacity: 0; }

/* boîte */
.wl-slide-enter-active, .wl-slide-leave-active { transition: transform .2s, opacity .2s; }
.wl-slide-enter-from,   .wl-slide-leave-to     { transform: translateY(-16px); opacity: 0; }

/* ============================================================
   Page wishlist — dropdown selector
   ============================================================ */
.wl-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #ddd;
}
.wl-page-select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    min-width: 180px;
}
.wl-page-action {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
}
.wl-page-action:hover { background: #f0f0f0; }
.wl-page-action.wl-page-action-del { border-color: #e55; color: #e55; }
.wl-page-action.wl-page-action-del:hover { background: #ffeaea; }

/* ============================================================
   Page wishlist — grille de tuiles à largeur fixe (Claude 2026-06-08)
   Tuiles uniformes : largeur figée + nom produit sur hauteur réservée
   (products_name <= 75 caractères ~ 3 lignes) → zéro décalage, grille alignée.
   ============================================================ */
.wl-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: center;
    align-items: flex-start;
}
.wl-tile {
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-3) var(--space-2);
}
.wl-tile-name {
    font-size: var(--text-sm);
    line-height: 1.3;
    /* hauteur réservée ~3 lignes : les tuiles s'alignent quelle que soit la longueur du nom */
    min-height: calc(1.3em * 3);
    margin: var(--space-2) 0 var(--space-1);
    overflow-wrap: anywhere;
}
.wl-tile-price  { margin: var(--space-1) 0; }
/* Claude 2026 - item obsolète (9997) : libellé discret, tokens du design-system */
.wl-tile-unavailable {
    color: var(--color-text-soft);
    font-size: var(--text-sm);
    font-style: italic;
}
.wl-tile-actions {
    margin-top: var(--space-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.wl-rename-form {
    display: flex;
    gap: 6px;
    align-items: center;
}
.wl-rename-form input {
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
}
.wl-rename-form button {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
}

/* ====================================================================
   Login inline (Claude 2026) — affiché dans le modal wishlist quand
   wishlist_ajax renvoie login_required. Composant réutilisable :
   les classes .wl-login-* devraient migrer en .il-* si on étend à
   pb_*, mais pour l'instant scope wishlist suffit.
   ==================================================================== */
.wl-login {
    padding: 8px 16px 14px;
}
.wl-login-subtitle {
    color: #555;
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.4;
}
.wl-login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wl-login-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.wl-login-field label {
    font-size: 12px;
    font-weight: 600;
    color: #444;
}
.wl-login-field input {
    font-family: inherit;
    font-size: 14px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.wl-login-field input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary-ring);
}
.wl-login-field input:disabled {
    background: #f4f4f4;
    color: #888;
    cursor: wait;
}
/* Champ mot de passe avec bouton afficher/masquer (œil) — Claude 2026 */
.wl-pwd-wrap {
    position: relative;
    display: block;
}
.wl-pwd-wrap input {
    width: 100%;
    padding-right: 36px;
    box-sizing: border-box;
}
.wl-pwd-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    color: #888;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: color .15s ease, background .15s ease;
}
.wl-pwd-toggle:hover { color: #333; background: rgba(0,0,0,.04); }
.wl-pwd-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.wl-pwd-toggle:disabled { cursor: not-allowed; opacity: .5; }
.wl-login-error {
    color: #d63333;
    font-size: 13px;
    min-height: 1em;
    margin-top: 2px;
}
.wl-login-error:empty { min-height: 0; }
.wl-login-actions {
    display: flex;
    justify-content: stretch;
    margin-top: 4px;
}
.wl-login-submit {
    flex: 1 1 auto;
    background: var(--color-primary);
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}
.wl-login-submit:hover:not(:disabled) { background: var(--color-primary-hover); }
.wl-login-submit:disabled {
    background: #c8c8c8;
    cursor: not-allowed;
}
/* Claude 2026-09-11 - case « Rester connecté » du popup de connexion.
   Case native (accessible clavier sans code) sur un label cliquable, meme
   principe que .cc-toggle (cookie_consent.css) et .dform-check (login.php).
   Tokens :root uniquement, aucune valeur en dur. */
.wl-login-remember {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text);
    cursor: pointer;
}

.wl-login-remember input[type="checkbox"] {
    width: 1.1em;
    height: 1.1em;
    accent-color: var(--color-primary);
    flex-shrink: 0;
    cursor: pointer;
}

.wl-login-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
}

/* Bouton "lien" (toggle vers forgot, back to login) — visuellement identique
   à un <a> mais sans navigation, juste un état Alpine qui change */
.wl-login-link-btn {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    color: var(--color-primary);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
}
.wl-login-link-btn:hover { text-decoration: underline; }

/* Section "Pas encore client ?" — separateur + bouton CTA vers create_account */
.wl-login-register-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.wl-login-register-hint {
    font-size: 12px;
    color: #666;
}
.wl-login-register-btn {
    display: inline-block;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    border: 1px solid #1e8e3e;
    border-radius: 4px;
    padding: 8px 18px;
    background: #1e8e3e;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.wl-login-register-btn:hover {
    background: #fff;
    border-color: #1e8e3e;
    color: #1e8e3e;
    text-decoration: none;
}
.wl-login-register-btn:focus-visible {
    outline: 2px solid #1e8e3e;
    outline-offset: 2px;
}

/* État succès du forgot password (générique anti-énumération) — vert pour
   différencier visuellement de l'erreur (rouge) */
.wl-login-error.wl-login-success {
    color: #1f5a13;
    background: #effaef;
    border-left: 3px solid #49cf2b;
    padding: 8px 10px;
    border-radius: 0 4px 4px 0;
    font-size: 13px;
    line-height: 1.45;
    margin: 4px 0;
}
