/* =========================================================================
   MODULE SORTIES (Bandeau, Recherche, Vignettes)
   ========================================================================= */

.mapi-hero-full {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: 100vw;
    min-height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 60px;
    z-index: 1;
}

.mapi-hero-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 1; }

.mapi-comm-title { 
    font-size: 2.2em; font-weight: 800; color: white; margin-bottom: 10px; 
    text-transform: uppercase; font-family: sans-serif; text-shadow: 0 2px 10px rgba(0,0,0,0.5); 
    text-align: center; position: relative; z-index: 2; 
}

.mapi-comm-subtitle { 
    font-size: 1.2em; margin-bottom: 30px; font-weight: 300; font-family: sans-serif; 
    color: white !important; text-shadow: 0 2px 5px rgba(0,0,0,0.5); text-align: center; position: relative; z-index: 2; 
}

.mapi-hero-btn { 
    background: #ff5252; color: white; padding: 15px 40px; border-radius: 50px; 
    font-weight: 800; text-decoration: none; font-size: 1.1em; display: inline-block; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); transition: 0.3s; border: none; position: relative; z-index: 2; 
}
.mapi-hero-btn:hover { background: #ff3b3b; transform: translateY(-2px); color: white; }

/* MODULE DE RECHERCHE */
.mapi-search-overlap {
    width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
    position: relative; z-index: 10; margin-top: -60px; margin-bottom: 50px;
    display: flex; justify-content: center; padding: 0 20px;
}
.mapi-search-box {
    background: #111111; padding: 30px; border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3); display: flex; gap: 15px; flex-wrap: wrap;
    justify-content: center; align-items: center; width: 100%; max-width: 1200px;
}
.mapi-s-input {
    background: #333 !important; border: 1px solid #444 !important; color: #ffffff !important;
    color-scheme: dark; height: 55px !important; line-height: 55px !important;
    padding: 0 20px !important; border-radius: 12px !important; font-size: 1.05em !important;
    flex: 1; min-width: 140px; box-shadow: none !important; transition: all 0.2s; font-family: inherit !important;
}
.mapi-s-input option { background: #333; color: white; }
.mapi-s-input::placeholder { color: #aaa !important; opacity: 1; }
.mapi-s-input:focus { border-color: #ff5252 !important; background: #222 !important; box-shadow: 0 0 0 3px rgba(255,82,82,0.15) !important; outline: none; }
.mapi-s-btn { background: #ff5252; color: white; border: none; height: 55px; padding: 0 28px; border-radius: 12px; font-weight: 700; font-size: 1em; cursor: pointer; text-transform: uppercase; white-space: nowrap; font-family: inherit; transition: all 0.2s; }
.mapi-s-btn:hover { background: #ff3b3b; }

/* GRILLE ET VIGNETTES */
.mapi-grid-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 30px; max-width: 1250px; margin: 0 auto 60px auto; padding: 0 20px; }
.mapi-visual-card { background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid #eee; display: flex; flex-direction: column; transition: transform 0.3s ease, box-shadow 0.3s ease; height: 100%; }
.mapi-visual-card:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0,0,0,0.1); }
.mapi-card-image { height: 200px; background-size: cover; background-position: center; position: relative; }
.mapi-date-tag { position: absolute; top: 15px; left: 15px; background: rgba(255,255,255,0.95); border-radius: 8px; padding: 5px 10px; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,0.15); line-height: 1.1; color: #333; }
.mapi-date-tag .day { display: block; font-size: 1.2em; font-weight: 800; }
.mapi-date-tag .month { display: block; font-size: 0.7em; text-transform: uppercase; font-weight: 700; }
.mapi-lvl-tag { position: absolute; bottom: 10px; right: 10px; padding: 4px 10px; border-radius: 20px; color: white; font-size: 0.75em; font-weight: 700; text-transform: uppercase; }
.bg-green { background: #27ae60; } .bg-orange { background: #f39c12; } .bg-red { background: #e74c3c; }
.mapi-card-content { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.mapi-card-title { margin: 0 0 10px 0; font-size: 1.15em; font-weight: 800; line-height: 1.3; }
.mapi-card-title a { text-decoration: none; color: #2c3e50; }
.mapi-card-info { color: #7f8c8d; font-size: 0.9em; margin-bottom: 15px; display: flex; align-items: center; gap: 5px; }
.mapi-stats-row { display: flex; gap: 15px; font-size: 0.85em; color: #555; border-top: 1px solid #f9f9f9; padding-top: 15px; margin-top: auto; }
.mapi-stat-item { display: flex; align-items: center; gap: 5px; }
.mapi-card-footer { background: #fcfcfc; border-top: 1px solid #eee; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; }
.mapi-author-box { display: flex; align-items: center; gap: 8px; font-size: 0.85em; font-weight: 600; color: #555; }
.mapi-author-box img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.mapi-link-arrow { text-decoration: none; color: #e74c3c; font-weight: 800; font-size: 0.8em; letter-spacing: 0.5px; transition: 0.2s; }
.mapi-link-arrow:hover { padding-left: 5px; }

/* TOOLTIPS stats cartes événements */
.mapi-stat-item { position: relative; }
.mapi-stat-item[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #1c1c1e; color: #fff; font-size: 0.72em; font-weight: 600; white-space: nowrap; padding: 4px 9px; border-radius: 6px; pointer-events: none; z-index: 10; }
.mapi-stat-item[data-tooltip]:hover::before { content: ''; position: absolute; bottom: calc(100% + 1px); left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1c1c1e; pointer-events: none; z-index: 10; }
/* Titre min-height pour aligner toutes les cartes entre elles */
.mapi-card-title { min-height: 2.8em; }

/* PAGINATION */
.mapi-pagination { margin-top: 40px; text-align: center; }
.mapi-pagination .page-numbers { display: inline-block; padding: 8px 15px; margin: 0 5px; border-radius: 5px; background: white; border: 1px solid #ddd; color: #333; text-decoration: none; font-weight: bold; }
.mapi-pagination .page-numbers.current { background: #ff5252; color: white; border-color: #ff5252; }

/* GESTION INTELLIGENTE DU MENU */
body.logged-in .mapi-only-guest { display: none !important; }
body:not(.logged-in) .mapi-only-member { display: none !important; }

/* INFOBULLES UNIVERSELLES */
[data-tooltip-text] { position: relative; }
[data-tooltip-text]:hover::after {
    content: attr(data-tooltip-text); position: absolute; bottom: calc(100% + 10px); left: 50%; 
    transform: translateX(-50%); background: #1c1c1e; color: #ffffff; padding: 8px 12px; border-radius: 8px;
    font-size: 12px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    white-space: nowrap; pointer-events: none; z-index: 99999; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0; animation: mapiTooltipFadeIn 0.2s 0.1s forwards;
}
[data-tooltip-text]:hover::before {
    content: ''; position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
    border-width: 6px 6px 0; border-style: solid; border-color: #1c1c1e transparent transparent transparent;
    z-index: 99999; opacity: 0; pointer-events: none; animation: mapiTooltipFadeIn 0.2s 0.1s forwards;
}
@keyframes mapiTooltipFadeIn { from { opacity: 0; transform: translate(-50%, 5px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* =========================================================================
   FIX MOBILE : GRILLES EN COLONNE UNIQUE (v20.7)
   Empêche les vignettes de déborder à droite sur smartphone
   ========================================================================= */
@media (max-width: 999px) {
    .mapi-grid-results {
        grid-template-columns: 1fr !important;
        padding: 0 15px !important;
    }
    .mapi-blog-grid {
        grid-template-columns: 1fr !important;
    }
}
/* =========================================================================
   BTN-SIGNET — BOUTON MAPIRANDO GLOBAL (2 variantes : dark, light)
   ========================================================================= */
.btn-signet-dark {
    appearance: none;
    background-color: #000000 !important;
    color: #ffffff !important;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    padding: 15px 30px;
    position: relative;
    border: 1px solid #222222 !important;
    border-top: 2px solid transparent;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    gap: 8px;
    border-radius: 14px;
    overflow: visible !important;
}
.btn-signet-dark::before {
    display: none !important;
    content: none !important;
}
.btn-signet-dark:hover {
    border-top-color: transparent !important;
    color: #ffffff !important;
    background-color: #000000 !important;
    opacity: 0.85;
}
.btn-signet-dark:hover::before {
    display: none !important;
}

.btn-signet-light {
    appearance: none;
    background-color: #ffffff !important;
    color: #000000 !important;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    padding: 15px 30px;
    position: relative;
    border: 1px solid #e2e8f0 !important;
    border-top: 2px solid transparent;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    gap: 8px;
    border-radius: 14px;
    overflow: visible !important;
}
.btn-signet-light::before {
    display: none !important;
    content: none !important;
}
.btn-signet-light:hover {
    border-top-color: transparent !important;
    color: #000000 !important;
    background-color: #f5f5f5 !important;
    opacity: 0.9;
}
.btn-signet-light:hover::before {
    display: none !important;
}

/* Reset button[type=submit] pour Blocksy — triangle rouge supprimé */
button[type="submit"].btn-signet-dark { overflow: visible !important; position: relative !important; }
button[type="submit"].btn-signet-dark::before { display: none !important; content: none !important; }
button[type="submit"].btn-signet-dark:hover::before { display: none !important; content: none !important; }

@media (max-width: 768px) {
    .btn-signet-dark, .btn-signet-light { padding: 12px 22px; font-size: 11px; letter-spacing: 1px; }
}