/* RCL Paid Downloads Pro - Frontend Styles */

.rcl-files-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

/* На карточках каталога кнопка всегда у правого края */
.rcl-files-catalog .rcl-file-actions .rcl-buy-btn,
.rcl-files-catalog .rcl-file-actions .rcl-download-btn {
    margin-left: auto;
}

.rcl-file-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: transparent; /* убрали белый фон */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.rcl-file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.rcl-file-thumbnail {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
}

.rcl-file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rcl-file-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.rcl-file-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.rcl-file-content h3 a {
    text-decoration: none;
    color: #ff7a00 !important; /* оранжевый, перекрываем тему */
    transition: color .2s ease; /* плавный переход цвета */
}

.rcl-file-content h3 a:hover {
    color: #0073aa !important; /* голубой при наведении */
}

/* Дополнительная защита от переопределений темы */
.rcl-file-card .rcl-file-content h3,
.rcl-file-card .rcl-file-content h3 a {
    color: #ff7a00 !important;
}

.rcl-file-category {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    margin-bottom: 10px;
}

.rcl-file-excerpt {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 15px;
}

.rcl-file-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 12px;
    color: #888;
}

.rcl-file-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 12px;
    padding-bottom: 12px;
    margin-top: auto; /* прижимаем к низу карточки */
    min-height: 60px; /* фиксированная высота подвала */
}

/* На одиночной странице убираем разделитель в подвале */
.rcl-file-purchase-section .rcl-file-actions {
    border-top: none;
    justify-content: center;
    gap: 12px;
}

.rcl-price {
    font-size: 18px;
    font-weight: bold;
    color: #0073aa;
}

.rcl-buy-btn, .rcl-download-btn {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
    height: 36px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Перекрываем дефолтные стили WP .button, чтобы высота совпадала */
.rcl-file-actions .button.rcl-buy-btn,
.rcl-file-actions .button.rcl-download-btn {
    height: 36px;
    line-height: 36px;
    padding: 0 16px;
}

.rcl-buy-btn:hover, .rcl-download-btn:hover {
    background: #005a87;
    color: white;
}

/* На карточках (каталог) кнопку скачивания делаем зелёной, чтобы отличать от покупки */
.rcl-files-catalog .rcl-download-btn {
    background: #46b450;
}

.rcl-files-catalog .rcl-download-btn:hover {
    background: #398a3c;
}

.rcl-owned {
    color: #46b450;
    font-weight: bold;
}

/* На одиночной странице убираем фон/рамки у метки «Файл уже куплен» */
.rcl-file-purchase-section .rcl-owned {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: inline !important;
    color: #46b450 !important;
}

.rcl-login-required {
    color: #d63638;
    font-style: italic;
    margin: 0;
}

/* Single file page styles */
.rcl-file-purchase-section {
    border: none;
    border-radius: 8px;
    margin: 20px 0;
    padding-left: 24px;
    padding-right: 24px;
}

.rcl-file-owned {
    text-align: center;
}

.rcl-file-owned p {
    color: #46b450;
    font-size: 18px;
    margin-bottom: 15px;
}

.rcl-file-purchase {
    text-align: center;
}

.rcl-price-display {
    font-size: 24px;
    margin-bottom: 10px;
}

.rcl-balance {
    color: #666;
    margin-bottom: 20px;
}

.rcl-insufficient-funds {
    color: #d63638;
    margin-bottom: 15px;
}

.rcl-error {
    color: #d63638;
    background: #fff2f2;
    padding: 10px;
    border-radius: 4px;
    border-left: 4px solid #d63638;
}

.rcl-auth-required {
    text-align: center;
}

/* Скрываем в каталоге только сообщение о необходимости авторизации,
   а метку «Файл уже куплен» теперь показываем на карточке */
.rcl-files-catalog .rcl-login-required {
    display: none !important;
}

/* User files page */
.rcl-user-files {
    margin: 20px 0;
}

.rcl-user-file-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.rcl-user-file-item h4 {
    margin: 0 0 10px 0;
}

.rcl-user-file-item p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

/* Loading and success states */
.rcl-loading {
    opacity: 0.6;
    pointer-events: none;
}

.rcl-success-message {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid #c3e6cb;
}

.rcl-error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid #f5c6cb;
}

