/**
 * WordPress Cards Group - Frontend Styles
 * 
 * Responsive, dark-mode friendly card grid layout
 * Using pure CSS with Tailwind-inspired utility approach
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    /* Colors */
    --wcg-bg-primary: #0f0f0f;
    --wcg-bg-card: #1a1a1a;
    --wcg-bg-card-hover: #222222;
    --wcg-border-color: rgba(255, 255, 255, 0.08);
    --wcg-border-color-hover: rgba(255, 255, 255, 0.15);
    --wcg-text-primary: #ffffff;
    --wcg-text-secondary: #cccccc;
    --wcg-text-muted: #888888;
    --wcg-accent: #6366f1;
    --wcg-accent-glow: rgba(99, 102, 241, 0.25);
    
    /* Spacing */
    --wcg-card-padding: 24px;
    --wcg-card-gap: 24px;
    --wcg-section-spacing: 48px;
    
    /* Typography */
    --wcg-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --wcg-title-size: 32px;
    --wcg-subtitle-size: 20px;
    --wcg-card-title-size: 20px;
    --wcg-card-desc-size: 16px;
    
    /* Border Radius */
    --wcg-radius: 12px;
    --wcg-radius-sm: 8px;
    
    /* Shadows */
    --wcg-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --wcg-shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --wcg-transition: all 0.25s ease;
}

/* Light mode overrides */
@media (prefers-color-scheme: light) {
    :root {
        --wcg-bg-primary: #f8f9fa;
        --wcg-bg-card: #ffffff;
        --wcg-bg-card-hover: #f8f9fa;
        --wcg-border-color: rgba(0, 0, 0, 0.08);
        --wcg-border-color-hover: rgba(0, 0, 0, 0.15);
        --wcg-text-primary: #1a1a1a;
        --wcg-text-secondary: #4a4a4a;
        --wcg-text-muted: #6b7280;
    }
}

/* ==========================================================================
   Card Group Section
   ========================================================================== */

.wcg-card-group {
    font-family: var(--wcg-font-family);
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--wcg-section-spacing) 20px;
    box-sizing: border-box;
}

.wcg-card-group *,
.wcg-card-group *::before,
.wcg-card-group *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Header Section
   ========================================================================== */

.wcg-header {
    text-align: center;
    margin-bottom: 40px;
}

.wcg-group-title {
    font-size: var(--wcg-title-size);
    font-weight: 700;
    color: var(--wcg-text-primary);
    margin: 0 0 12px 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.wcg-group-subtitle {
    font-size: var(--wcg-subtitle-size);
    font-weight: 400;
    color: var(--wcg-text-secondary);
    margin: 0;
    line-height: 1.5;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Cards Grid
   ========================================================================== */

.wcg-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--wcg-card-gap);
}

/* ==========================================================================
   Individual Card
   ========================================================================== */

.wcg-card {
    display: flex;
    flex-direction: column;
    background: var(--wcg-bg-card);
    border: 1px solid var(--wcg-border-color);
    border-radius: var(--wcg-radius);
    padding: var(--wcg-card-padding);
    transition: var(--wcg-transition);
    position: relative;
    overflow: hidden;
}

.wcg-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--wcg-accent), transparent);
    opacity: 0;
    transition: var(--wcg-transition);
}

.wcg-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--wcg-shadow-lg);
    border-color: var(--wcg-border-color-hover);
    background: var(--wcg-bg-card-hover);
}

.wcg-card:hover::before {
    opacity: 1;
}

/* ==========================================================================
   Card Icon
   ========================================================================== */

.wcg-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--wcg-accent), rgba(99, 102, 241, 0.7));
    border-radius: var(--wcg-radius-sm);
    color: #ffffff;
    font-size: 24px;
    box-shadow: 0 4px 12px var(--wcg-accent-glow);
}

.wcg-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcg-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.wcg-icon-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}

/* ==========================================================================
   Card Typography
   ========================================================================== */

.wcg-card-title {
    font-size: var(--wcg-card-title-size);
    font-weight: 600;
    color: var(--wcg-text-primary);
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.wcg-card-description {
    font-size: var(--wcg-card-desc-size);
    font-weight: 400;
    color: var(--wcg-text-secondary);
    margin: 0;
    line-height: 1.6;
    flex-grow: 1;
}

/* ==========================================================================
   Card Button
   ========================================================================== */

.wcg-card-button {
    display: inline-flex;
    align-items: center;
    align-self: flex-end;
    gap: 6px;
    margin-top: auto;
    padding-top: 16px;
    background: transparent;
    border: none;
    color: #3b82f6;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none !important;
    cursor: pointer;
    transition: var(--wcg-transition);
}

.wcg-card-button:hover {
    color: var(--wcg-accent);
    text-decoration: none !important;
    opacity: 0.8;
}

.wcg-card-button:focus,
.wcg-card-button:visited {
    text-decoration: none !important;
    outline: none;
}

.wcg-button-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 18px;
}

.wcg-card-button:hover .wcg-button-arrow {
    transform: translateX(4px);
}

/* ==========================================================================
   Error State
   ========================================================================== */

.wcg-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 16px 24px;
    border-radius: var(--wcg-radius-sm);
    font-size: 14px;
    text-align: center;
}

/* ==========================================================================
   Block Placeholder (Editor)
   ========================================================================== */

.wcg-block-placeholder {
    background: rgba(99, 102, 241, 0.05);
    border: 2px dashed var(--wcg-border-color);
    padding: 40px 24px;
    border-radius: var(--wcg-radius);
    text-align: center;
    color: var(--wcg-text-muted);
    font-size: 14px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Mobile: 1 column */
@media (max-width: 767px) {
    .wcg-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .wcg-card-group {
        padding: 32px 16px;
    }
    
    .wcg-group-title {
        font-size: 26px;
    }
    
    .wcg-group-subtitle {
        font-size: 17px;
    }
    
    .wcg-card {
        padding: 20px;
    }
    
    .wcg-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 16px;
    }
    
    .wcg-icon .dashicons,
    .wcg-icon svg {
        font-size: 24px;
        width: 24px;
        height: 24px;
    }
}

/* Tablet: 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
    .wcg-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3-4 columns */
@media (min-width: 1024px) {
    .wcg-cards {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* Large Desktop: Max 4 columns */
@media (min-width: 1200px) {
    .wcg-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================================================
   Animation Keyframes
   ========================================================================== */

@keyframes wcg-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wcg-card {
    animation: wcg-fade-in 0.4s ease-out;
}

.wcg-card:nth-child(1) { animation-delay: 0.05s; }
.wcg-card:nth-child(2) { animation-delay: 0.1s; }
.wcg-card:nth-child(3) { animation-delay: 0.15s; }
.wcg-card:nth-child(4) { animation-delay: 0.2s; }
.wcg-card:nth-child(5) { animation-delay: 0.25s; }
.wcg-card:nth-child(6) { animation-delay: 0.3s; }
.wcg-card:nth-child(7) { animation-delay: 0.35s; }
.wcg-card:nth-child(8) { animation-delay: 0.4s; }

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .wcg-card {
        animation: none;
        transition: none;
    }
    
    .wcg-card:hover {
        transform: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wcg-card-group {
        padding: 20px 0;
    }
    
    .wcg-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .wcg-card {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
    }
    
    .wcg-card:hover {
        transform: none;
        box-shadow: none;
    }
}


