/* ====================================================================
   CATALOGUE PAGE - Pixel-perfect match of Next.js catalogue-client.tsx
   Colors from tailwind.config.ts design system
   ==================================================================== */

/* --- Color reference (from tailwind.config.ts) ---
   forest-50:  #f0fdf4    forest-100: #dcfce7    forest-200: #bbf7d0
   forest-700: #198754    forest-800: #146b3a    forest-900: #0f5132
   forest-950: #0a3d29
   spring-100: #dcfce7    spring-500: #22c55e
   mocha-900:  #3e2723
   stone-50:   #fafaf9    stone-100:  #f5f5f4    stone-200:  #e7e5e3
   stone-300:  #d6d3d1    stone-400:  #a8a29e    stone-500:  #78716c
   stone-600:  #57534e    stone-700:  #44403c
   white:      #ffffff
   ------------------------------------------------------------------- */

/* --- Page wrapper: bg-stone-50 min-h-screen --- */
.czg-catalog-page {
    background-color: #fafaf9;
    min-height: 100vh;
}

/* --- Container --- */
.czg-container {
    max-width: 1280px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
}
@media (min-width: 768px) {
    .czg-container {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* ====================================================================
   HERO SECTION
   bg-gradient-to-br from-forest-900 via-forest-800 to-mocha-900
   text-white py-16 md:py-20 overflow-hidden
   ==================================================================== */
.czg-hero {
    position: relative;
    background: linear-gradient(135deg, #0f5132 0%, #146b3a 50%, #3e2723 100%);
    color: #ffffff;
    padding: 64px 0;
    overflow: hidden;
}
@media (min-width: 768px) {
    .czg-hero { padding: 80px 0; }
}

.czg-hero-decor {
    position: absolute;
    color: #ffffff;
    pointer-events: none;
}
.czg-hero-decor-1 {
    top: -40px;
    right: -40px;
    transform: rotate(12deg);
}
.czg-hero-decor-2 {
    bottom: -20px;
    left: -20px;
    transform: rotate(-12deg);
}

.czg-hero-content {
    position: relative;
    z-index: 10;
}

/* Badge: variant="success" */
.czg-badge {
    display: inline-block;
    background-color: rgba(22, 163, 74, 0.2);
    color: #dcfce7;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 9999px;
    margin-bottom: 16px;
    border: 1px solid rgba(22, 163, 74, 0.3);
}

/* h1: text-3xl md:text-5xl lg:text-6xl font-bold mb-4 */
.czg-hero-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.1;
}
@media (min-width: 768px) {
    .czg-hero-title { font-size: 3rem; }
}
@media (min-width: 1024px) {
    .czg-hero-title { font-size: 3.75rem; }
}

/* p: text-lg md:text-xl text-stone-300 max-w-2xl */
.czg-hero-subtitle {
    font-size: 1.125rem;
    color: #d6d3d1;
    max-width: 42rem;
    line-height: 1.6;
    margin: 0;
}
@media (min-width: 768px) {
    .czg-hero-subtitle { font-size: 1.25rem; }
}

/* ====================================================================
   CATALOG CONTENT AREA
   container mx-auto px-4 md:px-6 py-8 md:py-12
   ==================================================================== */
.czg-catalog-content {
    padding-top: 32px;
    padding-bottom: 32px;
}
@media (min-width: 768px) {
    .czg-catalog-content {
        padding-top: 48px;
        padding-bottom: 48px;
    }
}

/* ====================================================================
   FILTER CARD
   bg-white rounded-2xl shadow-lg p-4 md:p-6 mb-6 border border-stone-200
   ==================================================================== */
.czg-filter-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid #e7e5e3;
}
@media (min-width: 768px) {
    .czg-filter-card { padding: 24px; }
}

/* flex flex-col lg:flex-row gap-4 */
.czg-filter-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
@media (min-width: 1024px) {
    .czg-filter-row { flex-direction: row; }
}

/* --- Search input --- */
/* flex-1 relative */
.czg-search-wrapper {
    flex: 1;
    position: relative;
}

/* absolute left-4 top-1/2 -translate-y-1/2 text-stone-400 */
.czg-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* pl-12 pr-4 py-3 md:py-4 border border-stone-200 rounded-xl
   focus:ring-2 focus:ring-forest-500 focus:border-transparent */
.czg-search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid #e7e5e3;
    border-radius: 12px;
    font-size: 1rem;
    color: #0a3d29;
    background: #ffffff;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}
@media (min-width: 768px) {
    .czg-search-input { padding-top: 16px; padding-bottom: 16px; }
}
.czg-search-input::placeholder {
    color: #a8a29e;
}
.czg-search-input:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px #22c55e;
}

