/**
 * Flavor Menu - Styles Front-end
 */

/* Variables */
.fm-container {
    --fm-color-text: #2c2c2c;
    --fm-color-text-light: #666666;
    --fm-color-text-muted: #999999;
    --fm-color-accent: #8b7355;
    --fm-color-border: #e5e5e5;
    --fm-color-bg: #ffffff;
    --fm-color-bg-light: #faf9f7;
    --fm-color-price: #8b7355;
    --fm-font-family: 'Georgia', 'Times New Roman', serif;
    --fm-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --fm-spacing-sm: 0.5rem;
    --fm-spacing-md: 1rem;
    --fm-spacing-lg: 1.5rem;
    --fm-spacing-xl: 2rem;
    --fm-nav-width: 280px;
}

/* Container principal */
.fm-container {
    display: flex;
    gap: var(--fm-spacing-xl);
    max-width: 1100px;
    margin: 0 auto;
    font-family: var(--fm-font-family);
    color: var(--fm-color-text);
    line-height: 1.6;
}

.fm-container *,
.fm-container *::before,
.fm-container *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Navigation (gauche)
   ========================================================================== */

.fm-nav {
    flex: 0 0 var(--fm-nav-width);
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

.fm-nav-section {
    margin-bottom: var(--fm-spacing-xl);
}

.fm-nav-title {
    font-family: var(--fm-font-family);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #8b7355;
    margin: 0 0 var(--fm-spacing-md);
    padding-bottom: var(--fm-spacing-sm);
    border-bottom: 1px solid rgba(139, 115, 85, 0.4);
}

.fm-nav-list {
    list-style: none;
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.fm-nav-list li::marker {
    display: none;
}

.fm-nav-item {
    margin-bottom: 2px;
    list-style: none;
}

.fm-nav-link {
    display: block;
    width: 100%;
    padding: var(--fm-spacing-sm) var(--fm-spacing-md);
    font-family: var(--fm-font-family);
    font-size: 1rem;
    font-weight: 400;
    color: #a99a8a;
    text-align: left;
    text-decoration: none;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fm-nav-link:hover {
    color: #d4c4b0;
    background: rgba(139, 115, 85, 0.1);
    border-left-color: #8b7355;
}

.fm-nav-link.is-active {
    color: #d4c4b0;
    font-weight: 600;
    background: rgba(139, 115, 85, 0.15);
    border-left-color: #8b7355;
}

.fm-nav-link:focus {
    outline: none;
}

/* ==========================================================================
   Contenu (droite)
   ========================================================================== */

.fm-content {
    flex: 1;
    min-width: 0;
    padding: 10%;
    transition: opacity 0.2s ease;
    background-color: #ffffff;
}

.fm-content.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Detail menu/categorie */
.fm-menu-detail,
.fm-category-detail {
    animation: fm-fade-in 0.3s ease;
}

@keyframes fm-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fm-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--fm-spacing-md);
    margin-bottom: var(--fm-spacing-lg);
    padding-bottom: var(--fm-spacing-md);
    border-bottom: 2px solid var(--fm-color-accent);
}

.fm-detail-title {
    font-family: var(--fm-font-family);
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--fm-color-text);
    margin: 0;
    letter-spacing: 0.02em;
}

.fm-detail-price {
    font-family: var(--fm-font-sans);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--fm-color-price);
    white-space: nowrap;
}

.fm-detail-description {
    font-size: 1rem;
    line-height: 1.8;
    color: #2c2c2c;
    text-align: center;
}

.fm-detail-description p {
    margin: 0 0 var(--fm-spacing-md);
}

.fm-detail-description p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Sections (sous-titres dans une categorie)
   ========================================================================== */

.fm-section {
    margin-bottom: var(--fm-spacing-xl);
}

.fm-section:last-child {
    margin-bottom: 0;
}

.fm-section-title {
    font-family: var(--fm-font-family);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #5a9a6e;
    margin: 0 0 var(--fm-spacing-md);
    padding-bottom: var(--fm-spacing-sm);
}

.fm-section--no-title {
    margin-top: var(--fm-spacing-lg);
}

