/* style.css */

/* --- ВОСТОЧНЫЙ СТИЛЬ И ПАЛИТРА (Огонь, Золото, Тень) --- */
:root {
    --bg-dark: #0a0505;        /* Глубокий черный с красным отливом */
    --panel-bg: #160d0d;       /* Фон карточек */
    --fire-orange: #ff4d00;    /* Пламенный оранжевый */
    --dragon-red: #d62828;     /* Императорский красный */
    --gold: #f7b731;           /* Золото */
    --text-light: #f5f5f5;     /* Основной текст */
    --text-muted: #a59494;     /* Второстепенный текст */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    padding: 20px;
    background-image: radial-gradient(circle at 50% 0%, #3a0d0d 0%, var(--bg-dark) 70%);
}

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--dragon-red), 0 0 20px var(--fire-orange);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Индикатор Real-time (Инь-Янь) */
.live-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    background: rgba(0,0,0,0.4);
    padding: 6px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 77, 0, 0.3);
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: var(--fire-orange);
}

.yinyang-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border-radius: 50%;
    background: linear-gradient(to right, #fff 50%, #000 50%);
    position: relative;
    animation: rotateYY 3s linear infinite;
}
.yinyang-icon::before, .yinyang-icon::after {
    content: '';
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    left: 25%;
}
.yinyang-icon::before { top: 0; background: #fff; border: 2px solid #000; }
.yinyang-icon::after { bottom: 0; background: #000; border: 2px solid #fff; }

@keyframes rotateYY {
    100% { transform: rotate(-360deg); }
}

/* --- ОСНОВНОЙ КОНТЕЙНЕР ЗАЕЗДОВ --- */
.races-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Карточка одного заезда */
.race-card {
    background-color: var(--panel-bg);
    border-radius: 12px;
    border-left: 5px solid var(--dragon-red);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.race-card:hover {
    border-left-color: var(--gold);
    transform: translateY(-2px);
}

/* Шапка заезда */
.race-header {
    background: linear-gradient(90deg, #221212 0%, #160d0d 100%);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.race-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-light);
}

.race-time {
    background: var(--dragon-red);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 0 0 8px var(--dragon-red);
}

/* Сетка дорожек (4 лодки) */
.lanes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 20px;
    gap: 15px;
}

.lane-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    position: relative;
}

.lane-number {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--fire-orange);
    margin-bottom: 8px;
    font-weight: bold;
    letter-spacing: 1px;
}

.team-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
    min-height: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-result {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--gold);
    font-family: monospace;
    background: rgba(247, 183, 49, 0.1);
    padding: 5px 0;
    border-radius: 4px;
    border: 1px dashed rgba(247, 183, 49, 0.3);
}

.no-data {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* --- 📱 МОБИЛЬНАЯ ВЕРСИЯ --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .race-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 15px;
    }

    .lanes-grid {
        grid-template-columns: 1fr; 
        gap: 10px;
        padding: 15px;
    }

    .lane-box {
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        padding: 12px;
    }

    .lane-number {
        margin-bottom: 0;
        width: 15%;
    }

    .team-name {
        margin-bottom: 0;
        min-height: auto;
        width: 55%;
        justify-content: flex-start;
        padding-right: 10px;
        font-size: 1rem;
    }

    .team-result {
        width: 30%;
        text-align: center;
        font-size: 1.1rem;
        padding: 3px 0;
    }
}

