/* Стили для страницы управления курсами */

/* Контейнер управления курсами */
.courses-management {
    padding: 20px;
}

/* Строка фильтрации и кнопка создания */
.courses-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Форма поиска */
.search-form {
    flex: 1;
    max-width: 500px;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-container input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 0;
}

.clear-search {
    position: absolute;
    right: 40px;
    color: #999;
}

.clear-search:hover {
    color: #333;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
}

.btn svg {
    margin-right: 8px;
}

.btn-primary {
    background-color: #4a6fdc;
    color: white;
}

.btn-primary:hover {
    background-color: #3a5fc0;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Таблица курсов */
.courses-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: auto;
}

.courses-table {
    width: 100%;
    border-collapse: collapse;
}

.courses-table th {
    background-color: #f5f7fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
}

.courses-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.courses-table tr:last-child td {
    border-bottom: none;
}

.courses-table tr:hover {
    background-color: #f9f9f9;
}

.text-center {
    text-align: center;
}

/* Статус курса */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.published {
    background-color: #e6f7e6;
    color: #28a745;
}

.status-badge.draft {
    background-color: #f7f7e7;
    color: #ffc107;
}

/* Ячейка с действиями */
.actions-cell {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-view, .btn-edit, .btn-delete {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.btn-view {
    background-color: #e7f0fd;
    color: #4a6fdc;
}

.btn-view:hover {
    background-color: #d7e3f7;
}

.btn-edit {
    background-color: #e9f8ee;
    color: #28a745;
}

.btn-edit:hover {
    background-color: #d9eee0;
}

.btn-delete {
    background-color: #ffebee;
    color: #dc3545;
}

.btn-delete:hover {
    background-color: #f8d7da;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    gap: 5px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination-btn.active {
    background-color: #4a6fdc;
    color: white;
    border-color: #4a6fdc;
}

.pagination-btn:hover:not(.active) {
    background-color: #f5f5f5;
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    color: #777;
}

/* Сообщение об отсутствии курсов */
.no-courses {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
}

.no-courses svg {
    color: #ccc;
    margin-bottom: 20px;
}

.no-courses p {
    margin-bottom: 15px;
    color: #666;
}

/* Модальное окно подтверждения удаления */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #777;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin-bottom: 10px;
}

.modal-body .warning {
    color: #dc3545;
    font-size: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    gap: 10px;
}

/* Адаптивность */
@media (max-width: 992px) {
    .courses-table th:nth-child(3),
    .courses-table td:nth-child(3),
    .courses-table th:nth-child(4),
    .courses-table td:nth-child(4),
    .courses-table th:nth-child(7),
    .courses-table td:nth-child(7) {
        display: none;
    }
}

@media (max-width: 768px) {
    .courses-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-form {
        max-width: 100%;
    }

    .courses-table th:nth-child(5),
    .courses-table td:nth-child(5) {
        display: none;
    }

    .actions-cell {
        flex-wrap: wrap;
    }
}

/* ============================================================
   Фильтры
   ============================================================ */
.courses-filters {
    margin-bottom: 20px;
}

.courses-filters-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.courses-filters-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.filter-select {
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    color: #333;
}

.filter-select:focus {
    outline: none;
    border-color: #4a6fdc;
}

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ============================================================
   Колонки таблицы
   ============================================================ */
.col-logo    { width: 52px; }
.col-title   { min-width: 180px; }
.col-author  { min-width: 120px; }
.col-topics  { width: 80px; }
.col-level   { width: 130px; }
.col-status  { width: 110px; }
.col-subs    { width: 90px; }
.col-actions { width: 110px; }

.courses-table th.sortable a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
}

.courses-table th.sortable a:hover { color: #4a6fdc; }

.sort-icon          { opacity: 0.4; }
.sort-icon.asc,
.sort-icon.desc     { opacity: 1; color: #4a6fdc; }

/* ============================================================
   Лого в таблице
   ============================================================ */
.course-logo-cell {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-logo-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    display: block;
}

.course-logo-placeholder {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
}

/* ============================================================
   Бейдж подписки и строка подписки
   ============================================================ */
.badge-subscription {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    background: #eef2fd;
    color: #4a6fdc;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
    white-space: nowrap;
}

.courses-table tbody tr.row-subscription {
    background-color: #f7f9ff;
}

.courses-table tbody tr.row-subscription:hover {
    background-color: #eef2fd;
}

.text-muted { color: #bbb; }

/* ============================================================
   Адаптивность — дополнение к существующему
   ============================================================ */
@media (max-width: 992px) {
    .col-author, .col-subs { display: none; }
}

@media (max-width: 768px) {
    .courses-filters-row { flex-direction: column; align-items: stretch; }
    .col-level, .col-status, .col-topics { display: none; }
}
