/*
Theme Name:   Blocksy Child
Theme URI:    https://creativethemes.com/blocksy/
Description:  Blocksy Child Theme - Fully Optimized Version with Quick View
Author:       CreativeThemes
Author URI:   https://creativethemes.com
Template:     blocksy
Version:      1.9.0
Text Domain:  blocksy-child
*/

:root {
    --theme-primary-color: #007744;
    --theme-primary-color-dark: #005c35;
    --theme-primary-gradient: linear-gradient(135deg, #007744, #00a855);
    --card-border-radius: 16px;
    --section-padding: 40px 0;
    --grid-gap: 24px;
}

/* =================================
   BASE LAYOUT & GLOBAL STYLES
   ================================= */
.content-area {
    padding-top: 20px !important;
    padding-bottom: 40px !important;
}
.ct-container {
    max-width: 1200px;
}
.section-title-modern, .products-section-title {
    font-size: 28px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-title-modern i, .products-section-title i {
    color: var(--theme-primary-color);
}


/* =================================
   MODERN PRODUCT GRID & CARDS
   ================================= */
.products-grid-modern {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: var(--grid-gap);
}

.product-card-modern {
    background: #ffffff;
    border-radius: var(--card-border-radius);
    overflow: hidden;          
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.product-card-modern:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0, 119, 68, 0.12);
}

.product-card-inner {
    position: relative;
    display: flex; 
    flex-direction: column; 
    flex-grow: 1;
}

.product-link-modern {
    text-decoration: none;
    color: inherit; 
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-image-wrapper-modern {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1/1;
    background-color: #f8f9fa;
}

.product-image-modern {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: transform 0.4s ease;
}

.product-card-modern:hover .product-image-modern {
    transform: scale(1.07);
}

.product-info-modern {
    padding: 16px;
    text-align: center;
    background: #fff;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid #e2e8f0;
}

.product-title-modern {
    font-size: 16px; 
    font-weight: 700;
    color: #2d3748;
    margin: 0;         
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
    width: 100%;
    transition: color 0.3s ease;
}

.product-card-modern:hover .product-title-modern {
    color: var(--theme-primary-color);
}


/* =================================
   PRODUCTS TOOLBAR (Info + Search)
   ================================= */
.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}
.products-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.products-section-title {
    margin: 0;
    font-size: 24px;
}
.products-count-modern {
    background: rgba(0, 119, 68, 0.1);
    color: var(--theme-primary-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
}

.product-search-wrapper {
    min-width: 280px;
}

.product-search-form {
    position: relative;
    display: flex;
}
.product-search-form .search-field {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border-radius: 50px;
    border: 1px solid #ccc;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.product-search-form .search-field:focus {
    border-color: var(--theme-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 119, 68, 0.15);
    outline: none;
}
.product-search-form .search-submit {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 50px;
    border: none;
    background: transparent;
    color: var(--theme-primary-color);
    font-size: 18px;
    cursor: pointer;
    border-radius: 0 50px 50px 0;
}


/* =================================
   OPTIMIZED CATEGORIES SECTION (Icon on Top)
   ================================= */
.product-categories-section-modern {
    background: #f8f9fa;
    padding: 40px;
    margin-bottom: 50px;
    border-radius: var(--card-border-radius);
    border: 1px solid #e9ecef;
}
.product-categories-section-modern .section-title-modern {
    text-align: center;
    display: block;
    margin-bottom: 30px;
}

.product-categories-grid-modern {
    display: grid;
    /* Use auto-fill with a larger minmax for better spacing with centered content */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    max-height: 180px; /* Adjust height based on new item layout */
    overflow: hidden;
    transition: max-height 0.7s ease-in-out;
}
.product-categories-grid-modern.expanded {
    max-height: 2000px;
}

.product-category-item-modern {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}
.product-category-item-modern.category-hidden {
    display: none;
}
.product-categories-grid-modern.expanded .product-category-item-modern.category-hidden {
    display: flex;
}

.product-category-item-modern:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--theme-primary-color);
}

/* === KEY CHANGE: Icon on Top Layout === */
.product-category-item-modern a {
    text-decoration: none;
    color: #343a40;
    display: flex;
    flex-direction: column; /* Stack icon and info vertically */
    align-items: center;   /* Center horizontally */
    justify-content: flex-start;
    padding: 20px 10px;
    gap: 12px;             /* Space between icon and text */
    text-align: center;    /* Center all text */
    height: 100%;
}

.category-icon-wrapper {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center; 
    background-color: rgba(0, 119, 68, 0.1);
    border-radius: 50%;
    margin-bottom: 5px; /* Add some space below the icon */
}
.category-item-fa-icon-modern {
    font-size: 22px;
    color: var(--theme-primary-color);
}
.category-item-info {
    text-align: center;
}
.category-item-name-modern {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    min-height: 2.8em; /* Reserve space for 2 lines of text to keep cards aligned */
}
.category-item-count {
    font-size: 13px;
    color: #6c757d;
}