/* --- НАВИГАЦИОННОЕ МЕНЮ (Общее для всех страниц) --- */
.nav-container {
    max-width: 1100px;
    margin: -15px auto 30px auto;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.nav-link {
    display: inline-block;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 1px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Стили активных ссылок для разных страниц */
body:not(.archive-page) .nav-link.live-link {
    color: #fff;
    background: linear-gradient(135deg, var(--dragon-red), var(--fire-orange));
    border-color: var(--fire-orange);
    box-shadow: 0 4px 15px rgba(214, 40, 40, 0.4);
}

body.archive-page .nav-link.archive-link {
    color: #fff;
    background: linear-gradient(135deg, #00b894, #009432);
    border-color: #00b894;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}


/* --- 🐲 НЕФРИТОВАЯ ТЕМА ДЛЯ СТРАНИЦЫ АРХИВА (.archive-page) --- */
body.archive-page {
    /* Меняем красный отсвет радиального градиента на глубокий нефритовый */
    background-image: radial-gradient(circle at 50% 0%, #0d2a22 0%, var(--bg-dark) 70%);
}

/* Меняем акцентные рамки карточек в архиве */
body.archive-page .race-card {
    border-left: 5px solid #00b894;
}

/* Плашка времени заезда в архиве */
body.archive-page .race-time {
    background: #00b894;
    box-shadow: 0 0 8px rgba(0, 184, 148, 0.6);
}

/* Индикатор статуса в архиве */
body.archive-page .live-indicator {
    border-color: rgba(0, 184, 148, 0.3);
    color: #00b894;
}

/* Номера дорожек в архиве */
body.archive-page .lane-number {
    color: #00b894;
}

/* КЛАСС ИКОНКИ ИНЬ-ЯН */
.yinyang-icon {
    width: 24px;          /* Оптимальный размер для шапки */
    height: 24px;
    background-image: url('yinyang.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;
    
    /* Подключаем бесконечную анимацию вращения */
    animation: spinYinYang 4s linear infinite; 
    
    /* Плавность рендеринга при вращении */
    will-change: transform;
}

/* АНИМАЦИЯ ВРАЩЕНИЯ НА 360 ГРАДУСОВ */
@keyframes spinYinYang {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ДОПОЛНИТЕЛЬНО: Стили контейнера индикатора (если еще не были настроены) */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.05); /* Легкий контрастный фон */
    padding: 6px 14px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 1px;
}

/* ==========================================================================
   СТИЛИ ДЛЯ СТРАНИЦЫ ИНФОРМАЦИИ О КОМАНДАХ (teams.php)
   ========================================================================== */

/* Уникальный оттенок фона для быстрой идентификации страницы */
body.teams-page {
    background-color: #f1f6f4; /* Мягкий водно-нефритовый оттенок */
}

/* Стилизация активной вкладки в меню */
body.teams-page .nav-link.teams-link.active {
    background-color: #00796b; /* Глубокий изумрудный цвет */
    color: #ffffff;
    border-bottom: 3px solid #004d40;
}

/* Статичный бейдж в шапке вместо крутящегося live-индикатора */
.static-badge {
    background-color: #e0f2f1 !important;
    color: #004d40 !important;
    border: 1px solid #b2dfdb;
}

/* Адаптивный контейнер для таблицы */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin-top: 15px;
}

/* Таблица команд */
.teams-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 15px;
}

.teams-table th {
    background-color: #009688; /* Цвет шапки таблицы */
    color: #ffffff;
    font-weight: 600;
    padding: 14px 16px;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.teams-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    color: #333333;
}

/* Подсветка строки при наведении */
.teams-table tr:hover {
    background-color: #f7faf9;
}

/* Стили отдельных ячеек */
.cell-center {
    text-align: center;
}

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

.cell-result {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    color: #c62828; /* Выделение времени контрастным цветом */
}

.font-subtle {
    color: #666666;
    font-size: 14px;
}

/* Дополнения для интерактивной сортировки заголовков */
.teams-table th {
    cursor: pointer;           /* Превращаем курсор в указатель-палец при наведении */
    position: relative;
    user-select: none;         /* Запрещаем выделение текста при частых кликах/тапах */
    transition: background-color 0.2s ease;
}

/* Эффект при наведении мыши или тапе на заголовок */
.teams-table th:hover {
    background-color: #00796b; /* Чуть темнее базового цвета шапки */
}

/* Дефолтный скрытый маркер доступности сортировки */
.teams-table th::after {
    content: ' ↕';
    font-size: 11px;
    opacity: 0.3;
    margin-left: 5px;
    display: inline-block;
    transition: opacity 0.2s ease;
}

.teams-table th:hover::after {
    opacity: 0.8;
}

/* Активный индикатор сортировки по возрастанию (А-Я, 1-10) */
.teams-table th.sort-asc::after {
    content: ' ▲';
    opacity: 1;
    color: #fff;
}

/* Активный индикатор сортировки по убыванию (Я-А, 10-1) */
.teams-table th.sort-desc::after {
    content: ' ▼';
    opacity: 1;
    color: #fff;
}

/* Подсветка активных пунктов для новых страниц */
.nav-link.current-link.active { background-color: #b71c1c; color: white; }
.nav-link.schedule-link.active { background-color: #009688; color: white; }
