/* Responsive Layout Structure Fixes - Keep Card Designs Unchanged */
/* Only fix spacing, grid layouts, and container structures */

/* Small Laptop Screens - Add proper left/right spacing */
@media screen and (min-width: 1024px) and (max-width: 1366px) {
    /* Add side margins for small laptops */
    body {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
    
    /* Specific fixes for articles page */
    .max-w-\[1512px\] {
        max-width: 95% !important;
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
    
    /* Search form container spacing */
    .w-\[1394px\] {
        width: 90% !important;
        max-width: 1200px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    /* Ensure proper container spacing */
    .container {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* Tablet and Small Screen Layout Adjustments */
@media screen and (max-width: 1023px) {
    /* Articles page responsive grid - 2 cards per row on tablets */
    .articles-main-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
        justify-items: center !important;
    }
    
    /* Single column on mobile */
    @media screen and (max-width: 640px) {
        .articles-main-grid {
            grid-template-columns: 1fr !important;
            gap: 1rem !important;
        }
    }
    
    /* Categories grid - 2 per row on tablets, 1 on mobile */
    .categories-responsive-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    @media screen and (max-width: 640px) {
        .categories-responsive-grid {
            grid-template-columns: 1fr !important;
        }
    }
    
    /* Add proper container padding for tablets */
    .responsive-container {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
    
    /* Search form responsive adjustments */
    .search-form-responsive {
        width: 95% !important;
        max-width: none !important;
        padding: 1rem !important;
        height: auto !important;
        min-height: 120px !important;
    }
    
    .search-form-responsive form {
        flex-direction: column !important;
        gap: 0.75rem !important;
        align-items: stretch !important;
    }
    
    .search-input-responsive {
        width: 100% !important;
        max-width: none !important;
        height: 50px !important;
        font-size: 1rem !important;
        border-radius: 0.75rem !important;
    }
    
    .search-select-responsive {
        width: 100% !important;
        height: 50px !important;
        font-size: 1rem !important;
        border-radius: 0.75rem !important;
    }
    
    .search-button-responsive {
        width: 100% !important;
        height: 50px !important;
        font-size: 1rem !important;
        border-radius: 0.75rem !important;
    }
    
    /* Article cards responsive container */
    .article-card-responsive {
        max-width: 100% !important;
    }
    
    /* Course cards responsive */
    .courses-responsive-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
        justify-items: center !important;
    }
    
    @media screen and (max-width: 640px) {
        .courses-responsive-grid {
            grid-template-columns: 1fr !important;
            gap: 1rem !important;
        }
    }
}

/* Medium screens - ensure proper 2-card layout */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .articles-main-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem !important;
        justify-items: center !important;
    }
    
    .courses-responsive-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem !important;
        justify-items: center !important;
    }
    
    /* Ensure cards don't get too wide */
    .article-card-responsive {
        max-width: 400px !important;
    }
}

/* Container padding fixes for all screen sizes */
.responsive-container {
    padding-left: clamp(1rem, 3vw, 2rem) !important;
    padding-right: clamp(1rem, 3vw, 2rem) !important;
}

/* Prevent horizontal overflow */
.prevent-overflow {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* Ensure proper spacing on very small laptops */
@media screen and (min-width: 1024px) and (max-width: 1280px) {
    .container {
        max-width: 95% !important;
    }
}
