/**
 * ChronoLoc Catalog - Styles hiérarchiques améliorés
 * Version 2.3.2 - CORRIGÉ
 */

/* ========================================
   STRUCTURE PRINCIPALE
   ======================================== */

.cloc-catalog-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
}

/* ========================================
   BARRE DE RECHERCHE ET FILTRES
   ======================================== */

.cloc-search-bar {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.cloc-search-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.cloc-search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.cloc-search-input:focus {
    outline: none;
    border-color: #1e3c72;
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

.cloc-search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #666;
}

/* ========================================
   FILTRE ALPHABÉTIQUE
   ======================================== */

.cloc-alphabet-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 15px;
}

.cloc-alphabet-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cloc-alphabet-btn:hover {
    background: #f3f4f6;
    border-color: #1e3c72;
    color: #1e3c72;
}

.cloc-alphabet-btn.active {
    background: #1e3c72;
    border-color: #1e3c72;
    color: white;
}

/* ========================================
   SECTION CATÉGORIE PRINCIPALE
   ======================================== */

.cloc-category-section {
    margin-bottom: 50px;
    background: white;
    border-radius: 12px;
    overflow: visible; /* IMPORTANT : pour les badges */
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cloc-category-header {
    padding: 7px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    position: relative;
    border-radius: 12px 12px 0 0;
}

.cloc-category-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    flex-grow: 1;
}

.cloc-category-header .product-count {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* ========================================
   SOUS-CATÉGORIES
   ======================================== */

.cloc-subcategories-wrapper {
    padding: 0;
}

.cloc-subcategory-section {
    border-top: 1px solid #e5e7eb;
}

.cloc-subcategory-section:first-child {
    border-top: none;
}

.cloc-subcategory-header {
    padding: 20px 30px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #1e3c72;
}

.cloc-subcategory-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e3c72;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cloc-subcategory-title .product-count {
    font-size: 14px;
    font-weight: 400;
    color: #666;
    background: #e5e7eb;
    padding: 4px 12px;
    border-radius: 20px;
}

/* ========================================
   GRILLE DE PRODUITS
   ======================================== */

.cloc-products-grid {
    display: grid;
    gap: 20px;
    padding: 30px;
}

/* Layout Grid */
.cloc-layout-grid.cloc-columns-3 {
    /*grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));*/
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* ========================================
   CARTE PRODUIT - STRUCTURE
   ======================================== */

.cloc-product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden; /* CHANGÉ : overflow hidden sur la carte */
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.cloc-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #1e3c72;
}

/* ========================================
   BADGES DE STATUT
   ======================================== */

.cloc-product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    white-space: nowrap;
    line-height: 1.2;
}

/* Badge "Livraison obligatoire" */
.cloc-product-badge.warning {
    background: #ff9800;
    color: white;
}

/* Badge "En cours de livraison" (réappro) */
.cloc-product-badge.info {
    background: #2196F3;
    color: white;
}

/* Badge "Victime de son succès" (chantier) */
.cloc-product-badge.success {
    background: #4CAF50;
    color: white;
}

/* Badge "Rupture de stock" */
.cloc-product-badge.danger {
    background: #f44336;
    color: white;
}

/* Si plusieurs badges, les empiler */
.cloc-product-card .cloc-product-badge:nth-of-type(2) {
    top: 40px;
}

/* ========================================
   IMAGE PRODUIT AVEC WRAPPER
   ======================================== */

.cloc-product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%; /* Ratio 4:3 */
    overflow: hidden;
}

