/* Smart Content Grid Pro v4.0.0 - Enhanced Customization */

/* ========================================
   CSS Custom Properties (Variables)
   ======================================== */
.scg-grid {
    /* Layout */
    --scg-cols: 3;
    --scg-gap: 24px;
    --scg-radius: 12px;
    
    /* Colors */
    --scg-accent: #3b82f6;
    --scg-text: #1f2937;
    --scg-text-light: #6b7280;
    --scg-bg: #ffffff;
    --scg-bg-hover: #f9fafb;
    --scg-border: #e5e7eb;
    --scg-overlay: rgba(0, 0, 0, 0.6);
    
    /* Typography */
    --scg-title-size: 1.125rem;
    --scg-meta-size: 0.875rem;
    --scg-excerpt-size: 0.9375rem;
    --scg-button-size: 0.875rem;
    --scg-line-height: 1.5;
    
    /* Shadows */
    --scg-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --scg-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    
    /* Spacing */
    --scg-content-padding: 20px;
    --scg-image-height: auto;
    
    /* Animation */
    --scg-animation-duration: 0.5s;
    --scg-transition: 0.3s ease;
    
    width: 100%;
    box-sizing: border-box;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* ========================================
   Base Grid Layout
   ======================================== */
.scg-items {
    display: grid;
    grid-template-columns: repeat(var(--scg-cols), 1fr);
    gap: var(--scg-gap);
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ========================================
   Card Item Base Styles
   ======================================== */
.scg-item {
    display: flex;
    flex-direction: column;
    background: var(--scg-bg);
    border-radius: var(--scg-radius);
    overflow: hidden;
    position: relative;
}

/* Animation states - only when animation class is present */
.scg-grid:not(.scg-animation-none) .scg-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--scg-animation-duration), 
                transform var(--scg-animation-duration),
                box-shadow var(--scg-transition),
                border-color var(--scg-transition);
    transition-delay: var(--delay, 0ms);
}

.scg-grid:not(.scg-animation-none) .scg-item.scg-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Card hover effect - only for styled cards */
.scg-style-shadow .scg-item:hover,
.scg-style-border .scg-item:hover,
.scg-style-flat .scg-item:hover,
.scg-style-glass .scg-item:hover {
    transform: translateY(-4px);
}

/* No hover effect for animation none */
.scg-animation-none .scg-item:hover {
    transform: none;
}

/* ========================================
   Card Styles (Shadow Levels)
   ======================================== */
/* No shadow */
.scg-shadow-none .scg-item {
    box-shadow: none;
}

