/**
 * Dynamic Section Designs CSS
 * 
 * Styles for the dynamic sections with custom types and unlimited items
 * Each section displays items in a flexible responsive grid
 */

/* Section Container */
.smk-category-sections-container {
    width: 100% !important;
}

.smk-dynamic-section {
    width: 100% !important;
    padding: 5% 10% !important;
    transition: background-color 0.3s ease;
}

/* Ensure text readability with background colors */
.smk-dynamic-section[style*="background-color"] {
    position: relative;
}

.smk-dynamic-section[style*="background-color"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    border-radius: inherit;
    z-index: -1;
}

/* Light background adjustments */
.smk-dynamic-section[style*="background-color: #f"] .smk-section-title,
.smk-dynamic-section[style*="background-color: #e"] .smk-section-title {
    color: #333;
}

/* Dark background adjustments */  
.smk-dynamic-section[style*="background-color: #0"] .smk-section-title,
.smk-dynamic-section[style*="background-color: #1"] .smk-section-title,
.smk-dynamic-section[style*="background-color: #2"] .smk-section-title,
.smk-dynamic-section[style*="background-color: #3"] .smk-section-title {
    color: #fff;
}

.smk-category-sections-container .smk-section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #333;
    text-align: left !important;
}

.smk-section-type {
    font-size: 16px;
    color: #666;
    font-style: italic;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* No content message */
.smk-no-content {
    padding: 20px;
    background: #f9f9f9;
    border: 1px dashed #ccc;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Image Card Grid */

.smk-image-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* =============================================================================
   DYNAMIC ITEMS GRID - Responsive flexible grid for any number of items
   ============================================================================= */

.smk-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    width: 100%;
}

.smk-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.smk-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.smk-item-content {
    position: relative;
    height: 250px;
    display: flex;
    flex-direction: column;
}

/* Image styling */
.smk-item-image {
    width: 100%;
    flex: 1;
    overflow: hidden;
}

.smk-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.smk-item:hover .smk-item-image img {
    transform: scale(1.05);
}

/* Text styling */
.smk-item-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 30px 20px 20px;
}

.smk-item-text h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

/* Text-only items (no image) */
.smk-item:not(:has(.smk-item-image)) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.smk-item:not(:has(.smk-item-image)) .smk-item-content {
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.smk-item:not(:has(.smk-item-image)) .smk-item-text {
    position: static;
    background: none;
    padding: 0;
}

.smk-item:not(:has(.smk-item-image)) .smk-item-text h3 {
    font-size: 20px;
}

/* =============================================================================
   SECTION TYPE VARIATIONS - Different styling based on section type
   ============================================================================= */

/* Application type styling */
.smk-section-type-application .smk-items-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.smk-section-type-application .smk-item-content {
    height: 280px;
}

/* Spaces type styling */
.smk-section-type-spaces .smk-items-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.smk-section-type-spaces .smk-item {
    border-radius: 12px;
}

.smk-section-type-spaces .smk-item-content {
    height: 200px;
}

.smk-section-type-spaces .smk-item-text {
    background: linear-gradient(transparent, rgba(255, 107, 53, 0.9));
}

/* Finishes type styling */
.smk-section-type-finishes .smk-items-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.smk-section-type-finishes .smk-item {
    border: 2px solid #f0f0f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.smk-section-type-finishes .smk-item:hover {
    border-color: #ff6b35;
}

.smk-section-type-finishes .smk-item-content {
    height: 160px;
}

/* Gallery type styling */
.smk-section-type-gallery .smk-items-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.smk-section-type-gallery .smk-item {
    border-radius: 4px;
}

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

@media (max-width: 1200px) {
    .smk-items-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .smk-section-type-application .smk-items-grid,
    .smk-section-type-spaces .smk-items-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .smk-section-title {
        font-size: 24px;
        margin-bottom: 12px;
    }
    
    .smk-section-type {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .smk-items-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 15px;
    }
    
    .smk-item-content {
        height: 220px !important;
    }
    
    .smk-item-text h3 {
        font-size: 16px;
    }
    
    .smk-section-type-finishes .smk-items-grid,
    .smk-section-type-spaces .smk-items-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .smk-items-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .smk-image-cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .smk-item-content {
        height: 200px !important;
    }
    
    .smk-section-title {
        font-size: 20px;
        text-align: center;
    }
    
    .smk-section-type {
        text-align: center;
        margin-bottom: 15px;
    }
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

/* Loading state */
.smk-dynamic-section.loading {
    opacity: 0.5;
    pointer-events: none;
}

.smk-dynamic-section.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.smk-dynamic-section:empty::before {
    content: "No items to display";
    display: block;
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 8px;
}

/* Animation for dynamic loading */
.smk-item {
    animation: fadeInUp 0.5s ease forwards;
}

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

/* =============================================================================
   GENERAL CARDS DESIGN (5 per row, standard grid)
   ============================================================================= */

.smk-general-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.smk-general-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.smk-general-card:hover {
    border-color: #ff6b35;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.smk-general-card-image {
    overflow: hidden;
    height: 200px;
}

.smk-general-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.smk-general-card:hover .smk-general-card-image img {
    transform: scale(1.03);
}

.smk-general-card-content {
    padding: 16px;
}

.smk-general-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
}

.smk-general-card-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 10px;
}

