/* Main Courses - Redesign згідно скріншота (10% + 80% + 10%) */

/* ==================== СЕКЦІЯ ==================== */
.main-courses-section {
    background: transparent;
    padding: 0;
    position: relative;
}

.main-courses-section .section-content {
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .main-courses-section {
    background: transparent;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .main-courses-section {
        background: transparent;
    }
}

/* ==================== HEADER З НАВІГАЦІЄЮ ==================== */
/* Використовує загальну систему ширини */
.main-courses-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
}

.main-courses-header .section-title {
    color: #2a2a2a;
    font-size: 2.5rem;
    font-weight: 700;
    text-align: left;
    margin: 0;
    text-shadow: none;
}

[data-theme="dark"] .main-courses-header .section-title {
    color: var(--color-text);
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .main-courses-header .section-title {
        color: var(--color-text);
    }
}

/* ==================== КНОПКИ НАВІГАЦІЇ ==================== */
.main-courses-navigation {
    display: flex;
    gap: 12px;
}

.course-nav-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #171717;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.course-nav-btn:hover:not(:disabled) {
    background: #171717;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.course-nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

[data-theme="dark"] .course-nav-btn {
    background: #e9e9e9;
    color: #000000;
}

[data-theme="dark"] .course-nav-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .course-nav-btn {
        background: #e9e9e9;
        color: #000000;
    }

    [data-theme="auto"] .course-nav-btn:hover:not(:disabled) {
        background: #f0f0f0;
    }
}

.course-nav-btn svg {
    max-width: 24px;
    max-height: 24px;
}

/* ==================== КАРУСЕЛЬ КОНТЕЙНЕР ==================== */
/* Використовує загальну систему ширини */
.main-courses-carousel-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.main-courses-carousel {
    overflow: hidden;
    position: relative;
}

.main-courses-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 24px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== СЛАЙД ==================== */
.main-course-slide {
    flex: 0 0 calc(25% - 18px);
    width: calc(25% - 18px);
    min-width: calc(25% - 18px);
    max-width: calc(25% - 18px);
}

/* ==================== КАРТКА КУРСУ (НОВА СТРУКТУРА) ==================== */
.main-course-card {
    background: transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.main-course-card:hover {
    transform: translateY(-4px);
}

/* ==================== ВЕРХ 10% (ПРОЗОРИЙ ФОН) ==================== */
.course-card-top {
    padding: 12px 12px 8px 12px;
    background: transparent;
    min-height: 10%;
}

/* НАЗВА КУРСУ */
.course-title {
    font-size: 0.875rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

[data-theme="dark"] .course-title {
    color: #ffffff;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .course-title {
        color: #ffffff;
    }
}

/* ==================== ЗОБРАЖЕННЯ 80% ЗІ СКРУГЛЕНИМИ КУТАМИ ==================== */
.course-image-wrapper {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

.course-image {
    width: 100%;
    aspect-ratio: 1 / 1.01;
    border-radius: 12px;
    overflow: hidden;
    background: transparent;
    position: relative;
}

.course-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    background: transparent;
    transition: transform 0.3s ease;
}

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

.course-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
}

