/**
 * Courses Grid Styles
 * Following design colors and layout with hover enlarge effects
 */

/* Design colors from the mockup */
:root {
    --green-primary: #006a3c;
    --orange-accent: #f7b119;
    --light-gray: #f5f6f6;
    --dark-text: #252525;
    --light-green: #b0cfc1;
    --white: #ffffff;
}

.courses-section {
    padding: 60px 0;
    width: 100%;
    font-family: 'Roboto', sans-serif;
    overflow: hidden;
}

.courses-header {
    text-align: center;
    margin-bottom: 50px;
}

.courses-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--dark-text);
    margin: 0;
    line-height: 1.2;
}

.courses-slider-container {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.courses-grid {
    display: flex;
    transition: transform 0.5s ease-in-out;
    margin-left: 0; /* Start with no margin - JS will handle positioning */
}

/* Smooth transitions */
.courses-grid.transitioning {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.course-slide {
    flex-shrink: 0;
    min-height: 400px;
    padding: 0 10px;
    box-sizing: border-box;
}

/* Responsive course slide widths */
/* Mobile devices - show only 1 course */
@media (max-width: 768px) {
    .course-slide {
        width: 100%;
        padding: 0; /* NO padding on slide - keeps width calculation clean */
        margin: 0; /* No margin between slides */
        box-sizing: border-box;
        flex-shrink: 0;
    }
    
    .courses-slider-container {
        padding: 0; /* No container padding */
        overflow: hidden; /* Ensure overflow is hidden */
    }
    
    .courses-grid {
        margin: 0; /* No margin on grid */
        padding: 0; /* No padding on grid */
    }
    
    .course-item {
        width: 100%;
        margin: 0;
        padding: 0 15px; /* Visual spacing applied HERE instead of on slide */
        box-sizing: border-box;
    }
    
    .course-card {
        /* Card is inside course-item, so it inherits the padding spacing */
    }
}

/* Small tablets - show 2 courses */
@media (min-width: 769px) and (max-width: 1024px) {
    .course-slide {
        width: calc(100% / 2);
        padding: 0 10px;
    }
}

/* Tablets - show 3 courses */
@media (min-width: 1025px) and (max-width: 1200px) {
    .course-slide {
        width: calc(100% / 3);
        padding: 0 10px;
    }
}

/* Desktop - show 4 courses */
@media (min-width: 1201px) and (max-width: 1400px) {
    .course-slide {
        width: calc(100% / 4);
        padding: 0 10px;
    }
    
    .courses-slider-container {
        padding: 0;
    }
    
    .courses-grid {
        margin-left: 0; /* No margin on desktop */
    }
}

@media (min-width: 1401px) {
    .course-slide {
        width: calc(100% / 5);
        padding: 0 10px;
    }
    
    .courses-slider-container {
        padding: 0;
    }
    
    .courses-grid {
        margin-left: 0; /* No margin on extra large screens */
    }
}

.course-item {
    position: relative;
    transition: all 0.3s ease;
}

.course-card {
    position: relative;
    background: var(--white);
    overflow: hidden;
    height: auto; /* Changed from fixed 500px to auto to match image size */
    min-height: 350px; /* Minimum height for consistency - increased for bigger images */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.course-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.course-image-container {
    position: relative;
    width: 100%;
    flex-grow: 1; /* Take up available space */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px; /* Minimum height for consistency - increased for bigger images */
}

.course-image {
    width: 100%;
    height: auto; /* Let height adjust to maintain aspect ratio */
    object-fit: contain; /* Show full image without cropping */
    object-position: center;
    transition: transform 0.3s ease;
    
    /* Ensure images fit properly regardless of aspect ratio */
    max-width: 100%;
    display: block;
}

/* Alternative: If you prefer to fill the container and crop if needed, use this instead */
.course-image.fill-container {
    object-fit: cover; /* Fills container, may crop image */
}

/* For very wide images, prioritize height */
.course-image.wide-image {
    width: auto;
    height: 100%;
    max-width: 100%;
}

/* For very tall images, prioritize width */
.course-image.tall-image {
    width: 100%;
    height: auto;
    max-height: 100%;
}

.course-card:hover .course-image {
    transform: scale(1.1);
}

.course-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--light-green), var(--green-primary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-placeholder-text {
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 600;
}

.course-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    padding: 30px 20px 20px;
    color: var(--white);
    transition: all 0.3s ease;
}

.course-card:hover .course-overlay {
    background: linear-gradient(to top, rgba(0, 106, 60, 0.9) 0%, rgba(0, 106, 60, 0.6) 50%, transparent 100%);
}

.course-name {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1.3;
    margin: 0;
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    text-align: center; /* Center align the course name */
    width: 100%;
}

.course-card:hover .course-name {
    transform: translateY(-5px);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
}

.courses-navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.course-nav {
    background: transparent;
    border: none;
    padding: 0;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-nav:hover {
    transform: translateY(-2px);
}

.course-nav:active {
    transform: translateY(0);
}

.course-nav img {
    width: 50px;
    height: 50px;
    transition: transform 0.3s ease;
}

.course-nav:hover img {
    transform: scale(1.1);
}

.course-nav.disabled,
.course-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.course-nav.disabled:hover,
.course-nav:disabled:hover {
    transform: none;
    background: transparent;
}

/* Enhanced hover effects for better visual feedback */
.course-item:hover {
    z-index: 20;
}

.course-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--green-primary), var(--orange-accent));
    border-radius: 14px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Loading state */
.courses-section.loading .course-card {
    opacity: 0.7;
    pointer-events: none;
}

/* Accessibility 

.course-nav:focus {
    outline: 3px solid var(--orange-accent);
    outline-offset: 2px;
}
 */

.course-card:focus {
    outline: 3px solid var(--orange-accent);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .course-card {
        border: 2px solid var(--dark-text);
    }
    
    .course-nav {
        border: 2px solid var(--dark-text);
    }
    
    .course-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .course-card,
    .course-image,
    .course-overlay,
    .course-name,
    .course-nav,
    .course-item {
        transition: none;
    }
    
    .course-card:hover {
        transform: none;
    }
    
    .course-card:hover .course-image {
        transform: none;
    }
}

/* Print styles */
@media print {
    .courses-navigation {
        display: none;
    }
    
    .courses-grid {
        display: block;
    }
    
    .course-item {
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .course-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .courses-section {
        padding: 40px 0;
    }
    
    .courses-title {
        font-size: 2rem;
    }
    
    .courses-grid {
        gap: 15px;
        padding: 0 15px;
    }
    
    .course-card {
        height: auto; /* Let mobile cards also adjust to image size */
        min-height: 280px; /* Increased minimum height for mobile - bigger images */
    }
    
    .course-name {
        font-size: 1.1rem;
        text-align: center; /* Ensure center alignment on mobile too */
        padding: 0 10px; /* Add some padding for better mobile display */
    }
    
    .courses-navigation {
        margin-top: 30px;
    }
    
}