/* Nouveau bouton aperçu rapide - Positionné sur l'image */
.cloc-product-image-wrapper .cloc-quick-view {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    color: #1e3c72;
    border: 2px solid #1e3c72;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 10;
    /* Empêcher le bouton de grandir */
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cloc-product-image-wrapper > a,
.cloc-product-image-wrapper > span {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cloc-product-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
    padding: 10px;
}

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

/* ========================================
   OVERLAYS POUR PRODUITS NON DISPONIBLES
   ======================================== */

/* Overlay pour produits en réappro (bleu) */
.cloc-image-overlay-reappro {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cloc-image-overlay-reappro::after {
    content: "🚚";
    font-size: 2em;
    opacity: 0.8;
	margin-top: 55px;
}

/* Overlay pour produits en chantier (vert) */
.cloc-image-overlay-chantier {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cloc-image-overlay-chantier::after {
    content: "🏗️";
    font-size: 2em;
    opacity: 0.8;
	margin-top: 55px;
}

/* ========================================
   CONTENU PRODUIT
   ======================================== */

.cloc-product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.cloc-product-meta {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.cloc-product-title {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    min-height: 40px;
}

.cloc-product-title a,
.cloc-product-title span {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cloc-product-title a:hover {
    color: #1e3c72;
}

.cloc-product-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 10px;
}

/* ========================================
   PRIX AVEC ASSURANCE
   ======================================== */

.cloc-product-price {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: #1e3c72;
}

.cloc-product-price .woocommerce-Price-amount {
    color: #1e3c72;
}

.cloc-price-with-insurance {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.insurance-included-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 3px 6px;
    background: #e8f5e9;
    border: 1px solid #4CAF50;
    border-radius: 3px;
    font-size: 0.7em;
    color: #2e7d32;
    font-weight: 600;
    line-height: 1.2;
}

/* ========================================
   BOUTONS D'ACTION
   ======================================== */

.cloc-product-actions {
    margin-top: auto;
    padding-top: 10px;
}

.cloc-btn {
    display: block;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    line-height: 1.2;
}

.cloc-btn-primary {
    background: #1e3c72;
    color: white;
}

.cloc-btn-primary:hover {
    background: #152a52;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.3);
}

/* Bouton "Bientôt disponible" (réappro) */
.cloc-btn-info {
    background: #2196F3;
    color: white;
    cursor: default;
    opacity: 0.85;
}

.cloc-btn-info:hover {
    transform: none;
    box-shadow: none;
}

/* Bouton "Victime de son succès" (chantier) */
.cloc-btn-success {
    background: #4CAF50;
    color: white;
    cursor: default;
    opacity: 0.85;
}

.cloc-btn-success:hover {
    transform: none;
    box-shadow: none;
}

/* Bouton désactivé (rupture de stock) */
.cloc-btn-disabled {
    background: #9e9e9e;
    color: white;
    cursor: not-allowed;
    opacity: 0.7;
}

.cloc-btn-disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ============================================
   MODE COMPACT - AFFICHAGE EN LIGNE
   Pour catégories/sous-catégories < 3 produits
   ============================================ */

/* Catégorie ou sous-catégorie en mode compact */
.cloc-category-section.compact-mode .cloc-products-grid,
.cloc-subcategory-section.compact-mode .cloc-products-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px 30px;
}

/* Product Card Horizontale en mode compact */
.cloc-category-section.compact-mode .cloc-product-card,
.cloc-subcategory-section.compact-mode .cloc-product-card {
    display: grid;
    grid-template-columns: 180px 1fr auto;
    grid-template-rows: 1fr;
    gap: 0;
    height: auto;
    min-height: 140px;
    align-items: stretch;
}

/* Image wrapper en mode compact */
.cloc-category-section.compact-mode .cloc-product-image-wrapper,
.cloc-subcategory-section.compact-mode .cloc-product-image-wrapper {
    width: 180px;
    height: 140px;
    padding-top: 0;
    flex-shrink: 0;
}

/* Image produit en mode compact */
.cloc-category-section.compact-mode .cloc-product-image,
.cloc-subcategory-section.compact-mode .cloc-product-image {
    position: static;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Info produit en mode compact */
.cloc-category-section.compact-mode .cloc-product-info,
.cloc-subcategory-section.compact-mode .cloc-product-info {
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

/* Titre en mode compact */
.cloc-category-section.compact-mode .cloc-product-title,
.cloc-subcategory-section.compact-mode .cloc-product-title {
    font-size: 18px;
    margin-bottom: 5px;
}

/* Meta en mode compact */
.cloc-category-section.compact-mode .cloc-product-meta,
.cloc-subcategory-section.compact-mode .cloc-product-meta {
    margin-bottom: 5px;
}

/* Prix en mode compact */
.cloc-category-section.compact-mode .cloc-product-price,
.cloc-subcategory-section.compact-mode .cloc-product-price {
    font-size: 20px;
    margin-top: 10px;
}

/* Excerpt en mode compact */
.cloc-category-section.compact-mode .cloc-product-excerpt,
.cloc-subcategory-section.compact-mode .cloc-product-excerpt {
    display: none; /* Masquer la description courte en mode compact */
}

/* Actions (boutons) en mode compact */
.cloc-category-section.compact-mode .cloc-product-actions,
.cloc-subcategory-section.compact-mode .cloc-product-actions {
    width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-left: 1px solid #e5e7eb;
}

.cloc-category-section.compact-mode .cloc-product-actions .cloc-btn,
.cloc-subcategory-section.compact-mode .cloc-product-actions .cloc-btn {
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

/* Badges positionnement en mode compact */
.cloc-category-section.compact-mode .cloc-product-badge,
.cloc-subcategory-section.compact-mode .cloc-product-badge {
    top: 10px;
    left: 10px;
    right: auto;
}

.cloc-category-section.compact-mode .cloc-product-badge:nth-of-type(2),
.cloc-subcategory-section.compact-mode .cloc-product-badge:nth-of-type(2) {
    top: 45px;
    left: 10px;
}

/* Overlays en mode compact */
.cloc-category-section.compact-mode .cloc-image-overlay-reappro,
.cloc-category-section.compact-mode .cloc-image-overlay-chantier,
.cloc-subcategory-section.compact-mode .cloc-image-overlay-reappro,
.cloc-subcategory-section.compact-mode .cloc-image-overlay-chantier {
    position: absolute;
    width: 180px;
    height: 140px;
}

/* ============================================
   RESPONSIVE - MODE COMPACT
   ============================================ */

/* Tablette - passage en layout vertical */
@media (max-width: 992px) {

}



/* ========================================
   MESSAGES D'ÉTAT
   ======================================== */

.cloc-no-products {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    color: #666;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cloc-no-products a {
    color: #1e3c72;
    font-weight: 600;
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

.cloc-product-card {
    animation: fadeIn 0.4s ease forwards;
}

/* Délai progressif pour l'animation */
.cloc-product-card:nth-child(1) { animation-delay: 0.05s; }
.cloc-product-card:nth-child(2) { animation-delay: 0.1s; }
.cloc-product-card:nth-child(3) { animation-delay: 0.15s; }
.cloc-product-card:nth-child(4) { animation-delay: 0.2s; }
.cloc-product-card:nth-child(5) { animation-delay: 0.25s; }
.cloc-product-card:nth-child(6) { animation-delay: 0.3s; }

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .cloc-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .cloc-category-header h2 {
        font-size: 20px;
    }
    
    .cloc-subcategory-title {
        font-size: 18px;
    }
	
	/*MODE COMPACT*/
	 .cloc-category-section.compact-mode .cloc-product-card,
    .cloc-subcategory-section.compact-mode .cloc-product-card {
        grid-template-columns: 150px 1fr auto;
    }
    
    .cloc-category-section.compact-mode .cloc-product-image-wrapper,
    .cloc-subcategory-section.compact-mode .cloc-product-image-wrapper {
        width: 150px;
        height: 120px;
    }
    
    .cloc-category-section.compact-mode .cloc-image-overlay-reappro,
    .cloc-category-section.compact-mode .cloc-image-overlay-chantier,
    .cloc-subcategory-section.compact-mode .cloc-image-overlay-reappro,
    .cloc-subcategory-section.compact-mode .cloc-image-overlay-chantier {
        width: 150px;
        height: 120px;
    }
    
    .cloc-category-section.compact-mode .cloc-product-actions,
    .cloc-subcategory-section.compact-mode .cloc-product-actions {
        width: 150px;
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .cloc-catalog-wrapper {
        padding: 15px;
    }
    .cloc-product-image-wrapper {
		padding-top:35%;
	}
    .cloc-search-bar {
        padding: 20px;
    }
    .cloc-product-title {
		min-height: 0px;
	}
    .cloc-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
        padding: 20px;
    }
    
    .cloc-category-header {
        padding: 15px 20px;
    }
    
    .cloc-category-header h2 {
        font-size: 18px;
    }
    
    .cloc-subcategory-header {
        padding: 15px 20px;
    }
    
    .cloc-subcategory-title {
        font-size: 16px;
    }
    
    .cloc-alphabet-filter {
        gap: 5px;
    }
    
    .cloc-alphabet-btn {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .cloc-product-badge {
        font-size: 9px;
        padding: 4px 7px;
    }
	
	/*MODE COMPACT*/
	    .cloc-category-section.compact-mode .cloc-product-card,
    .cloc-subcategory-section.compact-mode .cloc-product-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .cloc-category-section.compact-mode .cloc-product-image-wrapper,
    .cloc-subcategory-section.compact-mode .cloc-product-image-wrapper {
        width: 100%;
        height: 200px;
        padding-top: 0;
    }
    
    .cloc-category-section.compact-mode .cloc-image-overlay-reappro,
    .cloc-category-section.compact-mode .cloc-image-overlay-chantier,
    .cloc-subcategory-section.compact-mode .cloc-image-overlay-reappro,
    .cloc-subcategory-section.compact-mode .cloc-image-overlay-chantier {
        width: 100%;
        height: 200px;
    }
    
    .cloc-category-section.compact-mode .cloc-product-actions,
    .cloc-subcategory-section.compact-mode .cloc-product-actions {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e5e7eb;
        padding: 15px 20px;
    }
    
    .cloc-category-section.compact-mode .cloc-product-badge,
    .cloc-subcategory-section.compact-mode .cloc-product-badge {
        top: 10px;
        right: 10px;
        left: auto;
    }
    
    .cloc-category-section.compact-mode .cloc-product-badge:nth-of-type(2),
    .cloc-subcategory-section.compact-mode .cloc-product-badge:nth-of-type(2) {
        top: 45px;
        right: 10px;
        left: auto;
    }
}

@media (max-width: 480px) {
    .cloc-products-grid {
        grid-template-columns: 1fr;
    }
    
    .cloc-category-header h2 {
        font-size: 16px;
    }
    
    .cloc-product-info {
        padding: 12px;
    }
    
    .cloc-product-title {
        font-size: 14px;
        min-height: auto;
    }
    
    .cloc-image-overlay-reappro::after,
    .cloc-image-overlay-chantier::after {
        font-size: 2em;
    }
}