/* ==========================================================================
   Liste produits
   ========================================================================== */

.fm-products-list {
    list-style: none;
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.fm-products-list li {
    list-style: none;
}

.fm-products-list li::marker {
    display: none;
}

.fm-product-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0;
    padding: var(--fm-spacing-md) 0;
    border-bottom: 1px solid var(--fm-color-border);
}

.fm-product-item:last-child {
    border-bottom: none;
}

.fm-product-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--fm-color-text);
}

.fm-product-subtitle {
    flex-basis: 100%;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--fm-color-text-muted);
    margin-top: 2px;
    order: 3;
}

.fm-product-price {
    flex-shrink: 0;
    font-family: var(--fm-font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--fm-color-price);
    order: 2;
}

/* Points de suite entre titre et prix */
.fm-product-item::before {
    content: '';
    flex: 1;
    border-bottom: 1px dotted var(--fm-color-border);
    margin: 0 var(--fm-spacing-sm);
    min-width: 30px;
    order: 1;
    align-self: baseline;
    position: relative;
    top: -0.35em;
}

.fm-product-title {
    order: 0;
}

/* Message vide */
.fm-empty {
    text-align: center;
    padding: var(--fm-spacing-xl);
    color: var(--fm-color-text-muted);
    font-style: italic;
}

/* ==========================================================================
   Fichiers (images et PDF)
   ========================================================================== */

/* Supprimer le padding quand un fichier est affiche */
.fm-content:has(.fm-file-detail) {
    padding: 0;
}

.fm-file-detail {
    animation: fm-fade-in 0.3s ease;
}

.fm-file-image {
    line-height: 0;
}

.fm-file-image img {
    width: 100%;
    height: auto;
    display: block;
}

.fm-file-pdf {
    height: 100%;
    overflow: hidden;
    background: #ffffff;
}

.fm-file-pdf iframe {
    width: 100%;
    height: 100vh;
    border: none;
    display: block;
    overflow: hidden;
    background: #ffffff;
}

/* ==========================================================================
   Loader
   ========================================================================== */

.fm-loader {
    display: flex;
    justify-content: center;
    padding: var(--fm-spacing-xl);
}

.fm-loader::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 2px solid var(--fm-color-border);
    border-top-color: var(--fm-color-accent);
    border-radius: 50%;
    animation: fm-spin 0.8s linear infinite;
}

@keyframes fm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .fm-container {
        flex-direction: column;
        gap: var(--fm-spacing-lg);
    }

    .fm-nav {
        flex: none;
        position: static;
        width: 100%;
        padding-bottom: var(--fm-spacing-md);
        border-bottom: 1px solid var(--fm-color-border);
    }

    .fm-nav-section {
        margin-bottom: var(--fm-spacing-md);
    }

    .fm-nav-list {
        display: flex;
        flex-wrap: wrap;
        gap: var(--fm-spacing-sm);
    }

    .fm-nav-item {
        margin-bottom: 0;
    }

    .fm-nav-link {
        padding: var(--fm-spacing-sm) var(--fm-spacing-md);
        border: 1px solid var(--fm-color-border);
        border-left-width: 1px;
        border-radius: 20px;
        font-size: 0.9rem;
    }

    .fm-nav-link:hover,
    .fm-nav-link.is-active {
        border-color: var(--fm-color-accent);
        border-left-width: 1px;
    }

    .fm-detail-header {
        flex-direction: column;
        gap: var(--fm-spacing-sm);
    }

    .fm-detail-title {
        font-size: 1.4rem;
    }

    .fm-product-item {
        flex-wrap: wrap;
    }

    .fm-product-item::before {
        display: none;
    }

    .fm-product-info {
        flex: 1 1 100%;
    }

    .fm-product-price {
        margin-top: var(--fm-spacing-sm);
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .fm-container {
        display: block;
    }

    .fm-nav {
        display: none;
    }

    .fm-product-item {
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Accessibilite
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .fm-menu-detail,
    .fm-category-detail {
        animation: none;
    }

    .fm-content {
        transition: none;
    }

    .fm-loader::after {
        animation: none;
    }
}
