/* =====================================================================
   ARCHE DU PAIN - CSS commun IHM client
   Mobile-first, compatible desktop
   Palette inspiree du logo : tons sable, brun terre, creme
   ===================================================================== */

:root {
    --acp-cream:        #f5ede1;
    --acp-cream-light:  #faf6ef;
    --acp-sand:         #e8d9c4;
    --acp-sand-dark:    #d4c4ad;
    --acp-tan:          #c9a47e;
    --acp-brown:        #6b4f3a;
    --acp-brown-dark:   #563f2e;
    --acp-brown-light:  #8a7560;
    --acp-text:         #3a2e23;
    --acp-text-light:   #8a7560;
    --acp-success:      #5a8a3e;
    --acp-danger:       #c0392b;
    --acp-warning:      #d68f3a;
    --acp-radius:       8px;
    --acp-radius-lg:    12px;
    --acp-shadow:       0 2px 8px rgba(107, 79, 58, 0.08);
    --acp-shadow-lg:    0 8px 32px rgba(107, 79, 58, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--acp-cream);
    color: var(--acp-text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    min-height: 100dvh;
}

/* =====================================================================
   APP CONTAINER (centre sur desktop, plein ecran sur mobile)
   ===================================================================== */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--acp-cream);
    display: flex;
    flex-direction: column;
    position: relative;
}

@media (min-width: 600px) {
    .app {
        box-shadow: var(--acp-shadow-lg);
    }
    body {
        background: linear-gradient(135deg, var(--acp-cream) 0%, var(--acp-sand) 100%);
        background-attachment: fixed;
    }
}

/* =====================================================================
   HEADER avec logo
   ===================================================================== */
.acp-header {
    background: var(--acp-cream-light);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--acp-sand);
    position: sticky;
    top: 0;
    z-index: 100;
}

.acp-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.acp-header-logo img {
    height: 38px;
    width: auto;
}

.acp-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--acp-brown);
}

.acp-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.acp-header-btn {
    background: transparent;
    border: 1px solid var(--acp-sand-dark);
    color: var(--acp-brown);
    padding: 6px 12px;
    border-radius: var(--acp-radius);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.acp-header-btn:hover { background: var(--acp-sand); }

/* =====================================================================
   HERO LOGO (page login centree)
   ===================================================================== */
.acp-hero {
    text-align: center;
    padding: 32px 20px 16px;
}
.acp-hero img {
    max-width: 220px;
    width: 60%;
    height: auto;
}
.acp-hero-fallback-title {
    font-size: 26px;
    font-weight: 600;
    color: var(--acp-brown);
    font-style: italic;
    margin-top: 8px;
}
.acp-hero-fallback-sub {
    font-size: 12px;
    color: var(--acp-brown-light);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 4px;
}

/* =====================================================================
   CARDS
   ===================================================================== */
.acp-card {
    background: #fff;
    border-radius: var(--acp-radius-lg);
    box-shadow: var(--acp-shadow);
    padding: 24px;
    margin: 16px 20px;
}

.acp-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--acp-brown);
    margin-bottom: 16px;
    text-align: center;
}

/* =====================================================================
   FORMS
   ===================================================================== */
.acp-form-group {
    margin-bottom: 16px;
}
.acp-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--acp-brown);
    margin-bottom: 6px;
}
.acp-form-group input,
.acp-form-group select,
.acp-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--acp-sand-dark);
    border-radius: var(--acp-radius);
    font-size: 16px; /* >=16px evite le zoom auto sur iOS */
    font-family: inherit;
    background: var(--acp-cream-light);
    color: var(--acp-text);
}
.acp-form-group input:focus,
.acp-form-group select:focus,
.acp-form-group textarea:focus {
    outline: none;
    border-color: var(--acp-tan);
    background: #fff;
}
.acp-form-group small {
    display: block;
    font-size: 12px;
    color: var(--acp-text-light);
    margin-top: 4px;
}

/* =====================================================================
   BOUTONS
   ===================================================================== */
.acp-btn {
    display: inline-block;
    padding: 12px 20px;
    background: var(--acp-brown);
    color: #fff;
    border: none;
    border-radius: var(--acp-radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
}
.acp-btn:hover:not(:disabled) { background: var(--acp-brown-dark); }
.acp-btn:disabled { background: var(--acp-brown-light); cursor: not-allowed; opacity: 0.7; }

.acp-btn-block { width: 100%; display: block; }
.acp-btn-secondary {
    background: transparent;
    color: var(--acp-brown);
    border: 1px solid var(--acp-sand-dark);
}
.acp-btn-secondary:hover:not(:disabled) { background: var(--acp-sand); }
.acp-btn-danger { background: var(--acp-danger); }
.acp-btn-danger:hover:not(:disabled) { background: #a02e22; }
.acp-btn-success { background: var(--acp-success); }

.acp-btn-link {
    background: transparent;
    color: var(--acp-brown);
    border: none;
    padding: 8px;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
}

/* =====================================================================
   MESSAGES
   ===================================================================== */
.acp-error {
    background: #fdecea;
    color: var(--acp-danger);
    border: 1px solid #f5c6c1;
    padding: 10px 14px;
    border-radius: var(--acp-radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}
.acp-error.show { display: block; }

.acp-info {
    background: var(--acp-cream-light);
    color: var(--acp-brown);
    border: 1px solid var(--acp-sand);
    padding: 10px 14px;
    border-radius: var(--acp-radius);
    font-size: 13px;
    margin-bottom: 16px;
}

/* =====================================================================
   TOAST
   ===================================================================== */
.acp-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: var(--acp-radius);
    font-size: 14px;
    color: #fff;
    background: var(--acp-brown);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
    pointer-events: none;
    max-width: 90vw;
    box-shadow: var(--acp-shadow-lg);
}
.acp-toast.show { opacity: 1; }
.acp-toast.success { background: var(--acp-success); }
.acp-toast.error   { background: var(--acp-danger); }

/* =====================================================================
   FOOTER
   ===================================================================== */
.acp-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--acp-text-light);
}

