/**
 * Styles élégants pour la page des catégories
 * Couleurs personnalisées : #164C2A, #1e5d33, #ffffff
 */

/* Variables CSS pour les couleurs personnalisées */
:root {
    --primary-color: #164C2A;
    --secondary-color: #1e5d33;
    --white-color: #ffffff;
    --light-green: rgba(22, 76, 42, 0.1);
    --medium-green: rgba(22, 76, 42, 0.2);
    --dark-green: rgba(22, 76, 42, 0.8);
    --text-dark: #2d3748;
    --text-light: #718096;
    --shadow-light: rgba(22, 76, 42, 0.1);
    --shadow-medium: rgba(22, 76, 42, 0.2);
    --shadow-dark: rgba(22, 76, 42, 0.3);
}

/* Reset et base */
* {
    box-sizing: border-box;
}

/* Container principal */
#primary.content-area {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.site-main {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    padding: 4rem 0;
    position: relative;
}

.site-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.03)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.04)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

/* En-tête */
.entry-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 2;
}

.entry-title {
    color: var(--white-color);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin: 0;
    text-shadow: 0 4px 8px var(--shadow-dark);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.entry-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--white-color);
    margin: 1.5rem auto 0;
    border-radius: 2px;
    opacity: 0.8;
}

/* Contenu principal */
.entry-content {
    background: var(--white-color);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: clamp(2rem, 4vw, 4rem);
    box-shadow: 
        0 25px 50px var(--shadow-medium),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    margin: 0 auto;
    max-width: 1200px;
    position: relative;
    z-index: 2;
}

.categories-separator {
    margin: 3rem 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    border-radius: 1px;
}

/* Grille des catégories */
.categories-listing {
    margin-top: 2rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Cartes de catégories */
.category-item {
    background: var(--white-color);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 
        0 10px 30px var(--shadow-light),
        0 0 0 1px var(--light-green);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.category-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.4s ease;
    border-radius: 0 0 3px 3px;
}

.category-item:hover::before {
    transform: scaleX(1);
}

.category-item:hover {
    transform: translateY(-12px);
    box-shadow: 
        0 25px 50px var(--shadow-medium),
        0 0 0 1px var(--medium-green);
    border-color: var(--light-green);
}

.parent-category {
    background: linear-gradient(135deg, var(--white-color) 0%, rgba(22, 76, 42, 0.02) 100%);
}

/* En-tête de catégorie */
.category-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.category-title {
    margin: 0;
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 700;
    flex: 1;
    min-width: 200px;
    line-height: 1.3;
}

.category-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

.category-title a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.4s ease;
    border-radius: 2px;
}

.category-title a:hover {
    color: var(--primary-color);
    transform: translateX(4px);
}

.category-title a:hover::after {
    width: 100%;
}

/* Métadonnées */
.category-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-count {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white-color);
    padding: 0.75rem 1.25rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 6px 20px var(--shadow-medium);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.category-count::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

.category-item:hover .category-count::before {
    left: 100%;
}

/* Description */
.category-description {
    margin: 2rem 0;
    color: var(--text-light);
    line-height: 1.8;
    font-size: 1rem;
    padding: 1.5rem;
    background: var(--light-green);
    border-radius: 16px;
    border-left: 5px solid var(--primary-color);
    position: relative;
}

.category-description::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 15px;
    font-size: 3rem;
    color: var(--primary-color);
    opacity: 0.3;
    font-family: serif;
}

/* Sous-catégories */
.child-categories {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 2px solid var(--light-green);
    position: relative;
}

.child-categories::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

.child-categories-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.child-categories-title::before {
    content: '🌿';
    font-size: 1.5rem;
}

.child-categories-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 1rem;
}

.child-category-item {
    background: var(--white-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid var(--light-green);
    overflow: hidden;
}

.child-category-item:hover {
    background: var(--light-green);
    box-shadow: 0 8px 25px var(--shadow-light);
    transform: translateY(-4px);
    border-color: var(--medium-green);
}

.child-category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 1rem 1.25rem;
    position: relative;
}

.child-category-link:hover {
    color: var(--primary-color);
}