/* --- Mobile filter toggle --- */
/* lg:hidden flex items-center justify-center gap-2 px-4 py-3
   bg-forest-50 text-forest-800 rounded-xl font-medium hover:bg-forest-100 */
.czg-filters-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: #f0fdf4;
    color: #146b3a;
    border-radius: 12px;
    font-weight: 500;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.czg-filters-toggle:hover {
    background-color: #dcfce7;
}
@media (min-width: 1024px) {
    .czg-filters-toggle { display: none; }
}

/* bg-forest-600 text-white text-xs px-2 py-0.5 rounded-full */
.czg-filter-count {
    background-color: #16a34a;
    color: #ffffff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 9999px;
}

/* --- Sort dropdown --- */
/* relative min-w-[180px] */
.czg-sort-wrapper {
    position: relative;
    min-width: 180px;
}

/* appearance-none px-4 py-3 md:py-4 border border-stone-200 rounded-xl
   focus:ring-2 focus:ring-forest-500 bg-white pr-10 */
.czg-sort-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 12px 40px 12px 16px;
    border: 1px solid #e7e5e3;
    border-radius: 12px;
    font-size: 1rem;
    color: #0a3d29;
    background: #ffffff;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
}
@media (min-width: 768px) {
    .czg-sort-select { padding-top: 16px; padding-bottom: 16px; }
}
.czg-sort-select:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px #22c55e;
}

/* absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none */
.czg-sort-chevron {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* ====================================================================
   ADVANCED FILTERS
   mt-4 pt-4 border-t border-stone-100 hidden lg:block
   ==================================================================== */
.czg-advanced-filters {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f5f5f4;
    display: none;
}
@media (min-width: 1024px) {
    .czg-advanced-filters { display: block; }
}
.czg-advanced-filters.show {
    display: block;
}

/* flex flex-wrap items-center gap-2 mb-3 */
.czg-filters-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #78716c;
}
.czg-filters-label span {
    font-size: 0.875rem;
    font-weight: 500;
    color: #57534e;
}

/* grid grid-cols-2 md:grid-cols-4 gap-3 */
.czg-filters-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 768px) {
    .czg-filters-grid { grid-template-columns: repeat(4, 1fr); }
}

/* label: text-xs font-medium text-stone-500 mb-1.5 flex items-center gap-1 */
.czg-filter-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #78716c;
    margin-bottom: 6px;
}

/* select: px-3 py-2 border border-stone-200 rounded-lg text-sm
   focus:ring-2 focus:ring-forest-500 bg-white */
.czg-filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e7e5e3;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #0a3d29;
    background: #ffffff;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
}
.czg-filter-select:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px #22c55e;
}

/* ====================================================================
   CATEGORY BUTTONS
   flex flex-wrap gap-2 md:gap-3 mb-6
   ==================================================================== */
.czg-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
@media (min-width: 768px) {
    .czg-categories { gap: 12px; }
}

/* px-3 md:px-5 py-2 md:py-3 rounded-xl font-medium transition-all text-sm md:text-base
   Inactive: bg-white text-stone-700 hover:bg-forest-50 hover:text-forest-800 shadow-sm
   Active:   bg-forest-800 text-white shadow-md scale-105 */
.czg-cat-btn {
    padding: 8px 12px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    background: #ffffff;
    color: #44403c;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
@media (min-width: 768px) {
    .czg-cat-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
}
.czg-cat-btn:hover {
    background-color: #f0fdf4;
    color: #146b3a;
}
.czg-cat-btn.active {
    background-color: #146b3a;
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    transform: scale(1.05);
}

/* ====================================================================
   RESULTS COUNTER
   mb-6 flex flex-col sm:flex-row sm:items-center justify-between gap-3
   ==================================================================== */
.czg-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}
@media (min-width: 640px) {
    .czg-results {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* text-stone-600 */
.czg-results-text {
    color: #57534e;
    margin: 0;
    font-size: 1rem;
}

/* font-bold text-forest-800 text-lg */
.czg-results-count {
    font-weight: 700;
    color: #146b3a;
    font-size: 1.125rem;
}

/* text-sm text-stone-500 ml-2 */
.czg-results-filters {
    font-size: 0.875rem;
    color: #78716c;
    margin-left: 8px;
}

/* text-sm text-forest-700 hover:text-forest-900 flex items-center gap-1 */
.czg-reset-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    color: #198754;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
    white-space: nowrap;
}
.czg-reset-btn:hover {
    color: #0f5132;
}

/* ====================================================================
   PRODUCT GRID
   grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 md:gap-6
   ==================================================================== */
.czg-product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 640px) {
    .czg-product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .czg-product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1280px) {
    .czg-product-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 768px) {
    .czg-product-grid { gap: 24px; }
}

