/* ================================================================
   My Marketplace — marketplace.css v1.0
   Mobile-first. Variables CSS. Zéro framework.
================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Nunito:wght@400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  --mm-primary:    #1B7A3E;
  --mm-primary-dk: #145f30;
  --mm-accent:     #D4A017;
  --mm-bg:         #FAFAF7;
  --mm-white:      #ffffff;
  --mm-text:       #1A1A1A;
  --mm-muted:      #6B7280;
  --mm-border:     #E5E7EB;
  --mm-danger:     #DC2626;
  --mm-warning:    #F59E0B;
  --mm-success:    #059669;
  --mm-info:       #3B82F6;
  --mm-radius:     8px;
  --mm-radius-lg:  12px;
  --mm-shadow:     0 2px 8px rgba(0,0,0,.08);
  --mm-shadow-md:  0 4px 16px rgba(0,0,0,.12);
  --mm-font-body:  'Nunito', sans-serif;
  --mm-font-title: 'Playfair Display', serif;
}

/* ── Reset de base ─────────────────────────────────────── */
.mm-wrap, .mm-store-page { font-family: var(--mm-font-body); color: var(--mm-text); }
.mm-wrap *, .mm-store-page * { box-sizing: border-box; }

/* ── Container ─────────────────────────────────────────── */
.mm-container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 768px) { .mm-container { padding: 0 2rem; } }

/* ── Wrap ──────────────────────────────────────────────── */
.mm-wrap { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; }
@media (min-width: 768px) { .mm-wrap { padding: 0 2rem; } }

/* ── Titles ────────────────────────────────────────────── */
.mm-title { font-family: var(--mm-font-title); font-size: 1.75rem; color: var(--mm-text); margin: 0 0 1rem; }
.mm-subtitle { color: var(--mm-muted); margin-bottom: 1.5rem; }
.mm-section-title { font-size: 1.2rem; font-weight: 700; color: var(--mm-text); margin: 0 0 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--mm-border); display: flex; align-items: center; gap: .5rem; }

