/* ============================================================
   Moussa Empire - Feuille de style principale
   Les couleurs sont en variables CSS : à remplacer dès réception
   du logo/charte graphique définitive.
   ============================================================ */

:root {
    --primary: #111111;        /* noir profond - identité Moussa Empire */
    --primary-light: #2A2A2A;
    --accent: #A9772F;         /* doré - identité Moussa Empire */
    --accent-light: #C99A4F;
    --text-dark: #111111;
    --text-muted: #6B7280;
    --bg-light: #F8F9FC;
    --white: #FFFFFF;
    --border: #E5E7EB;
    --success: #16A34A;
    --danger: #DC2626;

    --radius: 10px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.10);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    color: var(--text-dark);
    background: var(--bg-light);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ---------------- Header ---------------- */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

.logo img {
    height: 36px;
    width: auto;
}

.main-nav {
    display: flex;
    gap: 28px;
}

.main-nav a {
    font-weight: 500;
    color: var(--text-dark);
    transition: color 0.15s ease;
}

.main-nav a:hover {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    padding: 8px 24px 16px;
    border-top: 1px solid var(--border);
    background: var(--white);
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu a {
    padding: 12px 0;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.mobile-menu a:last-child {
    border-bottom: none;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--accent-light);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ---------------- Hero ---------------- */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 24px 32px;
}

.hero h1 {
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
    white-space: nowrap;
    margin-bottom: 12px;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ---------------- Filtres catégories ---------------- */
.category-filters {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--white);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-pill:hover {
    border-color: var(--primary);
}

.filter-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* ---------------- Grille produits ---------------- */
.product-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 60px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.product-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--bg-light);
    overflow: hidden;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-discount {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
}

.badge-category {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.product-rating {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.product-price {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.price-old {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.price-current {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
}

/* ---------------- Footer ---------------- */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 48px 24px 24px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
}

.footer-inner h4 {
    font-size: 0.95rem;
    margin-bottom: 14px;
}

.footer-inner ul {
    list-style: none;
}

.footer-inner li {
    margin-bottom: 8px;
}

.footer-inner a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-inner a:hover {
    color: var(--primary);
}

.footer-bottom {
    max-width: 1200px;
    margin: 32px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.embed-youtube-description {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    margin: 16px 0;
}

.embed-youtube-description iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------------- Barre d'achat flottante ---------------- */
.floating-buy-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    z-index: 300;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.floating-buy-bar.visible {
    transform: translateY(0);
}

.floating-buy-price {
    color: var(--white);
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.floating-buy-price strong {
    font-size: 1.2rem;
    color: var(--accent-light);
}

.floating-buy-bar .btn {
    flex-shrink: 0;
    padding: 12px 22px;
}

@media (max-width: 500px) {
    .floating-buy-bar {
        padding: 12px 16px;
    }
    .floating-buy-price strong {
        font-size: 1rem;
    }
}

/* ---------------- Animations d'attention (fiche produit) ---------------- */
.stock-progress-track {
    background: var(--border);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 18px;
    position: relative;
}

.stock-progress-fill {
    background: var(--accent);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stock-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: shimmerProgress 1.8s infinite;
}

@keyframes shimmerProgress {
    100% { left: 100%; }
}

.btn-buy-pulse {
    animation: pulseBuyButton 2.2s infinite;
}

@keyframes pulseBuyButton {
    0%, 100% { box-shadow: 0 0 0 0 rgba(169, 119, 47, 0.45); }
    50% { box-shadow: 0 0 0 12px rgba(169, 119, 47, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .stock-progress-fill::after,
    .btn-buy-pulse {
        animation: none;
    }
}

/* ---------------- Avis : bandeau défilant (haut de fiche) ---------------- */
.avis-scroll-wrapper {
    overflow: hidden;
    min-width: 0;
    margin-bottom: 24px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.avis-scroll-track {
    display: flex;
    gap: 14px;
    width: max-content;
    animation: avisScrollLoop 30s linear infinite;
}

.avis-scroll-wrapper:hover .avis-scroll-track {
    animation-play-state: paused;
}

@keyframes avisScrollLoop {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.avis-mini-card {
    flex-shrink: 0;
    width: 240px;
    height: 118px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.avis-mini-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.avis-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.avis-mini-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.avis-mini-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

@media (prefers-reduced-motion: reduce) {
    .avis-scroll-track {
        animation: none;
        overflow-x: auto;
    }
}

/* ---------------- Avis : grille complète ---------------- */
.avis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.avis-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.avis-card-comment {
    font-size: 0.9rem;
    color: var(--text-dark);
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.avis-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.avis-card-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 600px) {
    .avis-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------------- Panneau de checkout glissant ---------------- */
.checkout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.checkout-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.checkout-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 480px;
    max-width: 100vw;
    background: var(--white);
    z-index: 401;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.checkout-panel.open {
    transform: translateX(0);
}

.checkout-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.checkout-panel-header h2 {
    font-size: 1.1rem;
}

.checkout-panel-close {
    background: var(--bg-light);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-dark);
}

.checkout-panel-aide {
    font-size: 0.85rem;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    text-decoration: none;
}

.checkout-panel-body {
    padding: 24px 28px 32px;
}

.checkout-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 28px 0 14px;
}

.checkout-section-title:first-child {
    margin-top: 0;
}

.checkout-field {
    margin-bottom: 16px;
}

.checkout-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.checkout-field input[type="text"],
.checkout-field input[type="email"],
.checkout-field input[type="tel"],
.checkout-field select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
    color: var(--text-dark);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.checkout-field input:focus,
.checkout-field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(169, 119, 47, 0.12);
}

.checkout-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.checkout-phone-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 10px;
}

.checkout-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.checkout-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 10px;
    transition: border-color 0.15s ease;
}

.checkout-option-row:hover {
    border-color: var(--accent-light);
}

.checkout-option-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.checkout-sub-field {
    margin: -4px 0 10px;
    padding: 0 4px;
}

.checkout-resume-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--bg-light);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 24px;
    user-select: none;
}

.checkout-resume-toggle .chevron {
    display: inline-block;
    transition: transform 0.2s ease;
    margin-left: 4px;
    font-size: 0.75rem;
}

.checkout-resume-toggle.open .chevron {
    transform: rotate(180deg);
}

.checkout-resume-detail {
    display: none;
    padding: 16px 18px;
    border: 1.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    margin-top: -8px;
    font-size: 0.88rem;
}

.checkout-resume-detail.open {
    display: block;
}

.checkout-submit-btn {
    width: 100%;
    margin-top: 24px;
    padding: 16px;
    font-size: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(169, 119, 47, 0.28);
}

.checkout-terms {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 16px;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .checkout-panel {
        width: 100vw;
    }
}

.admin-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.admin-stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    text-align: center;
}

.admin-stat-card .valeur {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.admin-stat-card .label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ---------------- Navigation mobile basse (espace "Mes formations") ---------------- */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 1px solid var(--border);
        padding: 8px 0 max(8px, env(safe-area-inset-bottom));
        z-index: 200;
    }
    .mobile-bottom-nav a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-size: 0.68rem;
        color: var(--text-muted);
        font-weight: 500;
    }
    .mobile-bottom-nav a.active {
        color: var(--accent);
    }
    .mobile-bottom-nav a span.icone {
        font-size: 1.2rem;
    }
    .has-bottom-nav {
        padding-bottom: 70px;
    }
}

/* ---------------- Espace formation : aperçu / chapitres / lecteur ---------------- */
.formation-progress-track {
    background: rgba(255,255,255,0.4);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    margin: 12px 0 8px;
}
.formation-progress-fill {
    background: #111;
    height: 100%;
}
.formation-chapitre-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.formation-chapitre-row.termine {
    background: var(--bg-light);
}
.product-layout {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px;
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    grid-template-areas: "intro buy" "content buy";
    gap: 32px;
    align-items: start;
}

.product-intro {
    grid-area: intro;
    min-width: 0;
}
.product-content {
    grid-area: content;
    min-width: 0;
}

.product-buybox {
    grid-area: buy;
    position: sticky;
    top: 90px;
    padding: 18px;
}

.product-title-main {
    font-size: 1.8rem;
    margin-bottom: 16px;
    line-height: 1.3;
}

.product-main-image {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 24px;
    aspect-ratio: 702 / 260;
    object-fit: cover;
}

@media (max-width: 900px) {
    .product-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "intro" "buy" "content";
        gap: 24px;
        padding: 24px 20px;
    }
    .product-buybox {
        position: static;
    }
    .product-title-main {
        font-size: 1.4rem;
    }
}
@media (max-width: 768px) {
    .main-nav {
        display: none;
    }
    .header-actions {
        display: none;
    }
    .hamburger-btn {
        display: flex;
    }
    .footer-inner {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 1.5rem;
        white-space: normal;
    }
    .hero p {
        font-size: 0.95rem;
    }
    .category-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }
    .filter-pill {
        flex-shrink: 0;
        white-space: nowrap;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .product-info {
        padding: 10px;
    }
    .product-title {
        font-size: 0.85rem;
    }
    .price-current {
        font-size: 0.95rem;
    }
}