.categories-toggle-wrapper-modern {
    text-align: center;
    margin-top: 30px;
}
.toggle-categories-btn-modern {
    background: var(--theme-primary-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 119, 68, 0.2);
}
.toggle-categories-btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 68, 0.3);
}
.toggle-categories-btn-modern .toggle-icon-modern {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-categories-btn-modern.rotated .toggle-icon-modern {
    transform: rotate(180deg);
}


/* =================================
   MODERN CATEGORY PAGE HEADER
   ================================= */
.category-header-modern {
    background: #f8fffe;
    padding: 40px;
    margin-bottom: 40px;
    border-radius: 24px;
    text-align: center;
    border: 1px solid rgba(0, 119, 68, 0.1);
}
.category-breadcrumb-modern {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 25px;
    font-size: 14px;
    flex-wrap: wrap;
}
.category-breadcrumb-modern a {
    color: var(--theme-primary-color);
    text-decoration: none;
}
.category-breadcrumb-modern a:hover { text-decoration: underline; }
.category-breadcrumb-modern i { font-size: 12px; color: #999; }
.category-breadcrumb-modern span { color: #333; font-weight: 500; }

.category-title-wrapper { margin-bottom: 15px; }
.category-icon-large { margin-bottom: 15px; }
.category-icon-large i {
    font-size: 42px;
    color: var(--theme-primary-color);
    background: #fff;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    box-shadow: 0 5px 25px rgba(0, 119, 68, 0.15);
}
.category-title-modern {
    font-size: 42px;
    font-weight: 800;
    color: #2d3748;
    margin: 0;
}
.category-description-modern {
    max-width: 700px;
    margin: 0 auto;
    color: #555;
    font-size: 16px;
    line-height: 1.7;
}

/* =================================
   PAGINATION
   ================================= */
.pagination-wrapper-modern {
    margin-top: 50px;
    text-align: center;
}
.pagination-wrapper-modern .nav-links {
    display: inline-flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    border: 1px solid #ddd;
    border-radius: 50px;
    padding: 5px;
    background: #fff;
}
.pagination-wrapper-modern .page-numbers {
    background: transparent;
    color: var(--theme-primary-color);
    height: 40px;
    width: 40px;
    line-height: 40px; 
    border-radius: 50%;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    font-size: 15px;
    display: inline-block;
    text-align: center;
}
.pagination-wrapper-modern .page-numbers:hover,
.pagination-wrapper-modern .page-numbers.current {
    background: var(--theme-primary-color);
    color: white;
}
.pagination-wrapper-modern .page-numbers.dots {
    color: #999;
    background: transparent;
    cursor: default;
}
.pagination-wrapper-modern .prev,
.pagination-wrapper-modern .next {
    font-size: 14px;
}


/* =================================
   NO PRODUCTS MESSAGE
   ================================= */
.no-products-message-modern {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 20px;
    margin: 40px 0;
}
.no-products-content .empty-icon { margin-bottom: 25px; }
.no-products-content .empty-icon i {
    font-size: 64px;
    color: #d1d8e0;
}
.no-products-content h3 {
    font-size: 26px;
    color: #2d3748;
    margin-bottom: 15px;
    font-weight: 700;
}
.no-products-content p {
    color: #718096;
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.6;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}
.empty-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-primary-modern, .btn-secondary-modern {
    padding: 12px 28px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}
.btn-primary-modern {
    background: var(--theme-primary-gradient);
    color: white !important;
    box-shadow: 0 4px 15px rgba(0, 119, 68, 0.2);
}
.btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 68, 0.3);
    color: #fff !important;
}
.btn-secondary-modern {
    background: #fff;
    color: var(--theme-primary-color) !important;
    border-color: #ddd;
}
.btn-secondary-modern:hover {
    background: #f8f9fa;
    border-color: var(--theme-primary-color);
    color: var(--theme-primary-color) !important;
}

/* =================================
   PRODUCT CARD - HOVER & QUICK VIEW
   ================================= */

/* --- Hover Info for Desktop --- */
.product-hover-info {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 119, 68, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    text-align: center;
    pointer-events: none;
}

.hover-info-content {
    transform: translateY(15px);
    transition: transform 0.35s ease;
}
.product-card-modern:hover .hover-info-content {
    transform: translateY(0);
}

/* === KEY CHANGE: Make ingredient text on hover more prominent === */
.hover-info-content p {
    font-size: 16px; /* Larger font size */
    font-weight: 700; /* Bold text */
    line-height: 1.6; /* Increased line height for readability */
    margin: 0 0 15px 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-view-details {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    color: var(--theme-primary-color);
    border-radius: 50px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
}

/* --- Quick View Button --- */
.btn-quick-view {
    display: none;
    background: #fff;
    color: var(--theme-primary-color);
    border: 1px solid #ddd;
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    gap: 8px;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin: 0 16px 16px;
    flex-shrink: 0;
}
.btn-quick-view:hover {
    background: #f8f9fa;
    border-color: var(--theme-primary-color);
    color: var(--theme-primary-color-dark);
}

/* =================================
   QUICK VIEW MODAL STYLES
   ================================= */
.quick-view-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.quick-view-modal-container.visible {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.quick-view-modal-container.visible .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: #f1f1f1;
    border: none;
    border-radius: 50%;
    color: #555;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.modal-close-btn:hover {
    background: #e0e0e0;
    color: #000;
}

.modal-body {
    display: flex;
    padding: 30px;
    flex-grow: 1;
    overflow: hidden;
}

.modal-image-col {
    flex: 1 1 45%;
    padding-right: 30px;
}
.modal-image-col img {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 12px;
}

.modal-info-col {
    flex: 1 1 55%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#modal-product-title {
    font-size: 26px;
    color: var(--theme-primary-color);
    margin-top: 0;
    margin-bottom: 15px;
}
#modal-product-info {
    font-size: 15px;
    line-height: 1.7;
    color: #333;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 15px;
    margin-right: -15px;
    margin-bottom: 25px;
}
#modal-product-info::-webkit-scrollbar { width: 6px; }
#modal-product-info::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
#modal-product-info::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
#modal-product-info::-webkit-scrollbar-thumb:hover { background: #aaa; }
#modal-product-info p:first-child { margin-top: 0; }
#modal-product-info p:last-child { margin-bottom: 0; }
#modal-product-info h1, #modal-product-info h2, #modal-product-info h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #000;
    line-height: 1.3;
}
#modal-product-info ul, #modal-product-info ol {
    padding-left: 20px;
}