/* Responsive design */
@media (max-width: 768px) {
    .rcl-files-catalog {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .rcl-file-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .rcl-price {
        text-align: center;
    }
}

/* === FULL SINGLE PAGE OVERRIDE FOR paid_file === */

/* Оборачиваем контент одиночной страницы в свой блок, перекрывая стили темы
   Учитываем оба варианта body-класса: по типу записи и по слагу rewrite (files). */
.single-paid_file .post-content,
.single-files .post-content {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.single-paid_file .post-content .post-meta.up,
.single-paid_file .post-content .post-meta.down,
.single-files .post-content .post-meta.up,
.single-files .post-content .post-meta.down {
    font-size: 12px;
    color: #888 !important;
    margin-bottom: 10px;
}

/* Заголовок файла — свой стиль, без оформления темы */
.single-paid_file .post-content .post-title,
.single-paid_file .post-content .post-title a,
.single-files .post-content .post-title,
.single-files .post-content .post-title a,
/* усиливаем для конкретной разметки темы: h5.post-title */
.single-paid_file .post-content h5.post-title,
.single-paid_file .post-content h5.post-title a,
.single-files .post-content h5.post-title,
.single-files .post-content h5.post-title a {
    font-size: 24px !important;
    margin: 0 0 12px 0 !important;
    color: #333333 !important;
    background: transparent !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

/* Описание файла (первый абзац) — спокойный текст без жёстких стилей темы */
.single-paid_file .post-content > p:first-of-type,
.single-files .post-content > p:first-of-type {
    font-size: 15px !important;
    line-height: 1.6 !important;
    color: #333333 !important;
    margin: 0 0 18px 0 !important;
}

/* Центруем блок покупки и отделяем от описания */
.single-paid_file .rcl-file-purchase-section,
.single-files .rcl-file-purchase-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.single-paid_file .rcl-file-purchase,
.single-files .rcl-file-purchase {
    max-width: 640px;
    margin: 0 auto;
}

/* Метаданные над кнопками на single */
.single-paid_file .rcl-file-purchase .rcl-file-meta,
.single-files .rcl-file-purchase .rcl-file-meta {
    justify-content: center;
    flex-wrap: wrap;
}

.single-paid_file .rcl-file-purchase .rcl-file-meta .file-size,
.single-paid_file .rcl-file-purchase .rcl-file-meta .file-format,
.single-files .rcl-file-purchase .rcl-file-meta .file-size,
.single-files .rcl-file-purchase .rcl-file-meta .file-format {
    font-size: 13px;
}

/* Крупная цена и кнопка на single */
.single-paid_file .rcl-file-purchase .rcl-file-actions,
.single-files .rcl-file-purchase .rcl-file-actions {
    border-top: none;
    justify-content: center;
    gap: 16px;
}

.single-paid_file .rcl-file-purchase .rcl-price-display,
.single-files .rcl-file-purchase .rcl-price-display {
    font-size: 26px;
    font-weight: 600;
    color: #0073aa;
}

.single-paid_file .rcl-file-purchase .rcl-buy-btn,
.single-paid_file .rcl-file-purchase .rcl-download-btn,
.single-files .rcl-file-purchase .rcl-buy-btn,
.single-files .rcl-file-purchase .rcl-download-btn {
    height: 40px;
    padding: 0 24px;
    font-size: 15px;
}

@media (max-width: 768px) {
    .single-paid_file .post-content,
    .single-files .post-content {
        padding: 16px;
    }
    .single-paid_file .rcl-file-purchase .rcl-file-actions,
    .single-files .rcl-file-purchase .rcl-file-actions {
        flex-direction: column;
    }
}
