@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --terre: #E8791A;       /* orange logo */
  --terre-dark: #C4621A;  /* orange foncé hover */
  --sable: #FEF0E0;       /* sable chaud */
  --vert: #1E6B3C;        /* vert logo */
  --vert-dark: #154D2B;   /* vert foncé */
  --or: #F0A500;          /* or plus chaud */
  --nuit: #1A1209;
  --creme: #FFFAF4;       /* fond légèrement plus chaud */
  --rouge: #B83010;
  --gris: #F5EDE0;
  --bg: #F8F2EA;
  --text-muted: rgba(26,18,9,0.5);
  --border: rgba(26,18,9,0.08);
  --shadow: 0 4px 20px rgba(232,121,26,0.08);
  --shadow-lg: 0 16px 50px rgba(26,18,9,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'DM Sans', sans-serif; background: var(--creme); color: var(--nuit); overflow-x: hidden; }

/* TYPOGRAPHY */
.display { font-family: 'Playfair Display', serif; }

/* NAV */
.nav {
  position: fixed; top: 0; width: 100%; z-index: 200;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 5%;
  background: rgba(251,246,238,0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s;
}
.nav.scrolled { box-shadow: var(--shadow); }
.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}
.logo img {
  height: 42px;
  width: auto;
  display: block;
}
/* Fallback texte si image absente */
.logo-text { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 900; color: var(--terre); }
.logo-text span { color: var(--vert); }
.nav-center { display: flex; gap: 0.3rem; }
.nav-link { text-decoration: none; color: var(--nuit); font-size: 0.88rem; font-weight: 500; padding: 0.4rem 0.9rem; border-radius: 100px; transition: all 0.2s; opacity: 0.7; }
.nav-link:hover, .nav-link.active { opacity: 1; background: var(--gris); }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-cart {
  position: relative; width: 40px; height: 40px;
  border-radius: 50%; border: 1.5px solid var(--border);
  background: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: all 0.2s; text-decoration: none;
}
.nav-cart:hover { border-color: var(--terre); }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--terre); color: white;
  font-size: 0.65rem; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.4rem; border-radius: 100px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.25s; text-decoration: none; border: none; font-family: 'DM Sans', sans-serif; }
.btn-primary { background: var(--terre); color: white; }
.btn-primary:hover { background: var(--terre-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,121,26,0.4); }
.btn-secondary { background: transparent; color: var(--nuit); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--terre); color: var(--terre); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-vert { background: var(--vert); color: white; }
.btn-vert:hover { background: var(--vert-dark); transform: translateY(-1px); }

/* SECTION */
.section { padding: 5rem 5%; }
.section-tag { display: inline-block; background: rgba(232,121,26,0.12); color: var(--terre); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.3rem 0.8rem; border-radius: 100px; margin-bottom: 0.8rem; }
.section-title { font-family: 'Playfair Display', serif; font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 900; line-height: 1.1; margin-bottom: 0.8rem; }
.section-sub { font-size: 0.95rem; opacity: 0.6; line-height: 1.7; max-width: 520px; }

/* CARDS */
.card { background: white; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); transition: all 0.3s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* PRODUCT CARD */
.product-card { cursor: pointer; }
.product-card .card-img { height: 160px; display: flex; align-items: center; justify-content: center; font-size: 4rem; position: relative; }
.product-card .card-body { padding: 1rem; }
.product-card .p-vendor { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.product-card .p-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.product-card .p-market { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.product-card .p-footer { display: flex; justify-content: space-between; align-items: center; }
.product-card .p-price { font-weight: 700; color: var(--terre); font-size: 1rem; }
.product-card .p-unit { font-size: 0.72rem; color: var(--text-muted); }
.add-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--terre); color: white; border: none; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.add-btn:hover { background: var(--terre-dark); transform: scale(1.1); }
.fresh-badge { position: absolute; top: 8px; left: 8px; background: var(--vert); color: white; font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 100px; }
.rating { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.rating span { color: var(--or); }

/* STATUS BADGES */
.status { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.7rem; border-radius: 100px; font-size: 0.72rem; font-weight: 700; }
.status-en_livraison { background: rgba(233,185,73,0.15); color: #A07820; }
.status-confirme { background: rgba(45,106,79,0.12); color: var(--vert); }
.status-livre { background: rgba(45,106,79,0.2); color: #1B4332; }
.status-annule { background: rgba(139,32,32,0.1); color: var(--rouge); }
.status-en_attente { background: rgba(26,18,9,0.08); color: var(--text-muted); }

/* TOAST */
.tm-toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--nuit); color: white;
  padding: 0.8rem 1.5rem; border-radius: 100px;
  font-size: 0.88rem; font-weight: 500;
  z-index: 9999; transition: transform 0.3s ease;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.tm-toast.show { transform: translateX(-50%) translateY(0); }
.tm-toast-error { background: var(--rouge); }

/* FOOTER */
footer { background: var(--nuit); color: white; padding: 4rem 5% 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
.footer-logo { font-family: 'Playfair Display', serif; font-size: 1.4rem; font-weight: 900; margin-bottom: 0.8rem; }
.footer-logo span { color: var(--terre); }
.footer-desc { font-size: 0.82rem; opacity: 0.45; line-height: 1.7; margin-bottom: 1rem; }
.footer-col h5 { font-weight: 700; margin-bottom: 1rem; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--or); }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-col ul li a { text-decoration: none; color: rgba(255,255,255,0.45); font-size: 0.82rem; transition: color 0.2s; }
.footer-col ul li a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.07); padding-top: 1.5rem; display: flex; justify-content: space-between; font-size: 0.75rem; opacity: 0.35; }
.social-row { display: flex; gap: 0.8rem; margin-top: 1rem; }
.social-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; }
.social-btn:hover { border-color: var(--or); background: rgba(233,185,73,0.1); }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,18,9,0.6); z-index: 500; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; backdrop-filter: blur(4px); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: white; border-radius: 24px; width: 90%; max-width: 520px; max-height: 90vh; overflow-y: auto; transform: translateY(20px); transition: transform 0.3s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-family: 'Playfair Display', serif; font-weight: 900; font-size: 1.2rem; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--border); background: none; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.modal-close:hover { border-color: var(--terre); color: var(--terre); }
.modal-body { padding: 1.5rem; }

/* UTILS */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* INPUT */
.input-group { margin-bottom: 1rem; }
.input-label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; }
.input { width: 100%; padding: 0.7rem 1rem; border: 1.5px solid var(--border); border-radius: 12px; font-family: 'DM Sans', sans-serif; font-size: 0.9rem; color: var(--nuit); background: white; transition: border-color 0.2s; outline: none; }
.input:focus { border-color: var(--terre); box-shadow: 0 0 0 3px rgba(232,121,26,0.1); }
.input-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231A1209' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; }

@media (max-width: 768px) {
  .nav-center { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