/* =================================
   RESPONSIVE DESIGN
   ================================= */
/* Desktop (≥ 992px) */
@media (min-width: 992px) {
    .product-card-modern:hover .product-hover-info {
        opacity: 1;
        visibility: visible;
    }
}

/* Tablet (≤ 991px) */
@media (max-width: 991px) {
    :root {
        --grid-gap: 20px;
    }
    .products-grid-modern {
        grid-template-columns: repeat(3, 1fr);
    }
    .product-categories-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .category-title-modern { font-size: 36px; }

    .product-hover-info {
        display: none !important;
    }
    .btn-quick-view {
        display: inline-flex !important;
    }
}

/* Mobile (≤ 767px) */
@media (max-width: 767px) {
    :root {
        --grid-gap: 15px;
    }
    .products-grid-modern {
        grid-template-columns: repeat(2, 1fr);
    }
    .products-section-title { 
        font-size: 22px; 
    }
    
    .products-toolbar { 
        flex-direction: column; 
        align-items: stretch; 
    }
    .product-search-wrapper { 
        min-width: 100%; 
    }
    
    .product-categories-section-modern {
        padding: 20px;
        margin-bottom: 30px;
    }

    .product-categories-grid-modern {
        grid-template-columns: repeat(2, 1fr);
        max-height: 380px; /* Adjust to show ~2 rows of taller items */
        gap: 15px;
    }
    
    .category-header-modern { padding: 30px 20px; }
    .category-title-modern { font-size: 28px; }
    .category-icon-large i { width: 60px; height: 60px; line-height: 60px; font-size: 32px; }
    
    .pagination-wrapper-modern .page-numbers { width: 36px; height: 36px; line-height: 36px; font-size: 14px; }
    .no-products-content h3 { font-size: 22px; }
    .no-products-content p { font-size: 15px; }
    .empty-actions { flex-direction: column; }
    .btn-primary-modern, .btn-secondary-modern { width: 100%; justify-content: center; max-width: 300px; }

    .modal-body { flex-direction: column; padding: 20px; }
    .modal-image-col { padding-right: 0; margin-bottom: 20px; }
    #modal-product-title { font-size: 22px; }
    .modal-content { max-height: 85vh; }
}

/* Small Mobile (≤ 480px) */
@media (max-width: 480px) {
    :root {
        --grid-gap: 12px;
    }
    .product-title-modern { font-size: 14px; }
    .product-info-modern { padding: 12px; }
    .btn-quick-view { margin: 0 12px 12px; }
    
    .product-categories-section-modern {
        padding: 15px;
    }
    .product-categories-grid-modern {
        gap: 12px;
    }
    .product-category-item-modern a {
        padding: 15px 8px;
    }
    .category-item-name-modern {
        font-size: 13px;
    }


    .category-header-modern { padding: 25px 15px; }
    .category-breadcrumb-modern { font-size: 13px; }
    .category-title-modern { font-size: 24px; }

    .pagination-wrapper-modern .nav-links { gap: 4px; }
}