/**
 * Course Slider Widget Styles
 * Version: 1.0.0
 */

/* =================================
   Widget Container
================================= */
.course-slider-widget {
    position: relative;
    margin: 0 auto;
    max-width: 100%;
    padding: 30px 0; /* Add vertical padding to prevent shadow cutoff */
    overflow: hidden; /* Prevent horizontal overflow */
}

/* Swiper container - control overflow properly */
.course-slider-widget .swiper {
    overflow: hidden; /* Hide horizontal overflow */
    padding: 20px 0 !important; /* Vertical padding only for shadows */
    margin: -20px 0; /* Compensate vertical padding */
}

/* Section Title */
.course-slider-title {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 40px;
    line-height: 1.2;
    color: #1a1a1a;
}

/* =================================
   Course Card
================================= */
.course-card {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    height: calc(100% - 30px); /* Account for margins */
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    margin: 15px 0; /* Vertical margin for shadow breathing room */
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2); /* Larger shadow on hover */
}

/* Swiper slide - ensure shadows aren't clipped */
.course-slider .swiper-slide {
    height: auto;
    padding: 15px 5px; /* Vertical padding for shadows, minimal horizontal */
    box-sizing: border-box;
}

.course-slider .swiper-wrapper {
    padding: 15px 0; /* Ensure wrapper has space for shadows */
    box-sizing: border-box;
}

/* Course Image */
.course-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.course-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

/* Course Content */
.course-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Course Badge (Top Title) */
.course-badge {
    display: inline-block;
    background: #f0f4ff;
    color: #4a7cff;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Course Title */
.course-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.4;
}

.course-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.3s ease;
}

.course-title a:hover {
    color: #4a7cff;
}

/* Course Excerpt */
.course-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: #666666;
    margin-bottom: 16px;
    flex: 1;
}

/* =================================
   Course Meta (Custom Fields)
================================= */
.course-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 16px 0;
    padding: 16px 0;
    border-top: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
}

.meta-item {
    font-size: 13px;
    color: #555;
}

.meta-item strong {
    display: block;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}

/* =================================
   Course Buttons
================================= */
.course-buttons {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
}

.course-buttons a {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    line-height: 1.4;
}

.course-buttons a i,
.course-buttons a svg {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: inherit; /* Inherit text color */
}

.course-buttons a svg path {
    fill: currentColor; /* Make SVG follow text color */
}

/* =================================
   Button Style Variations
================================= */

/* Outlined Style */
.view-btn.btn-outlined,
.enroll-btn.btn-outlined {
    background: transparent;
    color: #4a7cff;
    border: 2px solid #4a7cff;
}