[data-theme="dark"] .course-image-placeholder {
    background: linear-gradient(135deg, #171717 0%, #171717 100%);
}

[data-theme="dark"] .course-image {
    background: transparent;
}

[data-theme="dark"] .course-image img {
    background: transparent;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .course-image-placeholder {
        background: linear-gradient(135deg, #171717 0%, #171717 100%);
    }
    
    [data-theme="auto"] .course-image {
        background: transparent;
    }
    
    [data-theme="auto"] .course-image img {
        background: transparent;
    }
}

/* ==================== КНОПКА "ОГЛЯД КУРСУ" З БІЛИМ ЛОГОТИПОМ ==================== */
.course-btn {
    position: absolute;
    bottom: 25px;
    left: 5px;
    background: #e9e9e9;
    border: none;
    border-radius: 50px;
    padding: 1px 12px 1px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.75rem;
    font-family: 'Roboto', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    min-height: 38px;
    overflow: visible;
}

.course-btn:hover {
    background: #f8f8f8;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
    text-decoration: none;
}

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

.course-btn-text {
    display: inline-block;
    color: #1a1a1a;
    line-height: 1.2;
}

.course-btn-arrow {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: url('/static/images/white_botton.png') no-repeat center center;
    background-size: contain;
}

/* ==================== НИЗ 10% (ПРОЗОРИЙ ФОН) ==================== */
.course-card-bottom {
    padding: 8px 12px 12px 12px;
    background: transparent;
    min-height: calc(0.75rem * 1.5 * 2 + 20px);
}

/* ОПИС КУРСУ */
.course-description {
    font-size: 0.75rem;
    font-family: 'Roboto', sans-serif;
    color: #666666;
    line-height: 1.5;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: calc(0.75rem * 1.5 * 2);
}

[data-theme="dark"] .course-description {
    color: #999999;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .course-description {
        color: #999999;
    }
}

/* ==================== ПОРОЖНІЙ СТАН ==================== */
.no-main-courses {
    text-align: center;
    padding: 60px 20px;
    color: #666666;
    font-size: 1.125rem;
    font-family: 'Roboto', sans-serif;
}

[data-theme="dark"] .no-main-courses {
    color: #999999;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .no-main-courses {
        color: #999999;
    }
}

/* ==================== ADAPTIVE TABLET (769px - 1024px) ==================== */
@media (min-width: 768px) and (max-width: 1024px) {
    .main-course-slide {
        flex: 0 0 calc(33.333% - 14px);
        width: calc(33.333% - 14px);
        min-width: calc(33.333% - 14px);
        max-width: calc(33.333% - 14px);
    }

    .main-courses-header .section-title {
        font-size: 2.25rem;
    }
}

/* ==================== ADAPTIVE MOBILE (до 768px) ==================== */

/* ==================== ADAPTIVE MOBILE (< 576px) ==================== */
@media (max-width: 767px) {
    .main-courses-section {
        padding: 0;
    }

    .main-courses-header {
        display: contents;
    }

    .main-courses-header .section-title {
        font-size: 1.75rem;
        order: 1;
        margin-bottom: 16px;
    }

    .main-courses-carousel-container {
        order: 2;
    }

    .main-courses-navigation {
        order: 3;
        align-self: center;
        width: fit-content;
        padding-top: 20px;
    }

    .course-nav-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .course-nav-btn svg {
        width: 18px;
        height: 18px;
    }

    .main-course-slide {
        flex: 0 0 calc(50% - 6px);
        width: calc(50% - 6px);
        min-width: calc(50% - 6px);
        max-width: calc(50% - 6px);
    }

    .main-courses-track {
        gap: 12px;
    }

    .course-card-top {
        display: block;
        padding: 6px 6px 4px 6px;
    }

    .course-card-top .course-title {
        font-size: 0.55rem;
        font-family: 'Roboto', sans-serif;
        line-height: 1.2;
        -webkit-line-clamp: 1;
    }

    .course-card-bottom {
        display: none;
    }

    .course-image-wrapper {
        flex: 1;
    }

    .course-btn {
        padding: 6px 10px 6px 12px;
        font-size: 0.625rem;
        font-family: 'Roboto', sans-serif;
        min-height: 30px;
        gap: 4px;
        bottom: 12px;
        left: 12px;
    }

    .course-btn-arrow {
        width: 14px;
        height: 14px;
    }
}

/* ==================== iOS SAFARI ОПТИМІЗАЦІЯ ==================== */
@supports (-webkit-touch-callout: none) {
    .course-nav-btn {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    .course-btn {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    .main-course-card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
    .main-courses-track {
        transition: none;
    }

    .main-course-card,
    .course-image img,
    .course-nav-btn,
    .course-btn {
        transition: none;
    }
}