/* ============================================================
   commerce-modal.css — style glassmorphism iOS
   ============================================================ */

/* ── Overlay ── */
#commerce-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
#commerce-modal-overlay.active {
    display: block;
}

/* ── Root ── */
#commerce-modal-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    pointer-events: none;
}
#commerce-modal-root.active {
    pointer-events: auto;
}

/* ── Base commune aux 4 modaux ── */
.cm-popup {
    position: absolute;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.10),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
    font-size: 13px;
    color: #1a2030;
    opacity: 0;
    pointer-events: none;
    transform: scale(.90);
    transition: opacity .2s cubic-bezier(.4,0,.2,1), transform .2s cubic-bezier(.4,0,.2,1);
    max-width: 220px;
    min-width: 160px;
    line-height: 1.4;
}
.cm-popup.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Dark mode */
body.dark-mode .cm-popup {
    background: rgba(28, 32, 42, 0.78);
    border-color: rgba(255, 255, 255, 0.10);
    color: #dde3ef;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.40),
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

/* ── Flèches directionnelles ── */
.cm-popup::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: inherit;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: rotate(45deg);
    backdrop-filter: inherit;
    -webkit-backdrop-filter: inherit;
}
body.dark-mode .cm-popup::before {
    border-color: rgba(255, 255, 255, 0.10);
}

#cm-top::before    { bottom: -6px; left: 50%; margin-left: -5px; border-top: none; border-left: none; }
#cm-bottom::before { top: -6px;    left: 50%; margin-left: -5px; border-bottom: none; border-right: none; }
#cm-left::before   { right: -6px;  top: 50%;  margin-top: -5px;  border-left: none; border-bottom: none; }
#cm-right::before  { left: -6px;   top: 50%;  margin-top: -5px;  border-right: none; border-top: none; }

/* ── Transform origins ── */
#cm-top    { transform-origin: bottom center; }
#cm-bottom { transform-origin: top center; }
#cm-left   { transform-origin: right center; }
#cm-right  { transform-origin: left center; }

/* ── Contenu ── */
.cm-popup .cm-title {
    font-size: 12px;
    font-weight: 700;
    color: inherit;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: .01em;
}
.cm-popup .cm-title i {
    font-size: 13px;
    color: #1abc9c;
    flex-shrink: 0;
}
body.dark-mode .cm-popup .cm-title i { color: #1abc9c; }

.cm-popup .cm-desc {
    font-size: 11px;
    color: rgba(26, 32, 48, 0.65);
    margin: 0 0 8px;
    line-height: 1.45;
}
body.dark-mode .cm-popup .cm-desc { color: rgba(221, 227, 239, 0.65); }

/* ── Bouton Voir la fiche ── */
.cm-btn-fiche {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(26, 188, 156, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s, transform .1s;
    border: 1px solid rgba(255,255,255,0.3);
}
.cm-btn-fiche:hover { background: rgba(23, 165, 137, 0.95); color: #fff; transform: translateY(-1px); }
.cm-btn-fiche i { font-size: 10px; }

/* ── Badges ── */
.cm-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cm-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid transparent;
}
.cm-badge-green  { background: rgba(26,188,156,.18); color: #0e8a72; border-color: rgba(26,188,156,.25); }
.cm-badge-blue   { background: rgba(37,99,235,.12);  color: #1d4ed8; border-color: rgba(37,99,235,.20); }
.cm-badge-orange { background: rgba(255,159,67,.15); color: #c2640a; border-color: rgba(255,159,67,.25); }
.cm-badge-gold   { background: rgba(241,196,15,.15); color: #92720a; border-color: rgba(241,196,15,.25); }

body.dark-mode .cm-badge-green  { color: #1abc9c; }
body.dark-mode .cm-badge-blue   { color: #60a5fa; }
body.dark-mode .cm-badge-orange { color: #ff9f43; }
body.dark-mode .cm-badge-gold   { color: #fbbf24; }

/* ── Stats table ── */
.cm-stats {
    width: 100%;
    border-collapse: collapse;
    margin-top: 4px;
}
.cm-stats tr + tr td {
    border-top: 1px solid rgba(0,0,0,0.06);
}
body.dark-mode .cm-stats tr + tr td {
    border-top-color: rgba(255,255,255,0.07);
}
.cm-stats td {
    padding: 4px 2px;
    font-size: 11px;
    vertical-align: middle;
}
.cm-stats td:first-child { color: rgba(26,32,48,0.55); }
.cm-stats td:last-child  { text-align: right; font-weight: 600; }
body.dark-mode .cm-stats td:first-child { color: rgba(221,227,239,0.55); }

.cm-stars { color: #f1c40f; font-size: 11px; }

/* ── Mini carte ── */
#cm-bottom { padding-bottom: 0; }
#cm-map-mini {
    width: 100%;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 6px;
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(255,255,255,0.4);
}

/* ── Bouton fermer ── */
.cm-close {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
    border: none;
    cursor: pointer;
    font-size: 10px;
    color: rgba(26,32,48,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    padding: 0;
}
.cm-close:hover {
    background: rgba(0,0,0,0.15);
    color: rgba(26,32,48,0.9);
}
body.dark-mode .cm-close {
    background: rgba(255,255,255,0.10);
    color: rgba(221,227,239,0.5);
}
body.dark-mode .cm-close:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

/* ── Carte active ── */
.commerces-locaux.cm-active,
.commerces-recent.cm-active,
.coup-de-coeur.cm-active,
.commercesvu.cm-active {
    outline: 2px solid rgba(26,188,156,0.7);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(26,188,156,0.15);
}

/* ── Mobile : masqué ── */
@media (max-width: 767px) {
    #commerce-modal-root,
    #commerce-modal-overlay { display: none !important; }
}