/* ====================================================================
   PRODUCT CARD
   group bg-white rounded-2xl overflow-hidden shadow-sm
   hover:shadow-xl transition-all duration-300 hover:-translate-y-1
   border border-stone-100 block
   ==================================================================== */
.czg-product-card {
    display: block;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
    border: 1px solid #f5f5f4;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
}
.czg-product-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    transform: translateY(-4px);
}

/* --- Card Image --- */
/* relative aspect-[4/3] bg-gradient-to-br from-forest-100 to-spring-100 overflow-hidden */
.czg-card-image {
    position: relative;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #dcfce7, #dcfce7);
    overflow: hidden;
}

/* object-cover group-hover:scale-105 transition-transform duration-300 */
.czg-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.czg-product-card:hover .czg-card-image img {
    transform: scale(1.05);
}

/* Placeholder: absolute inset-0 flex items-center justify-center text-6xl */
.czg-card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}
.czg-card-placeholder span {
    font-size: 3.75rem;
}
@media (min-width: 768px) {
    .czg-card-placeholder span { font-size: 4.5rem; }
}
.czg-product-card:hover .czg-card-placeholder {
    transform: scale(1.05);
}

/* --- Badges --- */
/* absolute bottom-2 left-2 flex gap-1 */
.czg-card-badges {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
}

/* bg-white/90 backdrop-blur-sm px-1.5 py-0.5 rounded text-xs */
.czg-card-badge {
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    line-height: 1.4;
}

/* --- Card Info --- */
/* p-4 md:p-5 */
.czg-card-info {
    padding: 16px;
}
@media (min-width: 768px) {
    .czg-card-info { padding: 20px; }
}

/* --- Card Name --- */
/* font-bold text-base md:text-lg text-forest-950 mb-1
   group-hover:text-forest-700 transition-colors line-clamp-1 */
.czg-card-name {
    font-weight: 700;
    font-size: 1rem;
    color: #0a3d29;
    margin: 0 0 4px 0;
    transition: color 0.2s;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}
@media (min-width: 768px) {
    .czg-card-name { font-size: 1.125rem; }
}
.czg-product-card:hover .czg-card-name {
    color: #198754;
}

/* --- Latin Name --- */
/* text-sm text-stone-500 italic mb-2 line-clamp-1 */
.czg-card-latin {
    font-size: 0.875rem;
    color: #78716c;
    font-style: italic;
    margin: 0 0 8px 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

/* --- Description --- */
/* text-sm text-stone-600 line-clamp-2 mb-3 */
.czg-card-desc {
    font-size: 0.875rem;
    color: #57534e;
    margin: 0 0 12px 0;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* --- Card Footer --- */
/* flex items-center justify-between pt-3 border-t border-stone-100 */
.czg-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid #f5f5f4;
}

/* --- Price --- */
/* text-xl md:text-2xl font-bold text-forest-700 */
.czg-card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #198754;
}
@media (min-width: 768px) {
    .czg-card-price { font-size: 1.5rem; }
}

/* text-forest-600 font-medium text-sm */
.czg-card-price-request {
    font-size: 0.875rem;
    font-weight: 500;
    color: #16a34a;
}

/* --- Arrow --- */
/* p-2 rounded-full bg-forest-50 text-forest-700
   group-hover:bg-forest-100 transition-colors */
.czg-card-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 9999px;
    background-color: #f0fdf4;
    color: #198754;
    transition: background-color 0.2s;
    flex-shrink: 0;
}
.czg-product-card:hover .czg-card-arrow {
    background-color: #dcfce7;
}

/* ====================================================================
   PAGINATION
   Matches Next.js "1-12 sur 311 produits" + Précédent/Suivant
   ==================================================================== */
.czg-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 32px;
    flex-wrap: wrap;
}
@media (min-width: 768px) {
    .czg-pagination { gap: 8px; margin-top: 40px; }
}