/* ── Alertes ───────────────────────────────────────────── */
.mm-alert { padding: 1rem 1.25rem; border-radius: var(--mm-radius); margin-bottom: 1rem; font-size: .95rem; }
.mm-alert--info    { background: #EFF6FF; color: #1D4ED8; border-left: 4px solid var(--mm-info); }
.mm-alert--success { background: #ECFDF5; color: #065F46; border-left: 4px solid var(--mm-success); }
.mm-alert--warning { background: #FFFBEB; color: #92400E; border-left: 4px solid var(--mm-warning); }
.mm-alert--danger  { background: #FEF2F2; color: #991B1B; border-left: 4px solid var(--mm-danger); }

/* ── Badges ────────────────────────────────────────────── */
.mm-badge { display: inline-block; padding: .25rem .75rem; border-radius: 9999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.mm-badge--success, .mm-badge--approved { background: #D1FAE5; color: #065F46; }
.mm-badge--warning, .mm-badge--pending  { background: #FEF3C7; color: #92400E; }
.mm-badge--danger,  .mm-badge--rejected { background: #FEE2E2; color: #991B1B; }
.mm-badge--processing { background: #DBEAFE; color: #1D4ED8; }
.mm-badge--paid       { background: #D1FAE5; color: #065F46; }
.mm-badge--completed  { background: #D1FAE5; color: #065F46; }

/* ── Boutons ───────────────────────────────────────────── */
.mm-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.25rem; border-radius: var(--mm-radius); font-family: var(--mm-font-body); font-size: .95rem; font-weight: 600; cursor: pointer; border: 2px solid transparent; text-decoration: none; transition: all .2s; white-space: nowrap; }
.mm-btn:focus-visible { outline: 3px solid var(--mm-primary); outline-offset: 2px; }
.mm-btn--primary { background: var(--mm-primary); color: #fff; border-color: var(--mm-primary); }
.mm-btn--primary:hover { background: var(--mm-primary-dk); border-color: var(--mm-primary-dk); color: #fff; }
.mm-btn--secondary { background: transparent; color: var(--mm-primary); border-color: var(--mm-primary); }
.mm-btn--secondary:hover { background: var(--mm-primary); color: #fff; }
.mm-btn--ghost { background: transparent; color: var(--mm-muted); border-color: var(--mm-border); }
.mm-btn--ghost:hover { border-color: var(--mm-text); color: var(--mm-text); }
.mm-btn--lg { padding: .8rem 2rem; font-size: 1rem; }
.mm-btn--sm { padding: .35rem .75rem; font-size: .85rem; }
.mm-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── Formulaires ───────────────────────────────────────── */
.mm-form { display: flex; flex-direction: column; gap: 1.25rem; }
.mm-form-group { display: flex; flex-direction: column; gap: .4rem; }
.mm-form-group label { font-weight: 600; font-size: .9rem; color: var(--mm-text); }
.mm-input, .mm-textarea { width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--mm-border); border-radius: var(--mm-radius); font-family: var(--mm-font-body); font-size: .95rem; color: var(--mm-text); background: #fff; transition: border-color .2s; }
.mm-input:focus, .mm-textarea:focus { outline: none; border-color: var(--mm-primary); box-shadow: 0 0 0 3px rgba(27,122,62,.12); }
.mm-textarea { resize: vertical; min-height: 100px; }
.mm-required { color: var(--mm-danger); }
.mm-hint { font-size: .8rem; color: var(--mm-muted); }
.mm-form-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 600px) { .mm-form-row { grid-template-columns: 1fr 1fr; } }
.mm-form-actions { padding-top: .5rem; }
.mm-form-section { background: var(--mm-white); border: 1px solid var(--mm-border); border-radius: var(--mm-radius-lg); padding: 1.5rem; }
.mm-form-section-title { font-size: 1rem; font-weight: 700; margin: 0 0 1rem; color: var(--mm-text); }
.mm-input-prefix-wrap { display: flex; align-items: stretch; }
.mm-input-prefix { display: flex; align-items: center; padding: .65rem .75rem; background: var(--mm-bg); border: 1.5px solid var(--mm-border); border-right: none; border-radius: var(--mm-radius) 0 0 var(--mm-radius); font-size: .8rem; color: var(--mm-muted); white-space: nowrap; }
.mm-input-prefix + .mm-input { border-radius: 0 var(--mm-radius) var(--mm-radius) 0; }

/* ── Tableaux ──────────────────────────────────────────── */
.mm-table-wrap { overflow-x: auto; }
.mm-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mm-table th { background: var(--mm-bg); padding: .75rem 1rem; text-align: left; font-weight: 700; color: var(--mm-muted); border-bottom: 2px solid var(--mm-border); white-space: nowrap; }
.mm-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--mm-border); vertical-align: middle; }
.mm-table tr:last-child td { border-bottom: none; }
.mm-table tr:hover td { background: var(--mm-bg); }
.mm-table--compact th, .mm-table--compact td { padding: .5rem .75rem; }

/* ── Stats grid ────────────────────────────────────────── */
.mm-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.mm-stat-card { background: var(--mm-white); border: 1px solid var(--mm-border); border-radius: var(--mm-radius-lg); padding: 1.25rem; text-align: center; box-shadow: var(--mm-shadow); transition: box-shadow .2s; }
.mm-stat-card:hover { box-shadow: var(--mm-shadow-md); }
.mm-stat-icon { font-size: 2rem; margin-bottom: .5rem; display: block; }
.mm-stat-value { font-size: 1.4rem; font-weight: 700; color: var(--mm-primary); line-height: 1.2; }
.mm-stat-label { font-size: .8rem; color: var(--mm-muted); margin-top: .25rem; }
.mm-stat-cta { display: inline-block; margin-top: .75rem; font-size: .8rem; color: var(--mm-primary); font-weight: 600; text-decoration: none; }
.mm-stat-cta:hover { text-decoration: underline; }

/* ── Cards ─────────────────────────────────────────────── */
.mm-card { background: var(--mm-white); border: 1px solid var(--mm-border); border-radius: var(--mm-radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--mm-shadow); }

/* ── Dashboard header ──────────────────────────────────── */
.mm-dashboard-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.mm-vendor-logo-sm img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--mm-primary); }
.mm-dashboard-title-block { display: flex; flex-direction: column; gap: .35rem; }
.mm-dashboard-title-block .mm-title { margin: 0; }
.mm-link-store { font-size: .85rem; color: var(--mm-primary); font-weight: 600; text-decoration: none; }
.mm-link-store:hover { text-decoration: underline; }

/* ── Quick links ───────────────────────────────────────── */
.mm-quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.mm-quick-link { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.25rem; background: var(--mm-white); border: 1px solid var(--mm-border); border-radius: var(--mm-radius-lg); text-decoration: none; color: var(--mm-text); font-weight: 600; font-size: .9rem; transition: all .2s; text-align: center; }
.mm-quick-link:hover { border-color: var(--mm-primary); color: var(--mm-primary); box-shadow: var(--mm-shadow); }
.mm-ql-icon { font-size: 1.75rem; }

/* ── Products grid ─────────────────────────────────────── */
.mm-products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
@media (min-width: 768px) { .mm-products-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.mm-product-card { background: var(--mm-white); border: 1px solid var(--mm-border); border-radius: var(--mm-radius-lg); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.mm-product-card:hover { box-shadow: var(--mm-shadow-md); transform: translateY(-2px); }
.mm-product-card--link { text-decoration: none; color: var(--mm-text); display: flex; flex-direction: column; }
.mm-product-img { aspect-ratio: 1; overflow: hidden; background: var(--mm-bg); position: relative; }
.mm-product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.mm-product-card:hover .mm-product-img img { transform: scale(1.04); }
.mm-product-no-img { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2rem; color: var(--mm-border); }
.mm-product-stock { position: absolute; top: .5rem; right: .5rem; padding: .2rem .6rem; border-radius: 9999px; font-size: .75rem; font-weight: 700; }
.mm-stock--in  { background: #D1FAE5; color: #065F46; }
.mm-stock--out { background: #FEE2E2; color: #991B1B; }
.mm-product-info { padding: .75rem; flex: 1; }
.mm-product-info h4, .mm-product-title { font-size: .9rem; font-weight: 700; margin: 0 0 .4rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mm-product-price { font-size: 1rem; font-weight: 700; color: var(--mm-primary); }
.mm-product-actions { padding: .75rem; padding-top: 0; display: flex; gap: .5rem; }

/* ── Page header ───────────────────────────────────────── */
.mm-page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }

/* ── Empty state ───────────────────────────────────────── */
.mm-empty-state { text-align: center; padding: 3rem 1rem; color: var(--mm-muted); }
.mm-empty-icon { font-size: 3.5rem; margin-bottom: 1rem; display: block; }
.mm-empty-state h3 { font-size: 1.2rem; color: var(--mm-text); margin-bottom: .5rem; }

/* ── Amounts ───────────────────────────────────────────── */
.mm-amount--positive { color: var(--mm-success); font-weight: 700; }
.mm-amount--neutral  { color: var(--mm-muted); }

/* ── Balance card ──────────────────────────────────────── */
.mm-balance-card { background: linear-gradient(135deg, var(--mm-primary), var(--mm-primary-dk)); color: #fff; border-radius: var(--mm-radius-lg); padding: 2rem; margin-bottom: 1.5rem; text-align: center; }
.mm-balance-label { font-size: .9rem; opacity: .85; margin-bottom: .25rem; }
.mm-balance-value { font-size: 2.25rem; font-weight: 700; font-family: var(--mm-font-title); }
.mm-balance-hint { font-size: .8rem; opacity: .7; margin-top: .5rem; }

/* ── Stars ─────────────────────────────────────────────── */
.mm-stars { display: inline-flex; gap: .1rem; }
.mm-star svg { display: block; }
.mm-star--full svg  { fill: var(--mm-accent); stroke: var(--mm-accent); }
.mm-star--half svg  { fill: var(--mm-accent); stroke: var(--mm-accent); opacity: .6; }
.mm-star--empty svg { fill: none; stroke: var(--mm-border); }
.mm-star--btn { background: none; border: none; cursor: pointer; padding: 0; transition: transform .1s; }
.mm-star--btn:hover { transform: scale(1.2); }
.mm-star--btn.mm-star--full svg { fill: var(--mm-accent); stroke: var(--mm-accent); }

/* ── Reviews ───────────────────────────────────────────── */
.mm-reviews-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.mm-review-item { border-bottom: 1px solid var(--mm-border); padding-bottom: 1rem; }
.mm-review-item:last-child { border-bottom: none; }
.mm-review-header { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.mm-reviewer-name { font-weight: 700; font-size: .95rem; }
.mm-review-date { font-size: .8rem; color: var(--mm-muted); margin-left: auto; }
.mm-review-comment { margin: 0; color: var(--mm-text); font-size: .9rem; line-height: 1.6; }
.mm-review-form-wrap { border-top: 1px solid var(--mm-border); padding-top: 1.5rem; margin-top: 1rem; }

/* ── Store page ────────────────────────────────────────── */
.mm-store-hero { min-height: 220px; background: linear-gradient(135deg, var(--mm-primary-dk), #0d4422); background-size: cover; background-position: center; }
.mm-store-hero-overlay { min-height: 220px; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; }
.mm-store-hero-inner { width: 100%; padding-bottom: 1.5rem; display: flex; align-items: flex-end; gap: 1.25rem; }
.mm-store-logo { width: 80px; height: 80px; border-radius: var(--mm-radius-lg); object-fit: cover; border: 3px solid #fff; box-shadow: var(--mm-shadow-md); flex-shrink: 0; }
.mm-store-logo-placeholder { width: 80px; height: 80px; border-radius: var(--mm-radius-lg); background: var(--mm-accent); color: #fff; font-size: 1.75rem; font-weight: 900; display: flex; align-items: center; justify-content: center; border: 3px solid #fff; text-transform: uppercase; flex-shrink: 0; }
.mm-store-name { font-family: var(--mm-font-title); font-size: 1.75rem; color: #fff; margin: 0 0 .5rem; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
.mm-store-rating { display: flex; align-items: center; gap: .5rem; }
.mm-rating-value { font-weight: 700; color: var(--mm-accent); font-size: 1rem; }
.mm-rating-count { font-size: .85rem; color: rgba(255,255,255,.8); }
.mm-store-body { padding-top: 2rem; padding-bottom: 3rem; }
.mm-store-description { margin-bottom: 2rem; }
.mm-store-description h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .75rem; }
.mm-store-products { margin-bottom: 2rem; }
.mm-store-reviews { margin-bottom: 2rem; }
.mm-count { background: var(--mm-bg); padding: .15rem .6rem; border-radius: 9999px; font-size: .8rem; color: var(--mm-muted); }

/* ── Logo preview ──────────────────────────────────────── */
.mm-logo-preview { margin-bottom: 1rem; }
.mm-logo-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--mm-radius); border: 2px solid var(--mm-border); }

/* ── Section ───────────────────────────────────────────── */
.mm-section { margin-bottom: 2rem; }

/* ── Misc ──────────────────────────────────────────────── */
.mm-text-muted { color: var(--mm-muted); font-size: .9rem; }
.mm-link { color: var(--mm-primary); font-weight: 600; text-decoration: none; font-size: .9rem; }
.mm-link:hover { text-decoration: underline; }
.mm-pagination { display: flex; justify-content: center; gap: 1rem; margin-top: 1.5rem; }

/* ── Admin styles ──────────────────────────────────────── */
.mm-admin-wrap { max-width: 1200px; }
.mm-admin-wrap h1 { font-size: 1.5rem; margin-bottom: 1.25rem; display: flex; align-items: center; gap: .5rem; }
.mm-admin-tabs { display: flex; gap: .25rem; margin-bottom: 1.25rem; border-bottom: 2px solid var(--mm-border); padding-bottom: 0; flex-wrap: wrap; }
.mm-admin-tab { padding: .5rem 1rem; text-decoration: none; font-size: .875rem; font-weight: 600; color: var(--mm-muted); border-radius: var(--mm-radius) var(--mm-radius) 0 0; border: 2px solid transparent; border-bottom: none; transition: color .2s; }
.mm-admin-tab.active, .mm-admin-tab:hover { color: var(--mm-primary); border-color: var(--mm-border) var(--mm-border) var(--mm-white); background: var(--mm-white); }
.mm-admin-tab.active { color: var(--mm-primary); border-color: var(--mm-border); }
.mm-actions { white-space: nowrap; }
.mm-actions .button { margin-right: .25rem; }

/* Responsive tablettes */
@media (max-width: 768px) {
  .mm-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .mm-quick-links { grid-template-columns: repeat(2, 1fr); }
  .mm-store-hero-inner { flex-direction: column; align-items: flex-start; padding: 1rem; }
}

/* Responsive mobile */
@media (max-width: 414px) {
  .mm-title { font-size: 1.35rem; }
  .mm-stats-grid { grid-template-columns: 1fr 1fr; }
  .mm-balance-value { font-size: 1.75rem; }
  .mm-products-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
  .mm-products-grid { grid-template-columns: 1fr; }
}
