/*
 * Journal Plugin — page d'un numéro
 * Repris du thème Newspaper (fichier single-journal.php) le 2026-11-13 : les mises à jour du thème ne l'effacent plus.
 * Seule différence : box-sizing limité à .jm-single-container (il touchait toute la page).
 */

/* === SINGLE JOURNAL - CAROUSEL & SIDEBAR === */
:root {
    --jm-primary: #bf2828;
    --jm-primary-dark: #9a2020;
    --jm-black: #000000;
    --jm-white: #ffffff;
    --jm-gray-light: #f8f9fa;
    --jm-gray: #e9ecef;
    --jm-text: #333333;
}

:where(.jm-single-container, .jm-single-container *) { /* :where() = même priorité nulle que l'ancien « * » */
    box-sizing: border-box;
}

.jm-single-container {
    max-width: 1068px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
.jm-journal-header {
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--jm-gray);
}

.jm-journal-header h1 {
    font-size: 3em;
    color: var(--jm-primary);
    margin: 0;
    font-weight: 800;
    line-height: 1.2;
}

.jm-journal-subtitle {
    font-size: 1.5em;
    color: #000;
    margin: 0 0 10px 0;
    font-weight: 400;
    text-transform: uppercase;
}

/* Date de publication */
.jm-journal-date {
    font-size: 0.7em;
    color: #ffffff;
    margin: 10px 0 0 0;
    font-weight: 500;
    background-color: #c23333;
    width: auto;
    margin-bottom: 6px;
    display: inline-block;
    padding: 0px 5px;
}

/* Layout principal */
.jm-content-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 60px;
    align-items: start;
}

/* Sidebar gauche */
.jm-sidebar-left {
    position: sticky;
    top: 40px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* === CAROUSEL COUVERTURE === */
.jm-cover-box {
    background: var(--jm-white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.jm-carousel-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    background: var(--jm-gray);
}

.jm-carousel-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.jm-carousel-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

.jm-carousel-slide {
    min-width: 100%;
    height: 100%;
}

.jm-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jm-carousel-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.jm-carousel-placeholder span {
    font-size: 4em;
    color: #999;
}

/* Flèches carousel */
.jm-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(191, 40, 40, 0.9);
    color: var(--jm-white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.jm-carousel-btn:hover {
    background: var(--jm-primary-dark);
    transform: translateY(-50%) scale(1.1);
}

.jm-carousel-prev {
    left: 10px;
}

.jm-carousel-next {
    right: 10px;
}

.jm-carousel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Bouton PDF */
.jm-btn-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--jm-primary);
    color: var(--jm-white);
    padding: 15px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1em;
    transition: all 0.3s;
    width: 100%;
    box-shadow: 0 4px 15px rgba(191, 40, 40, 0.3);
}

.jm-btn-pdf:hover {
    background: var(--jm-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(191, 40, 40, 0.4);
}

/* Section Prix */
.jm-price-box {
    background: linear-gradient(135deg, var(--jm-primary) 0%, var(--jm-primary-dark) 100%);
    color: var(--jm-white);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(191, 40, 40, 0.3);
}

.jm-price-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.jm-price-amount {
    font-size: 3em;
    font-weight: 800;
    margin: 10px 0;
    line-height: 1;
}

.jm-price-amount span {
    font-size: 0.4em;
    vertical-align: super;
}

.jm-btn-buy {
    display: inline-block;
    background: var(--jm-white);
    color: var(--jm-primary);
    padding: 12px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1em;
    margin-top: 15px;
    transition: all 0.3s;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    border: none;
}

.jm-btn-buy:hover {
    background: var(--jm-black);
    color: var(--jm-white);
    transform: translateY(-2px);
}

/* Options */
.jm-options-box {
    background: var(--jm-white);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--jm-gray);
}

.jm-options-box h4 {
    margin: 0 0 15px 0;
    color: var(--jm-black);
    font-size: 1.1em;
    font-weight: 700;
}

.jm-options-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.jm-options-list li {
    padding: 10px 15px;
    background: #bf2828;
    margin-bottom: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #fff;
    border-left: 4px solid #000;
    font-size: 0.9em;
}

.jm-options-list li:last-child {
    margin-bottom: 0;
}

/* === SOMMAIRE & DOSSIERS - AVEC AUTEURS & TRONCATURE === */
.jm-sommaire-box,
.jm-dossiers-box {
    background: var(--jm-white);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid var(--jm-gray);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.jm-sommaire-box h3,
.jm-dossiers-box h3 {
    font-size: 1.5em;
    color: var(--jm-primary);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--jm-gray);
    font-weight: 700;
}

.jm-sommaire-list,
.jm-dossiers-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.jm-sommaire-list li{
    padding: 5px 0;
    border-bottom: 1px solid var(--jm-gray-light);
    transition: all 0.2s;
}

.jm-dossiers-list li {
    padding: 15px 0;
    border-bottom: 1px solid var(--jm-gray-light);
    transition: all 0.2s;
}

.jm-sommaire-list li:hover{
    background: var(--jm-gray-light);
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 4px;
}

.jm-dossiers-list li:hover {
    background: var(--jm-gray-light);
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 4px;
}

.jm-sommaire-list li:last-child,
.jm-dossiers-list li:last-child {
    border-bottom: none;
}

/* Lien avec layout flex colonne pour titre + auteur */
.jm-sommaire-list a,
.jm-dossiers-list a {
    color: var(--jm-text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: color 0.2s;
    cursor: help;
    
    /* Troncature multi-lignes pour le titre */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    hyphens: auto;
}

.jm-sommaire-list a:hover,
.jm-dossiers-list a:hover {
    color: var(--jm-primary);
}

/* === DOSSIERS : Layout avec image === */
.jm-dossiers-list li.jm-dossier-item {
    padding: 8px 0;
}

.jm-dossier-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-decoration: none;
    color: var(--jm-text);
    transition: color 0.2s;
}

.jm-dossier-link:hover {
    color: var(--jm-primary);
}

.jm-dossier-image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--jm-gray);
    display: flex;
    align-items: center;
    justify-content: center;
}

