/* ═══════════════════════════════════════
   panier.css — Page panier RoniBarber
   ═══════════════════════════════════════ */

/* ── Layout ── */
.panier-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 20px 80px;
}

.panier-wrap h1 {
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 800;
    margin: 0 0 4px;
}

.panier-wrap .muted { font-size: 0.9rem; margin: 0; }

/* ── Messages alert (mêmes couleurs que main.css) ── */
.panier-wrap .alert { width: 100%; margin: 20px 0; }

.panier-wrap .alert-success {
    background: rgba(62, 207, 106, 0.12);
    border: 1px solid rgba(62, 207, 106, 0.35);
    color: #7fe3a2;
    padding: 14px 18px;
    border-radius: 14px;
}

.panier-wrap .alert-error {
    background: rgba(224, 80, 80, 0.12);
    border: 1px solid rgba(224, 80, 80, 0.35);
    color: #ff9b9b;
    padding: 14px 18px;
    border-radius: 14px;
}

/* ── Panier vide ── */
.panier-empty {
    text-align: center;
    padding: 56px 20px;
}

.panier-empty svg {
    width: 64px;
    height: 64px;
    stroke: var(--muted);
    opacity: 0.5;
    margin: 0 auto 16px;
    display: block;
}

.panier-empty p {
    color: var(--muted);
    margin-bottom: 24px;
}

.panier-empty .btn { width: auto; min-width: 220px; }

/* ── Bouton de mise à jour masqué (déclenché par les steppers) ── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Liste d'articles ── */
.cart-list {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cart-item-name {
    font-weight: 700;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-item-price {
    color: var(--muted);
    font-size: 0.8rem;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.cart-item-subtotal {
    color: var(--accent);
    font-weight: 800;
    font-size: 0.95rem;
    min-width: 68px;
    text-align: right;
    white-space: nowrap;
}

/* ── Stepper quantité ── */
.qty-stepper {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.qty-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.qty-btn:hover { background: rgba(255, 255, 255, 0.08); }
.qty-btn:active { background: var(--accent-soft); }

.qty-input {
    width: 40px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus { outline: none; }

/* ── Bouton supprimer ── */
.btn-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--muted);
    transition: color 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-delete svg { stroke: currentColor; display: block; }

.btn-delete:hover {
    color: var(--danger);
    background: rgba(224, 80, 80, 0.1);
}

/* ── Résumé & total ── */
.cart-summary {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cart-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.cart-total span {
    color: var(--accent);
    font-size: 1.4rem;
    font-weight: 800;
}

/* ── Actions ── */
.cart-actions {
    display: flex;
    flex-direction: row-reverse; /* commande d'abord visuellement à droite */
    gap: 10px;
}

.cart-actions .btn { flex: 1; width: auto; }

/* ── Notice connexion ── */
.login-notice {
    padding: 13px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

.login-notice a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.login-notice a:hover { text-decoration: underline; }

/* ══════════════════════════════════
   MOBILE
   ══════════════════════════════════ */
@media (max-width: 768px) {

    .panier-wrap {
        padding: 20px 14px calc(48px + env(safe-area-inset-bottom));
    }

    /* Ligne article sur deux niveaux : nom en haut, actions en dessous */
    .cart-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .cart-item-actions {
        justify-content: space-between;
        gap: 10px;
    }

    .qty-btn { width: 44px; height: 44px; }
    .btn-delete { width: 44px; height: 44px; }

    .cart-actions {
        flex-direction: column;
    }
}