.acp-link {
    color: var(--acp-brown);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
}
.acp-link:hover { color: var(--acp-brown-dark); }

/* =====================================================================
   CATALOGUE
   ===================================================================== */
.acp-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 100px; /* place pour le panier sticky */
}

.acp-categ-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 16px;
    background: var(--acp-cream-light);
    border-bottom: 1px solid var(--acp-sand);
    position: sticky;
    top: 0;
    z-index: 50;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.acp-categ-tabs::-webkit-scrollbar { display: none; }

.acp-categ-tab {
    padding: 8px 16px;
    border: 1px solid var(--acp-sand-dark);
    background: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-family: inherit;
    color: var(--acp-brown);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.acp-categ-tab.active {
    background: var(--acp-brown);
    border-color: var(--acp-brown);
    color: #fff;
}

.acp-prod-list {
    padding: 16px;
}

.acp-prod-card {
    background: #fff;
    border-radius: var(--acp-radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--acp-shadow);
    display: flex;
    align-items: center;
    gap: 12px;
}
.acp-prod-card.disabled { opacity: 0.5; }

.acp-prod-info { flex: 1; min-width: 0; }
.acp-prod-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--acp-text);
}
.acp-prod-price {
    font-size: 13px;
    color: var(--acp-brown);
    margin-top: 2px;
}
.acp-prod-unavailable {
    font-size: 11px;
    color: var(--acp-danger);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.acp-qty {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.acp-qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--acp-sand-dark);
    background: var(--acp-cream-light);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 600;
    color: var(--acp-brown);
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    font-family: inherit;
}
.acp-qty-btn:hover:not(:disabled) { background: var(--acp-sand); }
.acp-qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.acp-qty-input {
    width: 44px;
    text-align: center;
    border: 1px solid var(--acp-sand-dark);
    border-radius: var(--acp-radius);
    padding: 6px 4px;
    font-size: 15px;
    font-family: inherit;
    background: var(--acp-cream-light);
    color: var(--acp-text);
}
.acp-qty-input:disabled { opacity: 0.5; }
.acp-qty-input::-webkit-outer-spin-button,
.acp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}
.acp-qty-input { -moz-appearance: textfield; }

/* =====================================================================
   BARRE PANIER STICKY
   ===================================================================== */
.acp-cart-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-top: 1px solid var(--acp-sand);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex;
    gap: 8px;
    align-items: center;
    box-shadow: 0 -4px 12px rgba(107, 79, 58, 0.08);
    z-index: 200;
}
.acp-cart-summary {
    flex: 1;
}
.acp-cart-count {
    font-size: 12px;
    color: var(--acp-text-light);
}
.acp-cart-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--acp-brown);
}

.acp-cart-bar .acp-btn {
    padding: 10px 18px;
    font-size: 14px;
}

/* =====================================================================
   CHOIX LIVRAISON
   ===================================================================== */
.livraison-list {
    background: #fff;
    border-radius: var(--acp-radius);
    box-shadow: var(--acp-shadow);
    overflow: hidden;
}
.livraison-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--acp-sand);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.livraison-item:last-child { border-bottom: none; }
.livraison-item:hover { background: var(--acp-cream-light); }
.livraison-item.active { background: var(--acp-cream); }
.livraison-radio {
    font-size: 18px;
    color: var(--acp-tan);
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.livraison-item.active .livraison-radio { color: var(--acp-brown); }
.livraison-label {
    font-size: 14px;
    color: var(--acp-text);
    text-transform: capitalize;
}
.livraison-item.active .livraison-label {
    font-weight: 600;
    color: var(--acp-brown);
}

/* =====================================================================
   PAGE RECAP / CONFIRMATION
   ===================================================================== */
.acp-recap-list {
    background: #fff;
    border-radius: var(--acp-radius);
    box-shadow: var(--acp-shadow);
    overflow: hidden;
    margin-bottom: 16px;
}
.acp-recap-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--acp-sand);
}
.acp-recap-item:last-child { border-bottom: none; }
.acp-recap-item-info { flex: 1; }
.acp-recap-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--acp-text);
}
.acp-recap-item-detail {
    font-size: 12px;
    color: var(--acp-text-light);
    margin-top: 2px;
}
.acp-recap-item-total {
    font-size: 15px;
    font-weight: 600;
    color: var(--acp-brown);
}
.acp-recap-total-row {
    background: var(--acp-cream-light);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid var(--acp-brown);
}
.acp-recap-total-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--acp-brown);
}
.acp-recap-total-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--acp-brown);
}

.acp-recap-livraison {
    background: #fff;
    border-radius: var(--acp-radius);
    box-shadow: var(--acp-shadow);
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--acp-text);
    text-align: center;
}
.acp-recap-livraison strong { color: var(--acp-brown); }

/* =====================================================================
   SUCCESS PAGE
   ===================================================================== */
.acp-success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--acp-success);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    margin: 0 auto 20px;
    font-weight: 700;
}

/* =====================================================================
   LOADER
   ===================================================================== */
.acp-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--acp-text-light);
    font-size: 14px;
}

.acp-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--acp-text-light);
    font-size: 14px;
}

/* =====================================================================
   UTILS
   ===================================================================== */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