.jm-dossier-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jm-dossier-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.jm-dossier-title {
    font-size: 0.9em;
    line-height: 1.3;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.jm-dossier-author {
    font-size: 0.85em;
    color: #bf2828;
    font-style: italic;
    font-weight: 400;
}

.jm-dossier-item:not(.has-thumb) .jm-dossier-link {
    padding-left: 2px;
}

/* ✅ PREMIER DOSSIER : Style spécial HERO */
.jm-dossiers-list li.jm-dossier-first {
    margin: 0 0 25px 0 !important;
    padding: 15px !important;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
    border-radius: 8px;
    position: relative;
}
.jm-dossier-first .jm-dossier-link {
    gap: 20px;
}

.jm-dossier-first .jm-dossier-image {
    width: 100%;
    height: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    flex-shrink: 0;
    background: var(--jm-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.jm-dossier-first .jm-dossier-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.jm-dossier-first .jm-dossier-link:hover .jm-dossier-image img {
    transform: scale(1.05);
}

.jm-dossier-first .jm-dossier-content {
    flex: 1;
    min-width: 0;
}

.jm-dossier-first .jm-dossier-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
    -webkit-line-clamp: 3;
    line-height: 1.4;
}

.jm-dossier-first .jm-dossier-author {
    font-size: 0.95em;
    color: #bf2828;
    font-weight: 500;
    font-style: italic;
}

/* Badge "À la une" pour le premier dossier */
.jm-dossier-first .jm-dossier-content::before {
    content: "À la une";
    display: inline-block;
    background: #bf2828;
    color: #fff;
    font-size: 0.7em;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
    margin-top: -35px;
}

/* Responsive mobile pour le premier dossier */
@media (max-width: 768px) {
    .jm-dossier-first .jm-dossier-image {
        width: 100px;
        height: 100px;
    }
    
    .jm-dossier-first .jm-dossier-title {
        font-size: 1em;
        -webkit-line-clamp: 2;
    }
    
    .jm-dossier-first .jm-dossier-link {
        gap: 15px;
    }
    
    .jm-dossier-first .jm-dossier-content::before {
        font-size: 0.65em;
        padding: 2px 8px;
    }
}

/* Titre du sommaire/dossier */
.jm-sommaire-title,
.jm-dossier-title {
    font-size: 0.9em;
    line-height: 1.2;
    display: block;
}

/* Auteur du sommaire/dossier */
.jm-sommaire-author{
    font-size: 0.9em;
    color: #bf2828;
    font-style: italic;
    font-weight: 400;
    display: block;
    border-bottom: 1px dotted #000;
}

.jm-dossier-author {
    font-size: 0.9em;
    color: #bf2828;
    font-style: italic;
    font-weight: 400;
    display: block;
    border-bottom: 1px solid #bf2828;
}

/* Contenu principal */
.jm-main-content {
    background: var(--jm-white);
    padding: 0;
}

.jm-entry-content {
    font-size: 1.05em;
    line-height: 1.8;
    color: var(--jm-text);
}

.jm-entry-content p {
    margin-bottom: 25px;
    text-align: justify;
}

.jm-entry-content ul li {
    text-align: justify;
}

/* === NOTES ET RÉFÉRENCES === */
.jm-references-section {
    border-top: 1px solid #9b9b9b;
    margin-top: 70px;
}
.jm-notes-references {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--jm-gray);
}

.jm-notes-references h3 {
    font-size: 1.5em;
    color: #666;
    margin: 0 0 25px 0;
    font-weight: 500;
}

.jm-references-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: reference-counter;
}