.czg-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #e7e5e3;
    background: #ffffff;
    color: #44403c;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px;
}
.czg-page-btn:hover:not(.disabled):not(.active) {
    background-color: #f0fdf4;
    color: #146b3a;
    border-color: #bbf7d0;
}
.czg-page-btn.active {
    background-color: #146b3a;
    color: #ffffff;
    border-color: #146b3a;
}
.czg-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.czg-page-prev,
.czg-page-next {
    padding: 8px 16px;
}

.czg-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    color: #78716c;
    font-size: 0.875rem;
}

/* ====================================================================
   EMPTY STATE
   text-center py-16 md:py-20 bg-white rounded-2xl shadow-sm
   ==================================================================== */
.czg-empty {
    text-align: center;
    padding: 64px 16px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
@media (min-width: 768px) {
    .czg-empty { padding: 80px 24px; }
}

/* text-6xl md:text-7xl mb-6 */
.czg-empty-icon {
    font-size: 3.75rem;
    margin-bottom: 24px;
}
@media (min-width: 768px) {
    .czg-empty-icon { font-size: 4.5rem; }
}

/* text-xl md:text-2xl font-bold text-forest-950 mb-3 */
.czg-empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0a3d29;
    margin: 0 0 12px 0;
}
@media (min-width: 768px) {
    .czg-empty-title { font-size: 1.5rem; }
}

/* text-stone-600 mb-8 max-w-md mx-auto px-4 */
.czg-empty-text {
    color: #57534e;
    margin: 0 auto 32px;
    max-width: 28rem;
    padding: 0 16px;
}

/* Button matching Next.js Button component */
.czg-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background-color: #146b3a;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}
.czg-empty-btn:hover {
    background-color: #0f5132;
}

/* ====================================================================
   CTA SECTION
   bg-gradient-to-br from-forest-900 to-mocha-900 text-white
   py-16 md:py-20 mt-12 md:mt-16
   ==================================================================== */
.czg-cta {
    background: linear-gradient(135deg, #0f5132 0%, #146b3a 50%, #3e2723 100%);
    color: #ffffff;
    padding: 64px 0;
    margin-top: 48px;
}
@media (min-width: 768px) {
    .czg-cta {
        padding: 80px 0;
        margin-top: 64px;
    }
}

/* container mx-auto px-4 md:px-6 text-center */
.czg-cta-inner {
    text-align: center;
}

/* text-2xl md:text-4xl font-bold mb-4 */
.czg-cta-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    line-height: 1.2;
}
@media (min-width: 768px) {
    .czg-cta-title { font-size: 2.25rem; }
}

/* text-base md:text-lg text-stone-300 mb-8 md:mb-10 max-w-2xl mx-auto */
.czg-cta-text {
    font-size: 1rem;
    color: #d6d3d1;
    margin: 0 auto 32px;
    max-width: 42rem;
    line-height: 1.6;
}
@media (min-width: 768px) {
    .czg-cta-text {
        font-size: 1.125rem;
        margin-bottom: 40px;
    }
}

/* flex flex-col sm:flex-row gap-4 justify-center */
.czg-cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
    align-items: center;
}
@media (min-width: 640px) {
    .czg-cta-buttons {
        flex-direction: row;
    }
}

/* Primary: bg-white text-forest-900 hover:bg-stone-100 */
.czg-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    min-width: 200px;
}
.czg-cta-btn-primary {
    background: #ffffff;
    color: #0f5132;
}
.czg-cta-btn-primary:hover {
    background: #f5f5f4;
    color: #0f5132;
}

/* Outline: text-white border-2 border-white hover:bg-white/10 */
.czg-cta-btn-outline {
    background: transparent;
    color: #ffffff;
    border: 2px solid #ffffff;
}
.czg-cta-btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* ====================================================================
   RESPONSIVE OVERRIDES
   ==================================================================== */

/* Full width buttons on mobile */
@media (max-width: 639px) {
    .czg-cta-btn {
        width: 100%;
    }
}

/* Before JS loads, hide cards beyond 12th to prevent flash.
   JS adds .czg-paginated class to grid, which removes this rule. */
.czg-product-grid:not(.czg-paginated) .czg-product-card:nth-child(n+13) {
    display: none;
}

/* Fix WooCommerce defaults that may interfere */
.czg-catalog-page .woocommerce-result-count,
.czg-catalog-page .woocommerce-ordering,
.czg-catalog-page .woocommerce-breadcrumb {
    display: none !important;
}
