/* ==========================================================================
   Styles Frontend - Ebook Showcase Pro
   Design moderne et attractif
   ========================================================================== */

:root {
    --esp-primary-color: #524085;
    --esp-secondary-color: #001413;
    --esp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --esp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --esp-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --esp-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Container Principal
   ========================================================================== */

.esp-showcase {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ==========================================================================
   Contrôles (Recherche & Filtres)
   ========================================================================== */

.esp-controls {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Barre de recherche */
.esp-search-box {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.esp-search-input {
    width: 100%;
    padding: 15px 55px 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 16px;
    transition: var(--esp-transition);
    background: #fff;
}

.esp-search-input:focus {
    outline: none;
    border-color: var(--esp-primary-color);
    box-shadow: 0 0 0 4px rgba(82, 64, 133, 0.1);
}

.esp-search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    border: none;
    background: var(--esp-primary-color);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--esp-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.esp-search-btn:hover {
    background: var(--esp-secondary-color);
    transform: translateY(-50%) scale(1.05);
}

/* Filtres */
.esp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.esp-filter-btn {
    padding: 12px 24px;
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--esp-transition);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--esp-secondary-color);
}

.esp-filter-btn i {
    font-size: 18px;
}

.esp-filter-btn:hover {
    border-color: var(--esp-primary-color);
    background: rgba(82, 64, 133, 0.05);
    transform: translateY(-2px);
}

.esp-filter-btn.active {
    background: var(--esp-primary-color);
    border-color: var(--esp-primary-color);
    color: #fff;
}

/* ==========================================================================
   Grille de produits
   ========================================================================== */

.esp-products-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
}

/* Nombre de colonnes dynamique */
.esp-products-grid[data-columns="2"] {
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
}

.esp-products-grid[data-columns="3"] {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.esp-products-grid[data-columns="4"] {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.esp-products-grid[data-columns="5"] {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.esp-products-grid[data-columns="6"] {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* ==========================================================================
   Carte produit
   ========================================================================== */

.esp-product-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--esp-shadow-sm);
    transition: var(--esp-transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.esp-product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--esp-shadow-lg);
}

/* Image produit */
.esp-product-image {
    position: relative;
    width: 100%;
    padding-top: 140%; /* Ratio 1:1.4 (format livre) */
    overflow: hidden;
    background: linear-gradient(135deg, rgba(82, 64, 133, 0.1) 0%, rgba(0, 20, 19, 0.1) 100%);
}

.esp-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--esp-transition);
}

.esp-product-card:hover .esp-product-image img {
    transform: scale(1.05);
}

/* Badge type de produit */
.esp-product-type-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--esp-primary-color);
    box-shadow: var(--esp-shadow-md);
}

.esp-product-type-badge i {
    font-size: 16px;
}

/* Contenu produit */
.esp-product-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.esp-product-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--esp-secondary-color);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.esp-product-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.esp-product-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--esp-primary-color);
    margin-bottom: 20px;
}

/* Actions */
.esp-product-actions {
    margin-top: auto;
}

.esp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--esp-transition);
    justify-content: center;
    width: 100%;
}

.esp-btn-primary {
    background: var(--esp-primary-color);
    color: #fff;
    border: 2px solid var(--esp-primary-color);
}

.esp-btn-primary:hover {
    background: var(--esp-secondary-color);
    border-color: var(--esp-secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--esp-shadow-md);
}

/* Vidéos associées */
.esp-product-videos {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.esp-product-videos h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--esp-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.esp-video-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.esp-video-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8f8f8;
    border-radius: 8px;
    text-decoration: none;
    color: var(--esp-secondary-color);
    font-size: 13px;
    transition: var(--esp-transition);
    border: 1px solid transparent;
}

.esp-video-link:hover {
    background: rgba(82, 64, 133, 0.05);
    border-color: var(--esp-primary-color);
    transform: translateX(4px);
}

.esp-video-icon {
    font-size: 18px;
}

.esp-video-title {
    flex: 1;
}

.esp-video-link i {
    font-size: 12px;
    color: var(--esp-primary-color);
}

/* ==========================================================================
   Bouton "Charger plus"
   ========================================================================== */

.esp-load-more-container {
    text-align: center;
    margin: 40px 0;
}

.esp-load-more-btn {
    padding: 16px 48px;
    background: #fff;
    color: var(--esp-primary-color);
    border: 2px solid var(--esp-primary-color);
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--esp-transition);
}

.esp-load-more-btn:hover {
    background: var(--esp-primary-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--esp-shadow-md);
}

.esp-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Message "Aucun résultat"
   ========================================================================== */

.esp-no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f8f8f8;
    border-radius: 16px;
    margin: 40px 0;
}

.esp-no-results p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

.esp-no-products {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.esp-product-card {
    animation: fadeIn 0.5s ease-out;
}

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

@media (max-width: 1200px) {
    .esp-products-grid[data-columns="5"],
    .esp-products-grid[data-columns="6"] {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 992px) {
    .esp-products-grid[data-columns="4"],
    .esp-products-grid[data-columns="5"],
    .esp-products-grid[data-columns="6"] {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .esp-showcase {
        padding: 30px 15px;
    }
    
    .esp-controls {
        gap: 15px;
    }
    
    .esp-search-box {
        max-width: 100%;
    }
    
    .esp-filters {
        gap: 8px;
    }
    
    .esp-filter-btn {
        padding: 10px 18px;
        font-size: 14px;
    }
    
    .esp-products-grid {
        gap: 20px;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    }
    
    .esp-product-title {
        font-size: 18px;
    }
    
    .esp-product-price {
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    .esp-showcase {
        padding: 20px 10px;
    }
    
    .esp-filter-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .esp-products-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .esp-product-content {
        padding: 20px;
    }
    
    .esp-product-title {
        font-size: 16px;
    }
    
    .esp-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
}

/* ==========================================================================
   États de chargement
   ========================================================================== */

.esp-loading {
    opacity: 0.6;
    pointer-events: none;
}

.esp-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(82, 64, 133, 0.2);
    border-top-color: var(--esp-primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Mode sombre (optionnel - à activer si besoin)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .esp-showcase {
        background: #1a1a1a;
    }
    
    .esp-product-card {
        background: #2a2a2a;
    }
    
    .esp-product-title {
        color: #fff;
    }
    
    .esp-product-description {
        color: #b0b0b0;
    }
    
    .esp-search-input {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .esp-filter-btn {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .esp-video-link {
        background: #333;
    }
}