.child-category-link::before {
    content: '→';
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.child-category-link:hover::before {
    transform: translateX(6px);
}

.child-category-count {
    background: var(--primary-color);
    color: var(--white-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 2.5rem;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.child-category-description {
    margin: 0;
    padding: 1rem 1.25rem;
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
    background: rgba(22, 76, 42, 0.03);
    border-top: 1px solid var(--light-green);
}

/* État vide */
.no-categories {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    background: var(--light-green);
    border-radius: 20px;
    border: 3px dashed var(--medium-green);
}

.no-categories::before {
    content: '🌱';
    display: block;
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-item {
    animation: fadeInUp 0.8s ease forwards;
    opacity: 0;
}

.category-item:nth-child(1) { animation-delay: 0.1s; }
.category-item:nth-child(2) { animation-delay: 0.2s; }
.category-item:nth-child(3) { animation-delay: 0.3s; }
.category-item:nth-child(4) { animation-delay: 0.4s; }
.category-item:nth-child(5) { animation-delay: 0.5s; }
.category-item:nth-child(6) { animation-delay: 0.6s; }
.category-item:nth-child(7) { animation-delay: 0.7s; }
.category-item:nth-child(8) { animation-delay: 0.8s; }

/* RESPONSIVE DESIGN */

/* Tablettes (1024px et moins) */
@media (max-width: 1024px) {
    .content-area {
        padding: 0 1.5rem;
    }
    
    .site-main {
        padding: 3rem 0;
    }
    
    .entry-content {
        padding: 3rem;
        border-radius: 20px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
        gap: 1.5rem;
    }
    
    .category-item {
        padding: 2rem;
    }
    
    .child-categories-list {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    }
}

/* Tablettes portrait et mobiles larges (768px et moins) */
@media (max-width: 768px) {
    .content-area {
        padding: 0 1rem;
    }
    
    .site-main {
        padding: 2rem 0;
    }
    
    .entry-header {
        margin-bottom: 3rem;
    }
    
    .entry-content {
        padding: 2rem;
        border-radius: 16px;
        margin: 0 0.5rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .category-item {
        padding: 1.5rem;
    }
    
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .category-title {
        min-width: auto;
        width: 100%;
    }
    
    .category-meta {
        width: 100%;
        justify-content: flex-start;
    }
    
    .child-categories-list {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .child-category-link {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}

/* Mobiles (480px et moins) */
@media (max-width: 480px) {
    .content-area {
        padding: 0 0.75rem;
    }
    
    .site-main {
        padding: 1.5rem 0;
    }
    
    .entry-header {
        margin-bottom: 2rem;
    }
    
    .entry-title::after {
        width: 60px;
        margin-top: 1rem;
    }
    
    .entry-content {
        padding: 1.5rem;
        margin: 0 0.25rem;
        border-radius: 12px;
    }
    
    .categories-separator {
        margin: 2rem 0;
    }
    
    .category-item {
        padding: 1.25rem;
        border-radius: 16px;
    }
    
    .category-header {
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .category-count {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .category-description {
        padding: 1rem;
        margin: 1.5rem 0;
        font-size: 0.95rem;
    }
    
    .child-categories {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
    
    .child-categories-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .child-category-link {
        padding: 0.75rem;
        font-size: 0.9rem;
        gap: 0.75rem;
    }
    
    .child-category-count {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        min-width: 2rem;
    }
    
    .child-category-description {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* Très petits mobiles (360px et moins) */
@media (max-width: 360px) {
    .content-area {
        padding: 0 0.5rem;
    }
    
    .entry-content {
        padding: 1rem;
        margin: 0;
    }
    
    .category-item {
        padding: 1rem;
    }
    
    .category-header {
        gap: 0.5rem;
    }
    
    .child-category-link {
        padding: 0.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .child-category-link::before {
        display: none;
    }
    
    .child-category-count {
        align-self: flex-end;
    }
}

/* Mode paysage mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .site-main {
        padding: 1rem 0;
    }
    
    .entry-header {
        margin-bottom: 1.5rem;
    }
    
    .entry-content {
        padding: 1.5rem;
    }
}

/* Amélioration pour les écrans haute résolution */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .category-item {
        box-shadow: 
            0 10px 30px var(--shadow-light),
            0 0 0 0.5px var(--light-green);
    }
    
    .category-item:hover {
        box-shadow: 
            0 25px 50px var(--shadow-medium),
            0 0 0 0.5px var(--medium-green);
    }
}

/* Préférences d'accessibilité */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .category-item {
        animation: none;
        opacity: 1;
    }
}

/* Mode sombre (optionnel avec les couleurs vertes) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #e2e8f0;
        --text-light: #cbd5e0;
        --shadow-light: rgba(0, 0, 0, 0.2);
        --shadow-medium: rgba(0, 0, 0, 0.3);
        --shadow-dark: rgba(0, 0, 0, 0.4);
    }
    
    .site-main {
        background: linear-gradient(135deg, #0f1419 0%, var(--primary-color) 100%);
    }
    
    .entry-content {
        background: rgba(26, 32, 44, 0.95);
        color: var(--text-dark);
    }
    
    .category-item {
        background: #2d3748;
        border-color: var(--medium-green);
    }
    
    .parent-category {
        background: linear-gradient(135deg, #2d3748 0%, rgba(22, 76, 42, 0.1) 100%);
    }
    
    .child-category-item {
        background: #374151;
        border-color: var(--medium-green);
    }
    
    .child-category-item:hover {
        background: rgba(22, 76, 42, 0.2);
    }
}