/* Базовые настройки и цветовая палитра */
:root {
    --primary: #E63946; /* Спортивный красный */
    --primary-hover: #D62828;
    --secondary: #1D3557; /* Глубокий синий */
    --bg-color: #F8F9FA; /* Светло-серый фон приложения */
    --card-bg: #FFFFFF;
    --text-main: #2B2D42;
    --text-muted: #8D99AE;
    --border: #EDF2F4;
    --success: #2A9D8F; /* Зеленый для чекина */
    --radius-lg: 20px;
    --radius-md: 12px;
    --shadow: 0 8px 24px rgba(29, 53, 87, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent; /* Убираем синее мерцание при клике на телефоне */
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    /* Защита от горизонтального скролла */
    overflow-x: hidden;
}

/* --- ШАПКА ПРИЛОЖЕНИЯ --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 800;
    color: var(--secondary);
}

.logo i {
    color: var(--primary);
    font-size: 24px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-main);
    position: relative;
    cursor: pointer;
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg);
}

/* --- ОСНОВНОЙ КОНТЕНТ --- */
.app-content {
    padding: 24px 20px 100px; /* Снизу отступ под меню */
}

.welcome-section {
    margin-bottom: 24px;
}

.greeting {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.coach-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary);
}

/* --- БЫСТРЫЕ ДЕЙСТВИЯ (КНОПКИ) --- */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.2s ease;
}

button:active {
    transform: scale(0.96); /* Эффект продавливания */
}

.btn-primary, .btn-secondary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: none;
    font-size: 14px;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 16px rgba(230, 57, 70, 0.2);
}

.btn-primary i {
    font-size: 28px;
}

.btn-secondary {
    background-color: var(--card-bg);
    color: var(--secondary);
    box-shadow: var(--shadow);
}

.btn-secondary i {
    font-size: 28px;
    color: var(--secondary);
}

/* --- КАРТОЧКА ТУРНИРА --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary);
}

.link-all {
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.tournament-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.status-checkin {
    background-color: rgba(42, 157, 143, 0.1);
    color: var(--success);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.card-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.detail-item i {
    font-size: 18px;
    color: var(--secondary);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--secondary);
    padding: 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
}

.btn-full-width {
    width: 100%;
}

/* --- НИЖНЕЕ МЕНЮ (НАВИГАЦИЯ) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 12px 10px 24px; /* Отступ снизу для iPhone (челка/полоса) */
    box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 24px;
}

.nav-item.active {
    color: var(--primary);
}
/* --- СТИЛИ СТРАНИЦЫ АВТОРИЗАЦИИ --- */
.auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: space-between;
    padding: 40px 20px 20px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    margin: auto;
    background: var(--card-bg);
    padding: 32px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--secondary);
    margin-bottom: 6px;
}

.auth-logo p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Переключатель ролей */
.role-selector {
    display: flex;
    background-color: var(--bg-color);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.role-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    color: var(--text-muted);
}

.role-btn.active {
    background: var(--card-bg);
    color: var(--secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Поля ввода */
.auth-form .input-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 14px;
    font-size: 20px;
    color: var(--text-muted);
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s;
}

.input-wrapper input:focus {
    border-color: var(--secondary);
}

.btn-submit {
    width: 100%;
    background-color: var(--secondary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(29, 53, 87, 0.15);
}

.auth-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    font-size: 13px;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.divider {
    color: var(--border);
}

/* Подвал авторизации */
.auth-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.auth-footer a {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}

/* --- СТРАНИЦА: МОИ СПОРТСМЕНЫ --- */
.header-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary);
}

/* Строка поиска */
.search-bar {
    position: relative;
    margin-bottom: 24px;
}

.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 20px;
}

.search-bar input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 15px;
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.search-bar input:focus {
    border-color: var(--primary);
}

/* Список спортсменов */
.athletes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.athlete-card {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    border: 1px solid var(--border);
}

.athlete-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
    margin-right: 16px;
    flex-shrink: 0;
}

.bg-red { background-color: var(--primary); }
.bg-blue { background-color: #457B9D; }
.bg-dark { background-color: var(--secondary); }

.athlete-info {
    flex-grow: 1;
}

.athlete-info h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 4px;
}

