﻿:root {
    --bg: #F5F5F3;
    --ink: #111111;
    --muted: rgba(17,17,17,.65);
    --border: rgba(17,17,17,.12);
    --shadow: 0 10px 30px rgba(0,0,0,.08);
    --radius: 18px;
    --card: #ffffff;
}
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.wrap {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 18px 14px 40px;
}

.container {
    width: 100%;
    max-width: 520px;
}

/* Desktop: on élargit pour 3 cartes */
@media (min-width: 980px) {
    .container {
        max-width: 980px;
    }
}

.header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0 14px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    object-fit: cover;
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
}

.brand-title {
    font-size: 22px;
    font-weight: 900;
    line-height: 1.1;
}

.brand-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 20px 18px;
    border-radius: 22px;
    /* bordure teintée */
    border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
    /* fond avec motifs “brandés” */
    background: radial-gradient(220px 220px at 90% 10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%), radial-gradient(260px 260px at 10% 120%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%), radial-gradient(140px 140px at 0% 20%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 60%), linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, white), white);
    box-shadow: var(--shadow);
}

    /* formes décoratives “soft” au-dessus du fond */
    .hero::before,
    .hero::after {
        content: "";
        position: absolute;
        border-radius: 999px;
        filter: blur(0px);
        opacity: 1;
        pointer-events: none;
    }

    .hero::before {
        width: 220px;
        height: 220px;
        right: -90px;
        top: -110px;
        background: color-mix(in srgb, var(--brand) 16%, transparent);
    }

    .hero::after {
        width: 180px;
        height: 180px;
        left: -80px;
        bottom: -90px;
        background: color-mix(in srgb, var(--brand) 12%, transparent);
    }

    /* texte */
    .hero h1 {
        margin: 0 0 8px 0;
        font-size: 30px;
        letter-spacing: -0.3px;
    }

    .hero p {
        margin: 0 0 14px 0;
        color: var(--muted);
        line-height: 1.5;
    }

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    font-size: 15px;
    background: #fff;
}

    input[type="text"]:focus,
    input[type="number"]:focus {
        border-color: color-mix(in srgb, var(--brand) 55%, transparent);
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
    }

