/**
 * Read More Toggle Styles
 * Styles pour l'affichage des extraits avec bouton "Lire la suite"
 */

/* Container principal */
.readmore-container {
    position: relative;
    margin: 1em 0;
}

/* Contenu unique (comme Meilleur du Chef) */
.readmore-content {
    position: relative;
    line-height: 1.6;
    max-height: 150px; /* Hauteur fixe pour l'extrait */
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

/* Overlay dégradé pour masquer le texte en bas */
.readmore-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, white);
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1;
}

/* Support pour les fonds sombres */
.readmore-container.dark-theme .readmore-content::after {
    background: linear-gradient(transparent, #1a1a1a);
}

/* Support pour les fonds colorés */
.readmore-container[data-bg-color] .readmore-content::after {
    background: linear-gradient(transparent, var(--readmore-bg-color, white));
}

/* État étendu - tout le contenu visible */
.readmore-container.readmore-expanded .readmore-content {
    max-height: none; /* Afficher tout le contenu */
    transition: max-height 0.5s ease-in;
}

.readmore-container.readmore-expanded .readmore-content::after {
    opacity: 0; /* Masquer l'overlay */
    transition: opacity 0.2s ease;
}

/* Container du bouton */
.readmore-toggle {
    margin-top: 1em;
    text-align: center;
}

/* Bouton "Lire la suite/moins" */
.readmore-button {
    display: inline-block;
    padding: 8px 16px;
    background: #345d55;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.readmore-button:hover {
    background: #213f39;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.readmore-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

.readmore-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* État étendu */
.readmore-container.readmore-expanded .readmore-toggle {
    margin-top: 1.5em;
}

.readmore-container.readmore-expanded .readmore-button {
    background: #666;
}

.readmore-container.readmore-expanded .readmore-button:hover {
    background: #555;
}

/* Animation pour le contenu */
.readmore-full {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Variantes de style */
.readmore-container.style-minimal .readmore-button {
    background: transparent;
    color: #0073aa;
    border: 1px solid #0073aa;
    padding: 6px 12px;
}

.readmore-container.style-minimal .readmore-button:hover {
    background: #0073aa;
    color: white;
}

.readmore-container.style-minimal.readmore-expanded .readmore-button {
    color: #666;
    border-color: #666;
}

.readmore-container.style-minimal.readmore-expanded .readmore-button:hover {
    background: #666;
    color: white;
}

.readmore-container.style-link .readmore-button {
    background: transparent;
    color: #0073aa;
    border: none;
    padding: 4px 0;
    text-decoration: underline;
    box-shadow: none;
    font-size: inherit;
}

.readmore-container.style-link .readmore-button:hover {
    background: transparent;
    color: #005a87;
    text-decoration: none;
    transform: none;
}

/* Style inspiré de Meilleur du Chef */
.readmore-container.style-chef .readmore-button {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 0;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.readmore-container.style-chef .readmore-button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: none;
}

.readmore-container.style-chef.readmore-expanded .readmore-button {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    .readmore-button {
        padding: 10px 20px;
        font-size: 16px; /* Meilleur pour le tactile */
    }
    
    .readmore-toggle {
        margin-top: 1.5em;
    }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    .readmore-button {
        transition: none;
    }
    
    .readmore-full {
        animation: none;
    }
    
    .readmore-button:hover {
        transform: none;
    }
}

/* Mode sombre (si supporté) */
@media (prefers-color-scheme: dark) {
    .readmore-container.style-minimal .readmore-button {
        color: #4a9eff;
        border-color: #4a9eff;
    }
    
    .readmore-container.style-minimal .readmore-button:hover {
        background: #4a9eff;
        color: #1a1a1a;
    }
    
    .readmore-container.style-chef .readmore-button {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .readmore-container.style-chef .readmore-button:hover {
        background: #4a5568;
        border-color: #718096;
    }
}

/* États de chargement */
.readmore-container.loading .readmore-button {
    opacity: 0.6;
    cursor: not-allowed;
}

.readmore-container.loading .readmore-button::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utilitaires */
.readmore-hidden {
    display: none !important;
}

.readmore-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.readmore-fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}