.athlete-info p {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-icon-small {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
}

/* --- ВСПЛЫВАЮЩЕЕ ОКНО (BOTTOM SHEET) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(29, 53, 87, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-end; /* Прижимаем к низу */
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-sheet {
    background-color: var(--bg-color);
    width: 100%;
    border-radius: 24px 24px 0 0; /* Скругление только сверху */
    padding: 24px 20px 40px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
}

.modal-overlay.active .modal-sheet {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 20px;
    color: var(--secondary);
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-row .input-group {
    flex: 1;
}

/* --- СТИЛИ ТУРНИРНОЙ СЕТКИ --- */
.sub-title {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* Контейнер скролла */
.bracket-container {
    width: 100%;
    padding: 20px 10px 100px;
    overflow-x: auto; /* Включаем горизонтальный скролл */
    -webkit-overflow-scrolling: touch;
}

.bracket-wrapper {
    display: flex;
    gap: 40px; /* Расстояние между раундами */
    min-width: max-content; /* Чтобы раунды встали в ряд и не сжимались */
    padding: 10px;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    width: 260px;
}

.round-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    text-align: center;
    background-color: var(--border);
    padding: 6px;
    border-radius: var(--radius-md);
}

.matchups {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex-grow: 1; /* Распределяет пары по высоте в зависимости от раунда */
    gap: 24px;
}

/* Карточка пары */
.matchup, .matchup-final {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Строка участника */
.participant {
    display: flex;
    align-items: center;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.participant:last-child {
    border-bottom: none;
}

/* Метка цвета формы (Красный/Синий угол) */
.seed-color {
    width: 4px;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
}

.name {
    flex-grow: 1;
    padding-left: 8px;
    color: var(--text-main);
}

.score {
    font-weight: 700;
    color: var(--secondary);
    padding-left: 8px;
}

/* Стили для разных статусов в сетке */
.matchup .winner .name {
    font-weight: 700;
    color: var(--secondary);
}

.matchup .winner::after {
    content: "➔";
    color: var(--success);
    font-size: 12px;
    font-weight: bold;
}

/* Подсветка текущего активного боя */
.participant.current {
    background-color: rgba(230, 57, 70, 0.05);
}

/* Ожидающие слоты */
.participant.placeholder {
    color: var(--text-muted);
    font-style: italic;
    background-color: #FAFAFA;
}

/* --- СТИЛИ СТРАНИЦЫ QR-ЧЕКИНА --- */
.qr-page {
    background-color: var(--card-bg);
}

.qr-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 32px;
}

.tournament-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-color);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 24px;
}

.tournament-info-badge i {
    color: #F4A261; /* Золотой цвет кубка */
    font-size: 18px;
}

.qr-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--secondary);
    line-height: 1.2;
    margin-bottom: 8px;
}

.qr-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
    max-width: 280px;
}

/* Красивая рамка вокруг QR-кода */
.qr-box {
    position: relative;
    padding: 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.qr-image {
    display: block;
    width: 200px;
    height: 200px;
}

/* Уголки для имитации видоискателя сканера */
.qr-corners {
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: var(--primary);
    border-style: solid;
}

.top-left { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-radius: 12px 0 0 0; }
.top-right { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-radius: 0 12px 0 0; }
.bottom-left { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-radius: 0 0 0 12px; }
.bottom-right { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-radius: 0 0 12px 0; }

/* Статистика внизу */
.live-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background-color: var(--bg-color);
    padding: 16px;
    border-radius: var(--radius-md);
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--secondary);
}

.text-primary {
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background-color: var(--border);
}

/* --- СТИЛИ КАБИНЕТА РОДИТЕЛЯ --- */
.user-role-badge {
    background-color: rgba(29, 53, 87, 0.1);
    color: var(--secondary);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
}

.athlete-subtext {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Карточка живого матча */
.live-match-card {
    background: linear-gradient(135deg, #1d3557 0%, #2b2d42 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 10px 30px rgba(29, 53, 87, 0.2);
}

.status-alert {
    background-color: var(--primary) !important;
    color: white !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.tournament-title {
    font-size: 16px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 16px;
}

.match-live-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.08);
    padding: 10px;
    border-radius: var(--radius-md);
}

.mat-badge {
    font-size: 16px;
    font-weight: 800;
    color: #F4A261;
}

.fight-number {
    font-size: 14px;
    font-weight: 600;
}

/* Блок соперников */
.versus-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.fighter {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.fighter-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.corner-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.6;
}

.red-corner {
    text-align: left;
    border-left: 3px solid var(--primary);
    padding-left: 8px;
}

.blue-corner {
    text-align: right;
    border-right: 3px solid #457B9D;
    padding-right: 8px;
}

.vs-circle {
    background: rgba(255, 255, 255, 0.15);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Список документов атлета */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.info-item i {
    font-size: 24px;
    color: var(--secondary);
    margin-right: 14px;
}

.info-text {
    flex-grow: 1;
}

.info-text h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 2px;
}

.info-text p {
    font-size: 12px;
    color: var(--text-muted);
}

.badge-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}

.badge-status.verified {
    background-color: rgba(42, 157, 143, 0.1);
    color: var(--success);
}

/* --- СТИЛИ ДЛЯ ВЫБОРА ГРУПП (ЧЕКБОКСЫ) --- */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: var(--card-bg);
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 8px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--text-main) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    cursor: pointer;
}

.checkbox-label input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary); /* Красный цвет для активного чекбокса */
}