/* Small shadow */
.scg-shadow-sm .scg-item {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.scg-shadow-sm .scg-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Medium shadow (default) */
.scg-shadow-md .scg-item {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.scg-shadow-md .scg-item:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Large shadow */
.scg-shadow-lg .scg-item {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}
.scg-shadow-lg .scg-item:hover {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

/* Extra large shadow */
.scg-shadow-xl .scg-item {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.scg-shadow-xl .scg-item:hover {
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
}

/* ========================================
   Card Style Variants
   ======================================== */
/* No style - completely plain */
.scg-style-none .scg-item {
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
}
.scg-style-none .scg-item:hover {
    transform: none;
    box-shadow: none;
}

/* Border style */
.scg-style-border .scg-item {
    border: 1px solid var(--scg-border);
    box-shadow: none;
}
.scg-style-border .scg-item:hover {
    border-color: var(--scg-accent);
}

/* Flat style */
.scg-style-flat .scg-item {
    background: var(--scg-bg-hover);
    box-shadow: none;
}

/* Glass style */
.scg-style-glass .scg-item {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ========================================
   Image Styles
   ======================================== */
.scg-image {
    display: block;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    flex-shrink: 0;
}

.scg-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image hover effects - only applied when class is present */
.scg-hover-zoom .scg-image img {
    transition: transform 0.4s ease;
}
.scg-hover-zoom .scg-image:hover img {
    transform: scale(1.05);
}

.scg-hover-shine .scg-image {
    overflow: hidden;
}
.scg-hover-shine .scg-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    z-index: 2;
    transition: left 0.5s ease;
}
.scg-hover-shine .scg-image:hover::before {
    left: 100%;
}

.scg-hover-grayscale .scg-image img {
    filter: grayscale(100%);
    transition: filter 0.4s ease;
}
.scg-hover-grayscale .scg-image:hover img {
    filter: grayscale(0%);
}

.scg-hover-blur .scg-image img {
    transition: filter 0.4s ease;
}
.scg-hover-blur .scg-image:hover img {
    filter: blur(2px);
}

/* Lazy loading */
.scg-lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.scg-loaded {
    opacity: 1;
}

/* Image aspect ratios */
.scg-ratio-landscape { aspect-ratio: 16 / 9; }
.scg-ratio-classic { aspect-ratio: 4 / 3; }
.scg-ratio-square { aspect-ratio: 1 / 1; }
.scg-ratio-portrait { aspect-ratio: 2 / 3; }
.scg-ratio-wide { aspect-ratio: 21 / 9; }
.scg-ratio-auto { aspect-ratio: auto; }

/* Category badge on image */
.scg-category-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    background: var(--scg-accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* ========================================
   Content Area
   ======================================== */
.scg-content {
    padding: var(--scg-content-padding);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Title - Works with any HTML tag (h2, h3, h4, h5, h6, p, span, div) */
.scg-grid .scg-title,
.scg-grid h2.scg-title,
.scg-grid h3.scg-title,
.scg-grid h4.scg-title,
.scg-grid h5.scg-title,
.scg-grid h6.scg-title,
.scg-grid p.scg-title,
.scg-grid span.scg-title,
.scg-grid div.scg-title {
    margin: 0 0 8px;
    padding: 0;
    font-size: var(--scg-title-size);
    font-weight: 600;
    line-height: 1.4;
    border: none;
    background: none;
}

.scg-grid .scg-title a {
    color: var(--scg-text);
    text-decoration: none;
    transition: color var(--scg-transition);
}

.scg-grid .scg-title a:hover {
    color: var(--scg-accent);
}

/* Meta info */
.scg-grid .scg-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: var(--scg-meta-size);
    color: var(--scg-text-light);
    margin-bottom: 12px;
}

.scg-grid .scg-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.scg-grid .scg-meta svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* Author avatar */
.scg-grid .scg-author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 4px;
}

/* Excerpt */
.scg-grid .scg-excerpt {
    margin: 0 0 16px;
    font-size: var(--scg-excerpt-size);
    line-height: var(--scg-line-height);
    color: var(--scg-text-light);
    flex-grow: 1;
}

/* Button */
.scg-grid .scg-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: var(--scg-button-size);
    font-weight: 500;
    color: #fff;
    background: var(--scg-accent);
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: filter var(--scg-transition), transform var(--scg-transition);
    align-self: flex-start;
}

.scg-grid .scg-button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.scg-grid .scg-button svg {
    width: 16px;
    height: 16px;
    margin-left: 6px;
}

/* Outline button variant */
.scg-button-outline .scg-button {
    background: transparent;
    color: var(--scg-accent);
    border: 2px solid var(--scg-accent);
}
.scg-button-outline .scg-button:hover {
    background: var(--scg-accent);
    color: #fff;
}

/* ========================================
   LAYOUT: List
   ======================================== */
.scg-layout-list .scg-items {
    grid-template-columns: 1fr;
}

.scg-layout-list .scg-item {
    flex-direction: row;
}

.scg-layout-list .scg-image {
    width: 280px;
    min-height: 200px;
}

.scg-layout-list .scg-content {
    justify-content: center;
}

/* ========================================
   LAYOUT: Masonry
   ======================================== */
.scg-layout-masonry .scg-items {
    display: block;
    column-count: var(--scg-cols);
    column-gap: var(--scg-gap);
}

.scg-layout-masonry .scg-item {
    break-inside: avoid;
    margin-bottom: var(--scg-gap);
}

/* ========================================
   LAYOUT: Carousel
   ======================================== */
.scg-layout-carousel {
    position: relative;
}

.scg-carousel-wrapper {
    position: relative;
    overflow: hidden;
    margin: 0 -10px;
    padding: 0 10px;
}

.scg-carousel-track {
    display: flex;
    transition: transform 0.4s ease;
}

.scg-carousel-slide {
    flex: 0 0 calc(100% / var(--scg-carousel-slides, 1));
    padding: 0 calc(var(--scg-gap) / 2);
    box-sizing: border-box;
}

.scg-carousel-slide .scg-item {
    opacity: 1;
    transform: none;
    height: 100%;
}

/* Carousel navigation buttons */
.scg-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: var(--scg-bg);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    font-size: 20px;
    color: var(--scg-text);
    z-index: 10;
    transition: all var(--scg-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scg-carousel-btn:hover {
    background: var(--scg-accent);
    color: #fff;
    transform: translateY(-50%) scale(1.05);
}

.scg-carousel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.scg-prev { left: 5px; }
.scg-next { right: 5px; }

/* Carousel dots */
.scg-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 0;
}

.scg-dot {
    width: 10px;
    height: 10px;
    border: none;
    border-radius: 50%;
    background: var(--scg-border);
    cursor: pointer;
    padding: 0;
    transition: all var(--scg-transition);
}

.scg-dot.scg-active,
.scg-dot:hover {
    background: var(--scg-accent);
    transform: scale(1.3);
}

/* ========================================
   LAYOUT: Featured (Large first + grid)
   ======================================== */
.scg-layout-featured .scg-items {
    display: grid;
    grid-template-columns: repeat(var(--scg-cols), 1fr);
    gap: var(--scg-gap);
}

.scg-layout-featured .scg-item:first-child {
    grid-column: 1 / -1;
    flex-direction: row;
}

.scg-layout-featured .scg-item:first-child .scg-image {
    width: 60%;
    min-height: 350px;
}

.scg-layout-featured .scg-item:first-child .scg-content {
    padding: 30px;
    justify-content: center;
}

.scg-layout-featured .scg-item:first-child .scg-title {
    font-size: calc(var(--scg-title-size) * 1.5);
}

.scg-layout-featured .scg-item:first-child .scg-excerpt {
    font-size: calc(var(--scg-excerpt-size) * 1.1);
}

/* ========================================
   LAYOUT: Minimal
   ======================================== */
.scg-layout-minimal .scg-item {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.scg-layout-minimal .scg-item:hover {
    transform: none;
}

.scg-layout-minimal .scg-image {
    border-radius: var(--scg-radius);
    margin-bottom: 12px;
}

.scg-layout-minimal .scg-content {
    padding: 0;
}

.scg-layout-minimal .scg-title a:hover {
    text-decoration: underline;
}

.scg-layout-minimal .scg-button {
    background: transparent;
    color: var(--scg-accent);
    padding: 0;
    font-weight: 600;
}

.scg-layout-minimal .scg-button:hover {
    text-decoration: underline;
    filter: none;
    transform: none;
}

/* ========================================
   LAYOUT: Overlay (Text over image)
   ======================================== */
.scg-layout-overlay .scg-item {
    position: relative;
    min-height: 300px;
    background: transparent;
}

.scg-layout-overlay .scg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.scg-layout-overlay .scg-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(to top, var(--scg-overlay) 0%, transparent 100%);
    z-index: 2;
}

.scg-layout-overlay .scg-content {
    position: relative;
    z-index: 3;
    margin-top: auto;
    padding: 25px;
    color: #fff;
}

.scg-layout-overlay .scg-title a {
    color: #fff;
}

.scg-layout-overlay .scg-title a:hover {
    color: rgba(255, 255, 255, 0.8);
}

.scg-layout-overlay .scg-meta {
    color: rgba(255, 255, 255, 0.8);
}

.scg-layout-overlay .scg-excerpt {
    color: rgba(255, 255, 255, 0.9);
}

.scg-layout-overlay .scg-button {
    background: #fff;
    color: var(--scg-text);
}

.scg-layout-overlay .scg-button:hover {
    background: var(--scg-accent);
    color: #fff;
}

.scg-layout-overlay .scg-category-badge {
    position: relative;
    top: auto;
    left: auto;
    margin-bottom: 12px;
    display: inline-block;
}

/* Overlay size variants */
.scg-overlay-sm .scg-item { min-height: 220px; }
.scg-overlay-md .scg-item { min-height: 300px; }
.scg-overlay-lg .scg-item { min-height: 400px; }
.scg-overlay-xl .scg-item { min-height: 500px; }

/* ========================================
   LAYOUT: Cards (Modern card styles)
   ======================================== */
.scg-layout-cards .scg-item {
    border: 1px solid var(--scg-border);
}

.scg-layout-cards .scg-content {
    border-top: 3px solid var(--scg-accent);
}

/* ========================================
   Theme: None (Inherit from WordPress theme)
   ======================================== */
.scg-theme-none {
    --scg-text: inherit;
    --scg-text-light: inherit;
    --scg-bg: transparent;
    --scg-bg-hover: transparent;
    --scg-border: currentColor;
}

.scg-theme-none .scg-title a {
    color: inherit;
}

.scg-theme-none .scg-meta,
.scg-theme-none .scg-excerpt {
    color: inherit;
    opacity: 0.7;
}

/* ========================================
   Theme: Dark
   ======================================== */
.scg-theme-dark {
    --scg-text: #f9fafb;
    --scg-text-light: #9ca3af;
    --scg-bg: #1f2937;
    --scg-bg-hover: #111827;
    --scg-border: #374151;
}

.scg-theme-dark .scg-style-flat .scg-item {
    background: #111827;
}

.scg-theme-dark .scg-carousel-btn {
    background: #374151;
    color: #f9fafb;
}

.scg-theme-dark .scg-carousel-btn:hover {
    background: var(--scg-accent);
}

/* ========================================
   Theme: Glass
   ======================================== */
.scg-theme-glass {
    --scg-bg: rgba(255, 255, 255, 0.15);
    --scg-border: rgba(255, 255, 255, 0.2);
}

.scg-theme-glass .scg-item {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--scg-border);
}

/* ========================================
   Animations
   ======================================== */
.scg-animation-fade .scg-item {
    opacity: 0;
    transform: none;
}
.scg-animation-fade .scg-item.scg-visible {
    opacity: 1;
}

.scg-animation-slide-up .scg-item {
    opacity: 0;
    transform: translateY(30px);
}
.scg-animation-slide-up .scg-item.scg-visible {
    opacity: 1;
    transform: translateY(0);
}

.scg-animation-slide-left .scg-item {
    opacity: 0;
    transform: translateX(-30px);
}
.scg-animation-slide-left .scg-item.scg-visible {
    opacity: 1;
    transform: translateX(0);
}

.scg-animation-scale .scg-item {
    opacity: 0;
    transform: scale(0.9);
}
.scg-animation-scale .scg-item.scg-visible {
    opacity: 1;
    transform: scale(1);
}

.scg-animation-none .scg-item {
    opacity: 1;
    transform: none;
    transition: box-shadow var(--scg-transition), border-color var(--scg-transition);
}

/* ========================================
   Empty State
   ======================================== */
.scg-empty {
    padding: 60px 40px;
    text-align: center;
    color: var(--scg-text-light);
    background: var(--scg-bg-hover);
    border-radius: var(--scg-radius);
    border: 2px dashed var(--scg-border);
}

.scg-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ========================================
   Filter Buttons
   ======================================== */
.scg-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.scg-filter-btn {
    padding: 8px 16px;
    font-size: var(--scg-meta-size);
    font-weight: 500;
    color: var(--scg-text-light);
    background: var(--scg-bg-hover);
    border: 1px solid var(--scg-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--scg-transition);
}

.scg-filter-btn:hover,
.scg-filter-btn.scg-active {
    color: #fff;
    background: var(--scg-accent);
    border-color: var(--scg-accent);
}

/* ========================================
   Responsive Breakpoints
   ======================================== */
@media (max-width: 1200px) {
    .scg-layout-featured .scg-item:first-child .scg-image {
        width: 50%;
    }
}

@media (max-width: 1024px) {
    .scg-items {
        grid-template-columns: repeat(min(var(--scg-cols), 2), 1fr);
    }
    
    .scg-layout-masonry .scg-items {
        column-count: min(var(--scg-cols), 2);
    }
    
    .scg-carousel-slide {
        flex: 0 0 calc(100% / min(var(--scg-carousel-slides, 1), 2));
    }
}

@media (max-width: 768px) {
    .scg-grid {
        --scg-content-padding: 16px;
    }
    
    .scg-layout-list .scg-item {
        flex-direction: column;
    }
    
    .scg-layout-list .scg-image {
        width: 100%;
        min-height: 180px;
    }
    
    .scg-layout-featured .scg-item:first-child {
        flex-direction: column;
    }
    
    .scg-layout-featured .scg-item:first-child .scg-image {
        width: 100%;
        min-height: 220px;
    }
    
    .scg-layout-featured .scg-item:first-child .scg-content {
        padding: var(--scg-content-padding);
    }
    
    .scg-carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    .scg-items {
        grid-template-columns: 1fr;
    }
    
    .scg-layout-masonry .scg-items {
        column-count: 1;
    }
    
    .scg-carousel-slide {
        flex: 0 0 100%;
    }
    
    .scg-layout-overlay .scg-item {
        min-height: 250px;
    }
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .scg-item {
        opacity: 1;
        transform: none;
        transition: box-shadow var(--scg-transition), border-color var(--scg-transition);
    }
    
    .scg-image img {
        transition: none;
    }
    
    .scg-carousel-track {
        transition: none;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .scg-grid {
        --scg-cols: 2;
    }
    
    .scg-item {
        opacity: 1;
        transform: none;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .scg-carousel-btn,
    .scg-carousel-dots,
    .scg-filters {
        display: none;
    }
}
