/* Навигация */
.student-nav {
    margin-bottom: 2rem;
}

/* Карточка информации о студенте */
.student-info-card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.student-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.student-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: #f8f9fa;
    border-radius: 50%;
    color: #6c757d;
}

.student-details {
    flex: 1;
}

.student-name-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.student-name-input {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 0.5rem;
    border: 2px solid transparent;
    border-radius: 4px;
    background: transparent;
    transition: all 0.2s;
}

.student-name-input:focus {
    border-color: #007bff;
    background: #fff;
    outline: none;
}

.student-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-item {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Секции групп и курсов */
.groups-section,
.courses-section {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.groups-section h3,
.courses-section h3 {
    margin: 0 0 1.5rem 0;
    color: #333;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.courses-section h4 {
    margin: 1.5rem 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
}

.courses-section h4:first-child {
    margin-top: 0;
}

/* Группы */
.groups-container {
    width: 100%;
}

.groups-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.group-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.group-item:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.group-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #007bff;
}

.group-name {
    font-weight: 500;
    color: #333;
}

.club-info {
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* Форма создания нового ученика */
.create-student-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

.create-student-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.create-student-form label {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.create-student-form input {
    padding: 0.6rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
}

.create-student-form .btn {
    align-self: flex-start;
}

.no-account-note {
    color: #6c757d;
    font-style: italic;
}

/* Курсы */
.assigned-courses,
.available-courses {
    margin-bottom: 2rem;
}

.assigned-courses:last-child,
.available-courses:last-child {
    margin-bottom: 0;
}

.courses-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.course-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.2s;
}

.course-item.assigned {
    background: #f8fff8;
    border-color: #d4edda;
}

.course-item.available {
    background: #fff9f0;
    border-color: #ffeaa7;
}

.course-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.course-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.course-name {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.course-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

.no-courses-message {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-style: italic;
}

.no-courses-message p {
    margin: 0;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: #007bff;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-billing {
    background: #6f42c1;
    color: #fff;
}

.btn-billing:hover:not(:disabled) {
    background: #5a349c;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

/* Состояния загрузки */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.hidden {
    transform: translateX(100%);
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

/* ============================================================
   Вкладки карточки ученика
   ============================================================ */
.student-tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    flex-wrap: wrap;
}

.student-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.student-tab-btn:hover {
    color: #007bff;
}

.student-tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #e9ecef;
    color: #495057;
    font-size: 0.75rem;
    font-weight: 600;
}

.student-tab-btn.active .tab-badge,
.games-subtab-btn.active .tab-badge {
    background: #007bff;
    color: #fff;
}

.student-tab-panel {
    display: none;
}

.student-tab-panel.active {
    display: block;
}

/* Подвкладки "Партии" */
.games-subtabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.games-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    background: #fff;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.games-subtab-btn:hover {
    border-color: #007bff;
}

.games-subtab-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
}

.games-subtab-panel {
    display: none;
}

.games-subtab-panel.active {
    display: block;
}

/* ============================================================
   Фильтры (курсы/партии на карточке ученика)
   ============================================================ */
.student-filters-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.student-filters-row .search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.student-filters-row .search-container input[type="text"] {
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 220px;
}

.student-filters-row .search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 0;
    display: flex;
}

.filter-date-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #495057;
}

.filter-date-label input[type="date"] {
    padding: 0.45rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
    cursor: pointer;
    color: #333;
}

.filter-select:focus {
    outline: none;
    border-color: #007bff;
}

/* ============================================================
   Таблица партий
   ============================================================ */
.games-table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: auto;
    margin-bottom: 0.5rem;
}

.games-table {
    width: 100%;
    border-collapse: collapse;
}

.games-table th {
    background-color: #f5f7fa;
    padding: 10px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.85rem;
}

.games-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    color: #333;
    font-size: 0.9rem;
}

.games-table tr:last-child td {
    border-bottom: none;
}

.games-table tr:hover {
    background-color: #f9f9f9;
}

/* ============================================================
   Пагинация (курсы/партии на карточке ученика)
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    gap: 5px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.pagination-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination-btn:hover:not(.active) {
    background-color: #f5f5f5;
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    color: #777;
}

/* ============================================================
   Модальное окно просмотра партии
   ============================================================ */
.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);
    max-height: 90vh;
    overflow-y: auto;
}

.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;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.game-viewer-modal-content {
    max-width: 420px;
}

.game-viewer-players {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.game-viewer-board-wrap {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.game-viewer-board {
    width: 100%;
    aspect-ratio: 1 / 1;
}

.game-viewer-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.game-viewer-nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    color: #333;
}

.game-viewer-nav button:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #007bff;
}

.game-viewer-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.game-viewer-counter {
    font-size: 0.85rem;
    color: #6c757d;
    min-width: 90px;
    text-align: center;
}

/* Адаптивность */
@media (max-width: 768px) {
    .student-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .student-name-section {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .student-name-input {
        text-align: center;
    }

    .groups-list {
        grid-template-columns: 1fr;
    }

    .course-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .course-info {
        text-align: center;
    }
}

@media (max-width: 576px) {
    .student-info-card,
    .groups-section,
    .courses-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .student-meta {
        text-align: center;
    }

    .meta-item {
        font-size: 0.8rem;
    }
}
