/* Стили для веб-интерфейса CrossFit Hub */

:root {
    --primary-color: #2196F3;
    --secondary-color: #FFC107;
    --success-color: #4CAF50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --dark-color: #212121;
    --light-color: #fafafa;
    --border-color: #e0e0e0;
    --text-color: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Хедер */
header {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 15px 0;
    margin-bottom: 30px;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    color: var(--primary-color);
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-weight: 600;
    color: #fff;
}

.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin {
    background: #f59e0b;
    color: #1a1a1a;
}

.role-trainer {
    background: #3b82f6;
    color: #fff;
}

.role-athlete {
    background: #10b981;
    color: #fff;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1976D2;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-secondary {
    background-color: #757575;
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #e68900;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Вкладки */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab {
    padding: 12px 24px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}

.tab:hover {
    color: var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Карточки */
.card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 20px;
    color: var(--dark-color);
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Таблица тренировок */
.workouts-table {
    width: 100%;
    border-collapse: collapse;
}

.workouts-table th,
.workouts-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.workouts-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #555;
}

.workouts-table tr:hover {
    background-color: #f9f9f9;
}

.workouts-table .actions {
    display: flex;
    gap: 8px;
}

/* Календарь */
.calendar-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.calendar-controls input[type="date"] {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Бейдж */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.badge-warning {
    background-color: #fff3e0;
    color: #e65100;
}

.badge-danger {
    background-color: #ffebee;
    color: #c62828;
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), #1976D2);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card.success {
    background: linear-gradient(135deg, var(--success-color), #388E3C);
}

.stat-card.warning {
    background: linear-gradient(135deg, var(--warning-color), #F57C00);
}

.stat-card h3 {
    font-size: 32px;
    margin-bottom: 5px;
}

.stat-card p {
    font-size: 14px;
    opacity: 0.9;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 24px;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

/* Скрыт элемент */
.hidden {
    display: none !important;
}

/* Загрузка */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Сообщения */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.alert-info {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* Адаптивность */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        overflow-x: auto;
    }
    
    .workouts-table {
        font-size: 14px;
    }
    
    .workouts-table th,
    .workouts-table td {
        padding: 8px;
    }
}

/* Страница входа */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), #1976D2);
}

.login-card {
    background-color: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.login-card .btn {
    width: 100%;
}

/* Участники тренировки */
.participants-list {
    list-style: none;
}

.participants-list li {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.participants-list li:last-child {
    border-bottom: none;
}

.participant-name {
    font-weight: 500;
}

.participant-username {
    color: #666;
    font-size: 14px;
}

/* Грид тренировок (для "Сегодня") */
.workouts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.workout-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.workout-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.workout-card-time {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.workout-card-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-color);
}

.workout-card-trainer {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.workout-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.workout-card-participants {
    font-size: 14px;
    font-weight: 500;
}

.workout-card-duration {
    font-size: 14px;
    color: #666;
}

.workout-card-status {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.workout-card-status.available {
    background-color: var(--success-color);
}

.workout-card-status.warning {
    background-color: var(--warning-color);
}

.workout-card-status.full {
    background-color: var(--danger-color);
}

/* Недельный вид */
.week-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.day-column {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    min-height: 400px;
}

.day-column-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.day-column-weekday {
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
    font-weight: 600;
}

.day-column-date {
    font-size: 20px;
    font-weight: bold;
    color: var(--dark-color);
}

.day-column.today {
    background: linear-gradient(to bottom, #e3f2fd, #f9f9f9);
    border: 2px solid var(--primary-color);
}

.day-column-workouts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-workout-card {
    background: white;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mini-workout-card:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    transform: translateX(2px);
}

.mini-workout-card.available {
    border-left-color: var(--success-color);
}

.mini-workout-card.warning {
    border-left-color: var(--warning-color);
}

.mini-workout-card.full {
    border-left-color: var(--danger-color);
}

.mini-workout-time {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.mini-workout-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--dark-color);
}

.mini-workout-trainer {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
}

.mini-workout-info {
    font-size: 12px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.no-workouts {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

/* Адаптивность для недельного вида */
@media (max-width: 1400px) {
    .week-view {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .week-view {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .week-view {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .workouts-grid {
        grid-template-columns: 1fr;
    }
}