.btn-link {
    background: transparent;
    border: 0;
    color: var(--brand);
    cursor: pointer;
    padding: 0;
    font-size: 13px;
    text-decoration: none;
    font-weight: 700;
}

    .btn-link:hover {
        text-decoration: underline;
    }

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    font-weight: 800;
    cursor: pointer;
}

    .btn-sm:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.btn-sm-brand {
    background: var(--brand);
    color: #fff;
    border: 0;
    box-shadow: 0 10px 24px rgba(0,0,0,.10);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.badge-active {
    background: color-mix(in srgb, var(--brand) 14%, transparent);
    color: var(--brand);
}

.badge-warning {
    background: rgba(180,120,0,.12);
    color: #7a5000;
}

.badge-danger {
    background: rgba(160,0,0,.10);
    color: #7a0000;
}

/* Marketplace cards */
/* Grille produits */
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

/* Tablette */
@media (min-width: 740px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 par ligne */
@media (min-width: 980px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Marketplace card */
.mk-card {
    display: grid;
    grid-template-columns: 120px 1fr; /* image plus grande */
    gap: 14px;
    align-items: stretch;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(0,0,0,.07);
}

/* Wrapper "fond premium" derrière l'image */
.mk-imgwrap {
    width: 120px;
    height: 120px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: radial-gradient(70px 70px at 70% 20%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%), radial-gradient(90px 90px at 20% 90%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 65%), linear-gradient(135deg, #ffffff, color-mix(in srgb, var(--brand) 6%, white));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mk-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
}

/* Body */
.mk-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mk-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.mk-title {
    font-weight: 950;
    font-size: 15px;
    line-height: 1.2;
    /* Mobile: 1 ligne max */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Desktop: autoriser 2 lignes (marketplace style) */
@media (min-width: 740px) {
    .mk-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

.mk-sub {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Prix plus mis en avant */
.mk-price {
    font-weight: 900;
    color: #111;
    font-size: 13px;
}

    .mk-price span,
    .mk-price small {
        color: var(--muted);
    }

.mk-remaining {
    font-weight: 900;
    color: var(--brand);
    background: color-mix(in srgb, var(--brand) 10%, transparent);
    padding: 3px 10px;
    border-radius: 999px;
}

.mk-bottom {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.mk-add {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
}

.mk-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .mk-qty input[type="number"] {
        width: 92px;
        padding: 10px 10px;
        border-radius: 12px;
        border: 1px solid var(--border);
    }

.mk-unit {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.mk-card.hidden {
    display: none;
}

.load-more {
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}

    .load-more:hover {
        background: rgba(0,0,0,.02);
        color: var(--ink);
    }

/* Mobile: on réduit un peu */
@media (max-width: 560px) {
    .mk-card {
        grid-template-columns: 96px 1fr;
        padding: 12px;
    }

    .mk-imgwrap {
        width: 96px;
        height: 96px;
        border-radius: 16px;
    }

    .mk-img {
        border-radius: 16px;
    }

    .mk-qty input[type="number"] {
        width: 84px;
    }
}

.client-product-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 12px 26px color-mix(in srgb, var(--brand) 22%, rgba(0,0,0,.12));
    transition: transform .08s, filter .15s;
}

    .btn:hover {
        filter: brightness(.95);
    }

    .btn:active {
        transform: translateY(1px);
    }

.section {
    margin-top: 14px;
}

    .section h2 {
        margin: 0 0 10px 0;
        font-size: 18px;
    }

.muted {
    color: var(--muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
    background: rgba(245,245,243,.55);
}

.pill-link {
    text-decoration: none;
    color: inherit;
}

    .pill-link:hover {
        filter: brightness(.98);
    }

/* ─────────────────────────────────────────────────────────────
           Alerts (réutilisable)
        ───────────────────────────────────────────────────────────── */
.alert {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.alert-error {
    border: 1px solid rgba(160,0,0,.25);
    background: rgba(160,0,0,.06);
    color: #7a0000;
}

.alert-info {
    border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
    background: color-mix(in srgb, var(--brand) 8%, transparent);
    color: var(--brand);
}

/* ─────────────────────────────────────────────────────────────
           Topbar (réutilisable pour pages client)
        ───────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

/* ─────────────────────────────────────────────────────────────
           Cart / Panier
        ───────────────────────────────────────────────────────────── */
.cart-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.cart-meta {
    font-size: 13px;
    color: var(--muted);
}

    .cart-meta strong {
        color: var(--ink);
        font-weight: 900;
    }

.cart-empty {
    padding: 16px 0 6px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.cart-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.cart-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fafafa;
}

.cart-imgwrap {
    width: 120px;
    height: 120px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: radial-gradient(70px 70px at 70% 20%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%), radial-gradient(90px 90px at 20% 90%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 65%), linear-gradient(135deg, #ffffff, color-mix(in srgb, var(--brand) 6%, white));
    overflow: hidden;
}

.cart-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
    display: block;
}

.cart-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cart-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.cart-title {
    font-weight: 950;
    font-size: 15px;
    line-height: 1.2;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-line-total {
    font-weight: 950;
    color: #111;
    white-space: nowrap;
}

.cart-sub {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 13px;
    color: var(--muted);
}

    .cart-sub strong {
        color: var(--ink);
        font-weight: 900;
    }

.cart-actions {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
}

.cart-update-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
    flex-wrap: wrap;
}

.cart-remove-form {
    margin: 0;
}

.cart-qty {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cart-unit {
    font-size: 13px;
    font-weight: 900;
    color: var(--muted);
}

/* Bouton danger petit */
.btn-sm-danger {
    background: rgba(160,0,0,.10);
    color: #7a0000;
    border: 1px solid rgba(160,0,0,.22);
}

/* Résumé / total */
.cart-summary {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.cart-sum-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cart-sum-total {
    font-weight: 950;
    font-size: 18px;
}

/* Mobile */
@media (max-width: 560px) {
    .cart-item {
        grid-template-columns: 96px 1fr;
        padding: 12px;
    }

    .cart-imgwrap {
        width: 96px;
        height: 96px;
        border-radius: 16px;
    }

    .cart-img {
        border-radius: 16px;
    }

    input[type="number"] {
        width: 84px;
    }
}

/* ─────────────────────────────────────────────────────────────
                   Floating cart button (always visible)
                ───────────────────────────────────────────────────────────── */
.cart-fab {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
    background: color-mix(in srgb, var(--brand) 10%, white);
    box-shadow: 0 18px 40px rgba(0,0,0,.14);
    text-decoration: none;
    color: var(--ink);
    font-weight: 900;
    max-width: min(520px, calc(100vw - 24px));
}

    .cart-fab:hover {
        filter: brightness(.98);
    }

    .cart-fab:active {
        transform: translateX(-50%) translateY(1px);
    }

.cart-fab--empty {
    opacity: .65;
}

.cart-fab__icon {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 12px 26px color-mix(in srgb, var(--brand) 26%, rgba(0,0,0,.14));
    flex-shrink: 0;
}

.cart-fab__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cart-fab__title {
    font-size: 13px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-fab__sub {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
}

.cart-fab__pill {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    font-weight: 950;
    color: var(--ink);
    flex-shrink: 0;
}

.cart-fab__dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--brand);
}

/* Laisser de la place en bas pour ne pas masquer le contenu */
.container {
    padding-bottom: 90px;
}

@media (min-width: 980px) {
    .container {
        padding-bottom: 98px;
    }
}

/* ─────────────────────────────────────────────────────────────
                   Section Livraison
                ───────────────────────────────────────────────────────────── */
.addr-field {
    margin-top: 10px;
}

.addr-label {
    display: block;
    margin: 0 0 8px;
    font-weight: 700;
}

.addr-inputwrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}

    .addr-inputwrap:focus-within {
        border-color: rgba(0,0,0,0.25);
        box-shadow: 0 0 0 4px rgba(0,0,0,0.04);
    }

.addr-icon {
    opacity: .75;
}

.addr-input {
    border: 0 !important;
    outline: none !important;
    width: 100%;
    font-size: 14px;
    background: transparent;
    padding: 0;
}

.addr-clear {
    border: 0;
    background: rgba(0,0,0,0.06);
    border-radius: 999px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    line-height: 28px;
    font-weight: 700;
}

    .addr-clear:hover {
        background: rgba(0,0,0,0.10);
    }

.addr-help {
    margin-top: 8px;
    font-size: 13px;
    color: rgba(0,0,0,0.65);
    line-height: 1.4;
}

    .addr-help.err {
        color: #b00020;
    }

.addr-suggest {
    margin-top: 8px;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

    .addr-suggest button.suggest-item {
        width: 100%;
        text-align: left;
        padding: 10px 12px;
        border: 0;
        background: transparent;
        cursor: pointer;
        font-size: 14px;
    }

        .addr-suggest button.suggest-item:hover {
            background: rgba(0,0,0,0.04);
        }

        .addr-suggest button.suggest-item + button.suggest-item {
            border-top: 1px solid rgba(0,0,0,0.06);
        }