.smk-general-card-price {
    font-size: 16px;
    font-weight: 600;
    color: #ff6b35;
}

.smk-image-card-content, .smk-masonry-content {
    position: relative !important;
}

.smk-card-overlay, .smk-masonry-text {
    position: absolute !important;
    bottom: 10px;
    left: 20px;
}

.smk-image-card-content .smk-card-overlay {
    color: white;    
}

.smk-image-card-content .smk-card-title {
    font-size: 34px;
    font-weight: bold !important;
    margin: 0;
    line-height: 1.3;
}

.smk-category-sections-container .smk-icon-boxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.smk-category-sections-container .smk-icon-box {
    background: #f1f1f1;    
    padding: 20px;
    text-align: center !important;
    transition: all 0.3s ease;
}

.smk-category-sections-container .smk-icon-box img {
    width: 65%;
    height: 65%;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}



/* =============================================================================
   MASONRY GRID - NEWS CATALOG LAYOUT
   Left image | Two small images stacked | Full height image  
   ============================================================================= */

.smk-masonry-grid {
    display: grid;
    grid-template-columns: calc(50% - 10px) calc(25% - 5px) calc(25% - 5px);
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    height: 600px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.smk-masonry-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation-fill-mode: forwards;
}

.smk-masonry-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* First item - large left image */
.smk-masonry-item:nth-child(1) {
    grid-row: 1 / 3;
    grid-column: 1;
}

/* Second item - top middle small image */
.smk-masonry-item:nth-child(2) {
    grid-row: 1;
    grid-column: 2;
}

/* Third item - bottom middle small image */
.smk-masonry-item:nth-child(3) {
    grid-row: 2;
    grid-column: 2;
}

/* Fourth item - full height right image */
.smk-masonry-item:nth-child(4) {
    grid-row: 1 / 3;
    grid-column: 3;
}

/* Additional items beyond 4 - stack horizontally */
.smk-masonry-item:nth-child(n+5) {
    grid-column: 1 / 4;
    height: 200px;
    margin-top: 10px;
}