.view-btn.btn-outlined:hover,
.enroll-btn.btn-outlined:hover {
    background: #4a7cff;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Filled Style */
.view-btn.btn-filled,
.enroll-btn.btn-filled {
    background: #4a7cff;
    color: #ffffff;
    border: 2px solid #4a7cff;
}

.view-btn.btn-filled:hover,
.enroll-btn.btn-filled:hover {
    background: #3461e6;
    border-color: #3461e6;
    transform: translateY(-1px);
}

/* Text Only Style */
.view-btn.btn-text,
.enroll-btn.btn-text {
    background: transparent;
    color: #4a7cff;
    border: 2px solid transparent;
    padding: 10px 12px;
}

.view-btn.btn-text:hover,
.enroll-btn.btn-text:hover {
    color: #3461e6;
    background: rgba(74, 124, 255, 0.1);
    transform: translateY(-1px);
}

/* Gradient Style */
.view-btn.btn-gradient,
.enroll-btn.btn-gradient {
    background: linear-gradient(135deg, #4a7cff 0%, #7ba3ff 100%);
    color: #ffffff;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.view-btn.btn-gradient::before,
.enroll-btn.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #3461e6 0%, #6890ff 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.view-btn.btn-gradient:hover::before,
.enroll-btn.btn-gradient:hover::before {
    opacity: 1;
}

.view-btn.btn-gradient:hover,
.enroll-btn.btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(74, 124, 255, 0.4);
}

/* Default fallback styles (backwards compatibility) */
.view-btn:not([class*="btn-"]) {
    background: transparent;
    color: #4a7cff;
    border: 2px solid #4a7cff;
}

.view-btn:not([class*="btn-"]):hover {
    background: #4a7cff;
    color: #ffffff;
    transform: translateY(-1px);
}

.enroll-btn:not([class*="btn-"]) {
    background: #4a7cff;
    color: #ffffff;
    border: 2px solid #4a7cff;
}

.enroll-btn:not([class*="btn-"]):hover {
    background: #3461e6;
    border-color: #3461e6;
    transform: translateY(-1px);
}

/* =================================
   Slider Controls
================================= */
.course-slider-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 40px;
    gap: 20px;
    flex-wrap: wrap;
}

/* Navigation Arrows */
.swiper-navigation {
    display: flex;
    gap: 12px;
}

.course-slider-widget .swiper-button-prev,
.course-slider-widget .swiper-button-next,
[id^="course-slider-prev-"],
[id^="course-slider-next-"] {
    position: static;
    width: 44px;
    height: 44px;
    margin: 0;
    background: #ffffff;
    border: 2px solid #e5e5e5;
    border-radius: 50%;
    color: #1a1a1a;
    transition: all 0.3s ease;
}

.course-slider-widget .swiper-button-prev::after,
.course-slider-widget .swiper-button-next::after,
[id^="course-slider-prev-"]::after,
[id^="course-slider-next-"]::after {
    font-size: 16px;
    font-weight: bold;
}

.course-slider-widget .swiper-button-prev:hover,
.course-slider-widget .swiper-button-next:hover,
[id^="course-slider-prev-"]:hover,
[id^="course-slider-next-"]:hover {
    background: #4a7cff;
    border-color: #4a7cff;
    color: #ffffff;
}

.course-slider-widget .swiper-button-prev.swiper-button-disabled,
.course-slider-widget .swiper-button-next.swiper-button-disabled,
[id^="course-slider-prev-"].swiper-button-disabled,
[id^="course-slider-next-"].swiper-button-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Pagination */
.course-slider-widget .swiper-pagination,
[id^="course-slider-pagination-"] {
    position: static;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.course-slider-widget .swiper-pagination-bullet,
[id^="course-slider-pagination-"] .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #d1d1d1;
    opacity: 1;
    transition: all 0.3s ease;
}

.course-slider-widget .swiper-pagination-bullet-active,
[id^="course-slider-pagination-"] .swiper-pagination-bullet-active {
    background: #4a7cff;
    width: 24px;
    border-radius: 5px;
}

/* Bottom CTA */
.bottom-cta {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.bottom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 32px;
    background: #4a7cff;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    line-height: 1.5;
}

.bottom-btn i,
.bottom-btn svg {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: inherit; /* Inherit text color */
}

.bottom-btn svg path {
    fill: currentColor; /* Make SVG follow text color */
}

.bottom-btn:hover {
    background: #3461e6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 124, 255, 0.4);
}

/* =================================
   Responsive Design
================================= */

/* Tablet */
@media (max-width: 991px) {
    .course-slider-title {
        font-size: 30px;
        margin-bottom: 30px;
    }

    .course-title {
        font-size: 18px;
    }

    .course-content {
        padding: 20px;
    }

    .course-slider-controls {
        margin-top: 30px;
    }

    .bottom-cta {
        flex: 1 0 100%;
        justify-content: center;
        order: 3;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .course-slider-title {
        font-size: 24px;
        margin-bottom: 24px;
    }

    .course-title {
        font-size: 16px;
    }

    .course-content {
        padding: 16px;
    }

    .course-excerpt {
        font-size: 13px;
    }

    .course-meta {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 12px 0;
        padding: 12px 0;
    }

    .meta-item {
        font-size: 12px;
    }

    .course-buttons {
        flex-direction: row;
        gap: 8px;
    }

    .course-buttons a {
        padding: 10px 14px;
        font-size: 13px;
        gap: 4px;
    }

    .course-buttons a i,
    .course-buttons a svg {
        font-size: 12px;
        width: 12px;
        height: 12px;
    }

    .course-slider-controls {
        flex-direction: column;
        align-items: center;
        margin-top: 24px;
        gap: 16px;
    }

    .swiper-navigation {
        order: 2;
    }

    .course-slider-widget .swiper-pagination {
        order: 1;
    }

    .bottom-cta {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .bottom-btn {
        font-size: 14px;
        padding: 12px 24px;
    }
}

/* =================================
   Animation Classes
================================= */
.course-card.aos-animate {
    animation: fadeInUp 0.6s ease-out;
}

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

/* Hover Effect Enhancements */
.course-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4a7cff, #7ba3ff);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.course-card:hover::before {
    transform: scaleX(1);
}

/* Loading State */
.course-slider-widget.loading {
    opacity: 0.5;
    pointer-events: none;
}

.course-slider-widget.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #e5e5e5;
    border-top-color: #4a7cff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