.jm-references-list li {
    counter-increment: reference-counter;
    padding: 0px 0 12px 40px;
    position: relative;
    font-size: 0.8em;
    color: #666;
    line-height: 1.5;
    border-bottom: 1px solid #d9d9d9;
    word-break: break-word;
    text-align: justify;
    margin-bottom: 5px;
}

.jm-references-list li::before {
    content: counter(reference-counter) ".";
    position: absolute;
    left: 0;
    top: 0px;
    color: #999;
    font-weight: 500;
    min-width: 30px;
}

.jm-references-list li:last-child {
    border-bottom: none;
}

.jm-references-list a {
    color: var(--jm-primary);
    text-decoration: none;
    word-break: break-all;
}

.jm-references-list a:hover {
    text-decoration: underline;
    color: var(--jm-primary-dark);
}

/* Responsive */
@media (max-width: 1024px) {
    .jm-content-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .jm-sidebar-left {
        position: relative;
        top: 0;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 25px;
    }
    
    .jm-journal-header h1 {
        font-size: 2.2em;
    }
}

@media (max-width: 768px) {
    .jm-single-container {
        padding: 20px 15px;
    }
    
    .jm-sidebar-left {
        grid-template-columns: 1fr;
    }
    
    .jm-journal-header h1 {
        font-size: 1.8em;
    }
    
    .jm-carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    .jm-sommaire-list a,
    .jm-dossiers-list a {
        -webkit-line-clamp: 2;
    }
    
    .jm-references-list li {
        padding-left: 35px;
        font-size: 0.85em;
    }

    /* Bouton désactivé (Stock épuisé) */
    .jm-btn-buy.jm-btn-disabled {
        background: #999 !important;
        color: #fff !important;
        cursor: not-allowed !important;
        transform: none !important;
        box-shadow: none !important;
        opacity: 0.7;
        border: none;
    }

    .jm-btn-buy.jm-btn-disabled:hover {
        background: #999 !important;
        color: #fff !important;
        transform: none !important;
    }

    /* Messages de stock */
    .jm-stock-message {
        font-size: 0.80em;
        margin-top: 12px;
        padding: 10px 12px;
        border-radius: 6px;
        text-align: center !important;
        font-weight: 600;
        line-height: 1.4;
    }

    /* Style pour l'alerte (stock bas) */
    .jm-stock-alerte {
        background: rgba(255, 243, 205, 0.95);
        color: #856404;
        border: 1px solid #ffeeba;
    }

    /* Style pour l'épuisement (stock à 0) */
    .jm-stock-epuise {
        background: rgba(248, 215, 218, 0.95);
        color: #721c24;
        border: 1px solid #f5c6cb;
    }
}