.smk-masonry-content {
    position: relative !important;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.smk-masonry-image {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.smk-masonry-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.smk-masonry-item:hover .smk-masonry-image img {
    transform: scale(1.05);
}

.smk-masonry-text {
    position: absolute !important;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 30px 20px 15px;
    z-index: 2;
}

.smk-masonry-text h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

/* Text-only items (no image) */
.smk-masonry-item:not(:has(.smk-masonry-image)) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.smk-masonry-item:not(:has(.smk-masonry-image)) .smk-masonry-text {
    position: static;
    background: none;
    padding: 0;
}

.smk-masonry-item:not(:has(.smk-masonry-image)) .smk-masonry-text h4 {
    font-size: 18px;
}

/* Loading state for masonry */
.smk-masonry-grid.loading .smk-masonry-item {
    opacity: 0.7;
    pointer-events: none;
}

.smk-masonry-grid.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: masonrySpinLoader 1s linear infinite;
    z-index: 10;
}

@keyframes masonrySpinLoader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design for Masonry News Layout */
@media (max-width: 1200px) {
    .smk-masonry-grid {
        height: 350px;
    }
    
    .smk-masonry-text h4 {
        font-size: 14px;
    }
    
    .smk-masonry-text {
        padding: 20px 15px 10px;
    }
}

@media (max-width: 768px) {
    .smk-masonry-grid {
        grid-template-columns: calc(60% - 5px) calc(40% - 5px);
        grid-template-rows: 1fr 1fr;
        height: 300px;
    }
    
    /* First item - large left image */
    .smk-masonry-item:nth-child(1) {
        grid-row: 1 / 3;
        grid-column: 1;
    }
    
    /* Second item - top right */
    .smk-masonry-item:nth-child(2) {
        grid-row: 1;
        grid-column: 2;
    }
    
    /* Third item - bottom right */
    .smk-masonry-item:nth-child(3) {
        grid-row: 2;
        grid-column: 2;
    }
    
    /* Fourth item - hidden on tablet */
    .smk-masonry-item:nth-child(4) {
        display: none;
    }
    
    /* Additional items */
    .smk-masonry-item:nth-child(n+5) {
        grid-column: 1 / 3;
    }
}

@media (max-width: 480px) {
    .smk-masonry-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
        gap: 15px;
    }
    
    .smk-masonry-item {
        grid-row: auto !important;
        grid-column: 1 !important;
        height: 250px !important;
        margin-top: 0 !important;
    }
    
    .smk-masonry-item:nth-child(4) {
        display: block;
    }
    
    .smk-masonry-text {
        padding: 20px 15px 10px;
    }
    
    .smk-masonry-text h4 {
        font-size: 14px;
    }
}

.smk-card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-width: 1400px;
    margin: 0 auto;
}

.smk-card-grid-item {
    position: relative;
    overflow: hidden;
}

.smk-card-content {
    position: relative;
    overflow: hidden;
    /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
    /* transition: transform 0.3s ease, box-shadow 0.3s ease; */
    height: 100%;
}
/* 
.smk-card-content:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
} */

.smk-card-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 10px solid #f1f1f1;
}

.smk-card-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.smk-card-text {
    text-align: center;
}

/* .smk-card-text h4 {
    color: white;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
} */

/* Responsive - 4 columns on tablets */
@media (max-width: 1200px) {
    .smk-card-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
}

/* 3 columns on small tablets */
@media (max-width: 992px) {
    .smk-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 2 columns on mobile landscape */
@media (max-width: 768px) {
    .smk-card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .smk-card-text h4 {
        font-size: 14px;
    }
}

/* 1 column on small mobile */
@media (max-width: 480px) {
    .smk-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/**
Category products section designs CSS
*/
.category-products .smk-section-title {
    text-align: left !important;
}

.category-products .smk-card {    
    text-align: left !important;
}

.category-products .smk-card:hover {
    transform: none !important;
    box-shadow: none !important;
}

.category-products .smk-card img {
    margin-bottom: 0 !important;
    border: 8px solid #f1f1f1;
}

.category-products .smk-card h3 {
    font-size: 22px !important;
}

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

/* Tablet */
@media (max-width: 768px) {
    .smk-dynamic-section {
        padding: 5% !important;
    }

    .smk-category-sections-container .smk-icon-box {
        padding: 5px;
    }

    .smk-image-cards-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 15px;
    }
    
    .smk-icon-boxes-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .smk-general-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .smk-section-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .smk-icon-boxes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .smk-general-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .smk-section {
        margin-bottom: 30px;
    }
    
    .smk-section-title {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .smk-card-overlay {
        padding: 20px 15px 15px;
    }
    
    .smk-card-title {
        font-size: 18px;
    }
}
