/* ============================================
   HUB CAROUSEL - Featured courses carousel
   ============================================ */

.hub-featured-section {
    padding: var(--spacing-xl);
}

.hub-featured-section .section-content {
    overflow-x: hidden;  /* Desktop - приховати overflow */
    position: relative;
}

.hub-featured-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.hub-featured-nav {
    display: flex;
    gap: var(--spacing-sm);
}

/* Кнопки навігації (скопійовано з main-courses-redesign.css) */
.hub-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);
}

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

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

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

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

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

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

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

/* Carousel Container */
.hub-featured-carousel {
    display: flex;
    overflow: visible;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    gap: 48px;
    padding-bottom: 20px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    box-sizing: border-box;
    overscroll-behavior-x: contain;
}

/* Featured Card */
.hub-featured-card {
    min-width: 95%;
    max-width: 95%;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    gap: var(--spacing-lg);
    background: var(--hub-bg-card);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: var(--spacing-lg);
    box-sizing: border-box;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    position: relative;
}

/* Бейджі для featured карток */
.hub-featured-badges {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
}

.hub-featured-content {
    border: 1px solid var(--hub-border);
    border-radius: 16px;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
}

[data-theme="dark"] .hub-featured-card {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .hub-featured-content {
    border-color: var(--hub-border);
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .hub-featured-card {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
    
    [data-theme="auto"] .hub-featured-content {
        border-color: var(--hub-border);
    }
}

.hub-featured-title {
    color: var(--hub-text);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: left;
    margin-bottom: 12px;
    text-shadow: none;
}

.hub-featured-subtitle {
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--hub-text);
    margin-bottom: var(--spacing-md);
    white-space: pre-line;
}

.hub-featured-description {
    font-size: 0.875rem;
    color: var(--hub-text-light);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
    flex: 1;
    white-space: pre-line;
}

.hub-featured-meta {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--hub-text);
    margin-bottom: var(--spacing-sm);
}

.hub-featured-divider {
    width: 100%;
    height: 1px;
    background: #000000;
    margin: 0 0 var(--spacing-md) 0;
}

[data-theme="dark"] .hub-featured-divider {
    background: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .hub-featured-divider {
        background: #FFFFFF;
    }
}

.hub-featured-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.hub-featured-price {
    background: var(--hub-bg-card);
    border: 1px solid var(--hub-border);
    border-radius: 8px;
    padding: 12px 12px;
    font-size: 1.125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
    min-width: 140px;
}

.hub-featured-price:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    text-decoration: none;
}

.hub-featured-price .price-label {
    color: var(--hub-text);
}

.hub-featured-price .price-value {
    color: var(--hub-primary);
}

/* Ціна зі знижкою у featured */
.hub-featured-price.has-discount {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.hub-featured-price .hub-price-old {
    font-size: 0.875rem;
    color: var(--hub-text-light);
    text-decoration: line-through;
}

.hub-featured-price .hub-price-new {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.hub-featured-price .hub-price-new .price-value {
    font-size: 1.25rem;
}

[data-theme="dark"] .hub-featured-price {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .hub-featured-price:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .hub-featured-price {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }
    
    [data-theme="auto"] .hub-featured-price:hover {
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    }
}

.hub-favorite-btn {
    background: #000000;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-width: 48px;
    width: 48px;
    height: 48px;
}

.hub-favorite-btn:hover {
    background: #333333;
    transform: translateY(-1px);
}

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

.hub-favorite-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    transition: all 0.3s ease;
}

.hub-favorite-btn[data-favorited="true"] svg {
    fill: #FF4444;
    stroke: #FF4444;
}

.hub-favorite-btn:hover svg {
    transform: scale(1.1);
}

[data-theme="dark"] .hub-favorite-btn {
    background: #FFFFFF;
    color: #000000;
}

[data-theme="dark"] .hub-favorite-btn:hover {
    background: #E0E0E0;
}

[data-theme="dark"] .hub-favorite-btn[data-favorited="true"] svg {
    fill: #FF4444;
    stroke: #FF4444;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .hub-favorite-btn {
        background: #FFFFFF;
        color: #000000;
    }
    
    [data-theme="auto"] .hub-favorite-btn:hover {
        background: #E0E0E0;
    }
    
    [data-theme="auto"] .hub-favorite-btn[data-favorited="true"] svg {
        fill: #FF4444;
        stroke: #FF4444;
    }
}

