/**
 * Премиум стили для шорткода курсов [courses] и программ [programs]
 * Поддержка CSS-переменных для кастомизации под тему
 *
 * Кастомизация в теме (style.css дочерней темы или Additional CSS):
 *
 *   .courses-shortcode-premium {
 *     --csp-btn-gradient: linear-gradient(135deg, #ваш-цвет1, #ваш-цвет2);
 *     --csp-btn-color: #fff;
 *     --csp-btn-radius: 8px;
 *     --csp-more-radius: 10px;
 *   }
 *
 * Атрибуты шорткода: button_style="default|outline|minimal" theme_class="my-theme-buttons"
 * Пример: [courses button_style="outline" theme_class="mbs-theme"]
 *
 * @copyright Copyright (c) 2024 Кузьменко Валентин (Valentink2410)
 * @author Кузьменко Валентин (Valentink2410)
 */

/* Переменные (тема может переопределить через :root или .courses-shortcode-premium) */
.courses-shortcode-premium {
    --csp-btn-gradient: linear-gradient(135deg, #8B2D3D 0%, #68202D 100%);
    --csp-btn-color: #fff;
    --csp-btn-border: #68202D;
    --csp-btn-radius: 12px;
    --csp-more-radius: 14px;
    --csp-btn-shadow: 0 4px 15px rgba(104, 32, 45, 0.4);
    --csp-btn-shadow-hover: 0 8px 25px rgba(104, 32, 45, 0.5);
}

.courses-shortcode-premium {
    padding: 20px 0 40px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Сетка */
.csp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Карточка */
.csp-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.csp-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

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

/* Изображение */
.csp-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #8B2D3D 0%, #68202D 100%);
}

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

.csp-card:hover .csp-card-image img {
    transform: scale(1.08);
}

.csp-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
}

/* Бейджи на фото */
.csp-badge-discount {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 6px 12px;
    background: #f5576c;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    border-radius: 20px;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.csp-badge-spec {
    position: absolute;
    bottom: 14px;
    left: 14px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    color: #2d3748;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    z-index: 2;
    max-width: calc(100% - 28px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Контент */
.csp-card-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Теги (уровень, дата) */
.csp-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.csp-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.csp-tag-level {
    background: rgba(104, 32, 45, 0.1);
    color: #68202D;
}

.csp-tag-date {
    background: rgba(67, 233, 123, 0.1);
    color: #38a169;
}

.csp-tag svg {
    flex-shrink: 0;
}

/* Заголовок */
.csp-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.4;
    color: #1a202c;
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.csp-card:hover .csp-card-title {
    color: #68202D;
}

/* Описание */
.csp-card-excerpt {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #718096;
    margin: 0 0 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Преподаватель */
.csp-card-teacher {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f5;
}

.csp-teacher-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e8eaf6;
    flex-shrink: 0;
}

.csp-teacher-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(104, 32, 45, 0.1);
    color: #68202D;
}

.csp-teacher-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4a5568;
}

/* Подвал карточки */
.csp-card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    flex-wrap: wrap;
}

.csp-card-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.csp-price-old {
    font-size: 0.8125rem;
    color: #a0aec0;
    text-decoration: line-through;
}

.csp-price-current {
    font-size: 1.25rem;
    font-weight: 800;
    color: #68202D;
}

.csp-price-free {
    font-size: 1rem;
    font-weight: 700;
    color: #38a169;
}

.csp-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.csp-star {
    color: #f6ad55;
    font-size: 1rem;
}

.csp-rating-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: #2d3748;
}

.csp-rating-count {
    font-size: 0.75rem;
    color: #a0aec0;
}

.csp-duration {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    color: #718096;
    margin-left: auto;
}

.csp-duration svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* Кнопка hover */
.csp-card-hover-action {
    padding: 0 22px 22px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.csp-card:hover .csp-card-hover-action {
    opacity: 1;
    transform: translateY(0);
}

.csp-btn {
    display: block;
    text-align: center;
    padding: 12px;
    background: var(--csp-btn-gradient);
    color: var(--csp-btn-color);
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--csp-btn-radius);
    transition: box-shadow 0.3s ease;
}

.csp-card:hover .csp-btn {
    color: #fff;
    box-shadow: var(--csp-btn-shadow-hover);
}

/* Ссылка «Все курсы» / «Все программы» */
.csp-more {
    text-align: center;
    margin-top: 36px;
}

.csp-more-link {
    display: inline-block;
    padding: 14px 36px;
    background: var(--csp-btn-gradient);
    color: var(--csp-btn-color);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    border-radius: var(--csp-more-radius);
    transition: all 0.3s ease;
    box-shadow: var(--csp-btn-shadow);
}

.csp-more-link:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--csp-btn-shadow-hover);
}

/* Вариант outline — кнопки с обводкой */
.courses-shortcode-premium.csp-style-outline .csp-btn,
.courses-shortcode-premium.csp-style-outline .csp-more-link {
    background: transparent;
    border: 2px solid var(--csp-btn-border);
    color: var(--csp-btn-border);
    box-shadow: none;
}

.courses-shortcode-premium.csp-style-outline .csp-card:hover .csp-btn {
    background: var(--csp-btn-gradient);
    border-color: transparent;
    color: #fff;
}

.courses-shortcode-premium.csp-style-outline .csp-more-link:hover {
    background: var(--csp-btn-gradient);
    border-color: transparent;
    color: #fff;
}

/* Вариант minimal — простые ссылки без фона */
.courses-shortcode-premium.csp-style-minimal .csp-btn {
    background: transparent;
    color: #68202D;
    box-shadow: none;
}

.courses-shortcode-premium.csp-style-minimal .csp-card:hover .csp-btn {
    color: #fff;
}

.courses-shortcode-premium.csp-style-minimal .csp-more-link {
    background: transparent;
    color: #68202D;
    box-shadow: none;
}

.courses-shortcode-premium.csp-style-minimal .csp-more-link:hover {
    color: #fff;
    text-decoration: underline;
}

/* theme — передаёт оформление теме (базовые стили, тема переопределяет) */
.courses-shortcode-premium.csp-style-theme .csp-btn,
.courses-shortcode-premium.csp-style-theme .csp-more-link {
    /* Минимум стилей — тема добавляет свои через .theme_class */
    background: var(--csp-btn-gradient);
}

/* Пустое состояние */
.csp-empty {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
}

.csp-empty svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.csp-empty p {
    font-size: 1.125rem;
    margin: 0;
}

/* ============================
   Адаптивность
   ============================ */
@media (max-width: 1024px) {
    .csp-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .csp-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    .csp-card-image {
        height: 170px;
    }

    .csp-card-body {
        padding: 18px;
    }

    .csp-card-title {
        font-size: 1rem;
    }

    .csp-card-hover-action {
        opacity: 1;
        transform: translateY(0);
        padding: 0 18px 18px;
    }
}

@media (max-width: 480px) {
    .csp-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .csp-card-image {
        height: 200px;
    }

    .csp-card-body {
        padding: 20px;
    }

    .csp-card-title {
        font-size: 1.0625rem;
    }
}