.hub-featured-image {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    flex: 1;
    min-width: 0;
}

.hub-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hub-featured-counter {
    position: absolute;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hub-featured-counter span {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.8;
}

.hub-no-featured {
    text-align: center;
    padding: var(--spacing-xxl);
    color: var(--hub-text-light);
}

/* ============================================
   TOGGLE DESCRIPTION - За замовчуванням прихований
   ============================================ */

.hub-featured-toggle {
    display: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .hub-featured-card {
        flex-direction: column;
        gap: var(--spacing-lg);
    }
    
    .hub-featured-image {
        aspect-ratio: 1 / 1;
        width: 100%;
    }
}

@media (max-width: 768px) {
    /* Дозволити стрілкам виступати на мобільних */
    .hub-featured-section .section-content {
        overflow: visible;
    }
    
    .hub-featured-badges {
        top: 12px;
        left: 12px;
    }
    
    .hub-featured-title {
        font-size: 1.25rem;
        margin-bottom: 10px;
    }
    
    .hub-featured-card {
        padding: var(--spacing-md);
        border-radius: 12px;
        gap: var(--spacing-md);
    }
    
    .hub-featured-content {
        border-radius: 12px;
        padding: var(--spacing-sm);
    }
    
    /* Прибираємо відступ після subtitle на мобільних */
    .hub-featured-subtitle {
        margin-bottom: 0;
    }
    
    .hub-featured-footer {
        flex-direction: row;
        gap: var(--spacing-md);
        align-items: center;
        justify-content: space-between;
    }
    
    .hub-featured-price {
        flex: 1;
        justify-content: center;
    }
    
    .hub-favorite-btn {
        flex-shrink: 0;
    }
    
    /* === TOGGLE DESCRIPTION (мобільні) === */
    
    /* Показуємо кнопку toggle */
    .hub-featured-toggle {
        display: inline-flex;
        align-items: center;
        background: transparent;
        border: none;
        color: var(--hub-primary);
        font-size: 0.875rem;
        font-weight: 600;
        cursor: pointer;
        padding: 4px 0;
        margin-top: 2px;
        margin-bottom: var(--spacing-sm);
        transition: opacity 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .hub-featured-toggle:active {
        opacity: 0.6;
    }
    
    /* Wrapper для згортання/розгортання */
    .hub-featured-description-wrapper {
        display: grid;
        grid-template-rows: 0fr;
        transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
    }
    
    /* Розгорнутий стан */
    .hub-featured-description-wrapper.expanded {
        grid-template-rows: 1fr;
    }
    
    /* Description всередині wrapper */
    .hub-featured-description-wrapper > .hub-featured-description {
        min-height: 0;
        overflow: hidden;
        flex: none;
        margin-bottom: 0;
    }
    
    /* Відступ тільки коли розгорнуто */
    .hub-featured-description-wrapper.expanded > .hub-featured-description {
        margin-bottom: var(--spacing-md);
    }
}

/* iOS Safari оптимізація */
@supports (-webkit-touch-callout: none) {
    /* Переконатися що overflow visible на iOS */
    .hub-featured-section,
    .hub-featured-section .section-content {
        overflow: visible !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* GPU прискорення для зображень */
    .hub-featured-image {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .hub-featured-image img {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Оптимізація кнопок навігації */
    .hub-nav-btn {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        appearance: none;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        transform: translateZ(0);
    }
    
    /* Карусель */
    .hub-featured-carousel {
        -webkit-overflow-scrolling: touch;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

