/* =====================================================
   ОСНОВНЫЕ СТИЛИ
===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', 'Tahoma', 'Geneva', 'Verdana', sans-serif;
    background-color: #15151e;
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
}

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

.main {
    flex: 1;
}

/* =====================================================
   HEADER
===================================================== */
.header {
    background-color: #0a0a0a;
    border-bottom: 2px solid #e10600;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo__img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo__text {
    font-size: 20px;
    font-weight: bold;
    color: #e10600;
}

.nav {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.nav__link {
    color: #ffffff;
    transition: color 0.3s;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.nav__link:hover {
    text-decoration: none;
    color: #e10600;
}

.user-menu {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-menu__link {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s;
    font-size: 13px;
    text-transform: uppercase;
}

.user-menu__link:hover {
    color: #e10600;
}

/* =====================================================
   ПОДВАЛ (FOOTER)
===================================================== */
.footer {
    background-color: #111111;
    border-top: 1px solid #222222;
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    color: #888888;
    font-size: 14px;
}

.footer p:first-child {
    margin-bottom: 10px;
}

/* =====================================================
   ГЛАВНАЯ СТРАНИЦА - ГЕРОЙ
===================================================== */
.f1-hero {
    background: linear-gradient(135deg, #111111, #0a0a0a);
    text-align: center;
    padding: 40px 0;
    border-bottom: 1px solid #222222;
}

.f1-hero__year {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 20px;
    color: #ffffff;
}

.f1-hero__tabs {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.f1-hero__tab {
    color: #888888;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    padding-bottom: 10px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.f1-hero__tab.active {
    color: #e10600;
    border-bottom-color: #e10600;
}

.f1-hero__tab:hover {
    color: #e10600;
}

/* =====================================================
   ПОДИУМ НА ГЛАВНОЙ СТРАНИЦЕ
===================================================== */
.f1-podium {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 60px 0;
    flex-wrap: wrap;
}

.f1-podium .driver-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #111111;
    border-radius: 10px;
    padding: 24px;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    gap: 20px;
    overflow: hidden;
    position: relative;
    min-width: 280px;
    flex: 1;
    max-width: 360px;
}

/* Увеличиваем карточку первого места */
.f1-podium .driver-card:first-child {
    padding: 32px 24px;
}

.f1-podium .driver-card:first-child .driver-card__photo {
    height: 150px;
}

.f1-podium .driver-card:first-child .driver-card__name {
    font-size: 22px;
}

.f1-podium .driver-card:first-child .driver-card__number {
    font-size: 30px;
}

.f1-podium .driver-card:hover {
    transform: translateY(-5px);
}

.f1-podium .driver-card__info {
    flex: 1;
    z-index: 2;
}

.f1-podium .driver-card__name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffffff;
    line-height: 1.2;
}

.f1-podium .driver-card:first-child .driver-card__name {
    font-size: 22px;
}

.f1-podium .driver-card__team {
    font-size: 13px;
    color: #cccccc;
    margin-bottom: 10px;
    opacity: 0.8;
}

.f1-podium .driver-card__number {
    font-size: 24px;
    font-weight: 700;
    color: #e10600;
}

.f1-podium .driver-card:first-child .driver-card__number {
    font-size: 28px;
}

.f1-podium .driver-card__photo {
    width: 100px;
    height: 150px;
    flex-shrink: 0;
    position: relative;
    margin-bottom: -20px;
    margin-right: -10px;
    border-radius: 12px 12px 0 0;
}

.f1-podium .driver-card__photo img {
    width: 100%;
    height: 250%;
    object-fit: cover;
    object-position: 50% 0%;
    display: block;
}

/* Ссылка-обёртка для карточки */
.driver-card-link {
    text-decoration: none;
    display: block;
    flex: 1;
    max-width: 360px;
}

.driver-card-link:hover {
    text-decoration: none;
}

.driver-card-link:hover .driver-card {
    transform: translateY(-5px);
}

/* Для первого места увеличьте max-width */
.driver-card-link:first-child {
    max-width: 380px;
}

/* =====================================================
   ЗАГЛУШКИ ДЛЯ ФОТО ПИЛОТОВ (КАК ЛОГОТИПЫ КОМАНД)
===================================================== */

/* Для заглушек на подиуме ТОЛЬКО ДЛЯ ПИЛОТОВ */
.f1-podium:not(#teams-podium) .driver-card__photo img[src*="default"] {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    object-fit: contain !important;
    object-position: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 15px !important;
    margin: 0 auto !important;
    position: relative !important;
    top: 40px !important;
}

/* Для заглушек команд на подиуме*/
#teams-podium .driver-card__photo img[src*="default"] {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    padding: 15px !important;
}

/* Для заглушек на странице "Пилоты" и "Избранное" */
.drivers-page .driver-card__photo img[src*="default"],
.favorites-page .driver-card__photo img[src*="default"] {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    object-fit: contain !important;
    object-position: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 15px !important;
    margin: 0 auto !important;
    position: relative !important;
    top: 45px !important;
}

/* Для заглушек на странице пилота (большое фото) */
.driver-header__photo img[src*="default"] {
    width: 150px !important;
    height: 150px !important;
    border-radius: 50% !important;
    object-fit: contain !important;
    object-position: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 30px !important;
    margin: 60px auto 0 auto !important;
    display: block !important;
}

/* Для маленьких заглушек в таблицах */
.driver-small-photo[src*="default"],
.driver-thumb[src*="default"] {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    object-fit: contain !important;
    object-position: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 6px !important;
}

/* =====================================================
   ЗАГЛУШКИ ДЛЯ КАРТОЧЕК ПИЛОТОВ НА СТРАНИЦЕ КОМАНДЫ
===================================================== */

/* Для заглушек в карточках пилотов на странице команды */
.team-page .driver-card__photo img[src*="default"] {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    object-fit: contain !important;
    object-position: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 15px !important;
    margin: 0 auto !important;
    position: relative !important;
    top: 45px !important;
}


/* Адаптивность */
@media (max-width: 900px) {
    .f1-podium {
        flex-direction: column;
        align-items: center;
    }

    .f1-podium .driver-card {
        max-width: 100%;
        width: 100%;
    }

    .f1-podium .driver-card:first-child {
        order: 1;
    }

    .logo__img {
        height: 30px;
    }

    .logo__text {
        font-size: 16px;
    }
}



/* =====================================================
   ТАБЛИЦА ЧЕМПИОНАТА
===================================================== */
.f1-standings-table {
    background-color: #111111;
    border-radius: 16px;
    margin: 30px 0;
    border: 1px solid #222222;
}

.f1-table {
    width: 100%;
    border-collapse: collapse;
}

.f1-table th,
.f1-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #222222;
}

.f1-table th {
    background-color: #0a0a0a;
    color: #888888;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.f1-table__pos {
    font-weight: 700;
    width: 60px;
}

.f1-table__driver a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
}

.f1-table__nationality {
    align-items: center;
    gap: 10px;
}

/* Подсветка при наведении в таблицах */
.f1-table tr {
    transition: background-color 0.2s ease;
}

.f1-table tr:hover .driver-cell a,
.f1-table tr:hover .team-cell a,
.f1-table tr:hover .f1-table__driver a,
.f1-table tr:hover .f1-table__team span,
.f1-table tr:hover .f1-table__team a {
    color: var(--team-color);
    text-decoration: none;
}

/* Плавный переход для ссылок */
.f1-table__driver a,
.f1-table__team a,
.f1-table__team span {
    transition: color 0.2s ease;
}


/* Флаги */
.flag-icon {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
    vertical-align: middle;
}

/* Для подиума и крупных элементов */
.flag-icon-large {
    width: 32px;
    height: 24px;
}

.f1-table__team {
    padding-left: 12px;
}

.f1-table__points {
    font-weight: 700;
    color: #e10600;
}

.f1-table__show-all {
    text-align: center;
    padding: 15px;
    border-top: 1px solid #222222;
}

.f1-link {
    color: #e10600;
    text-decoration: none;
    font-size: 14px;
}

.f1-link:hover {
    text-decoration: underline;
}

/* Кнопка полных результатов */
.f1-full-standings {
    text-align: center;
    margin: 30px 0;
}

/* =====================================================
   БЛОК СЛЕДУЮЩЕЙ ГОНКИ
===================================================== */
.f1-next-race {
    background-color: #111111;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    margin: 40px 0;
    border: 1px solid #222222;
}

.f1-next-race__label {
    font-size: 12px;
    letter-spacing: 2px;
    color: #888888;
    margin-bottom: 10px;
}

.f1-next-race__name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #ffffff;
}

.f1-next-race__info {
    color: #888888;
    margin-bottom: 15px;
}

.f1-next-race__date {
    font-size: 18px;
    margin-bottom: 20px;
}

/* =====================================================
   КНОПКИ
===================================================== */
.f1-button {
    display: inline-block;
    background-color: #e10600;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.f1-button:hover {
    background-color: #b80500;
    transform: translateY(-2px);
}

.f1-button--outline {
    background-color: transparent;
    border: 1px solid #e10600;
    color: #e10600;
}

.f1-button--outline:hover {
    background-color: #e10600;
    color: white;
}


/* =====================================================
   СТРАНИЦА ПИЛОТА
===================================================== */
.driver-header {
    display: flex;
    gap: 40px;
    margin: 30px 0;
    flex-wrap: wrap;
    align-items: center;
}

.driver-photo {
    height: 250px;
    flex-shrink: 0;
    position: relative;
    margin-bottom: -30px;
    margin-right: -10px;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.driver-photo img {
    width: 100%;
    height: 250%;
    object-fit: cover;
    display: block;
}



.driver-info h1 {
    font-size: 36px;
    margin-bottom: 15px;
    color: #ffffff;
}

.driver-code {
    background-color: #e10600;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    margin-left: 10px;
}

.driver-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: linear-gradient(135deg, #1a1a1a, #111111);
    padding: 20px;
    text-align: center;
    border-radius: 12px;
    border: 1px solid #222222;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #e10600;
}

.stat-label {
    font-size: 14px;
    color: #888888;
    margin-top: 8px;
}

.driver-bio {
    background-color: #111111;
    padding: 25px;
    border-radius: 16px;
    margin: 30px 0;
    line-height: 1.8;
    border: 1px solid #222222;
}


/* Фото пилотов в таблице */
.driver-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.driver-small-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 0%;
    background-color: #1a1a1a;
}

/* Логотипы команд в таблице */
.team-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-small-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    background-color: #1a1a1a;
    border-radius: 6px;
    padding: 4px;
}

/* =====================================================
   ОБЩИЕ ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ
===================================================== */
a {
    color: white;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-20 {
    padding: 20px;
}

/* =====================================================
   УВЕДОМЛЕНИЯ ДЛЯ ВСЕХ СТРАНИЦ
===================================================== */
.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-size: 14px;
    border-left: 4px solid;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert.error {
    background: linear-gradient(135deg, #2a0a0a, #1a0505);
    border-left-color: #e10600;
    color: #ff8888;
}

.alert.success {
    background: linear-gradient(135deg, #0a2a0a, #051a05);
    border-left-color: #4caf50;
    color: #88ff88;
}

.alert strong {
    margin-right: 8px;
}

/* =====================================================
   ГОРИЗОНТАЛЬНАЯ ПРОКРУТКА ДЛЯ ТАБЛИЦ
===================================================== */

/* Для всех контейнеров с таблицами на главной странице и везде */
.f1-standings-table,
.standings-table-wrapper,
.results-table-wrapper,
.admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Сами таблицы — фиксируем минимальную ширину */
.f1-table,
.standings-table,
.results-table,
.admin-table {
    min-width: 600px;
    width: 100%;
}




/* =====================================================
   АДАПТИВНАЯ ВЁРСТКА
===================================================== */

/* ПЛАНШЕТЫ (768px - 991px) */
@media (max-width: 991px) {
    /* Общие */
    .container {
        padding: 0 15px;
    }
    
    /* Шапка */
    .header__inner {
        flex-direction: column;
        text-align: center;
    }
    
    .nav {
        justify-content: center;
    }
    
    /* Подиум */
    .f1-podium {
        gap: 20px;
    }
    
    .f1-podium .driver-card {
        min-width: 240px;
    }
    
    
    /* Страница команд */
    .teams-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* Календарь */
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* Таблицы — горизонтальная прокрутка */
    .admin-table-wrapper,
    .standings-table-wrapper,
    .results-table-wrapper {
        overflow-x: auto;
    }
    
    .admin-table,
    .standings-table,
    .results-table {
        min-width: 700px;
    }
    
    /* Страница пилота */
    .driver-header {
        flex-direction: column;
        text-align: center;
    }
    
    .driver-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .driver-header__photo {
        margin: 0 auto;
    }
    
    /* Админ-панель */
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* БОЛЬШИЕ ТЕЛЕФОНЫ (576px - 767px) */
@media (max-width: 767px) {
    /* Заголовки */
    .f1-hero__year {
        font-size: 32px;
    }
    
    .standings-title {
        font-size: 24px;
    }
    
    /* Подиум */
    .f1-podium {
        flex-direction: column;
        align-items: center;
    }
    
    .f1-podium .driver-card {
        max-width: 100%;
        width: 100%;
    }
    
    .f1-podium .driver-card:first-child {
        order: 1;
    }
    
    /* Карточки */
    .driver-card {
        padding: 20px;
    }
    
    .driver-card__photo {
        width: 100px;
        height: 140px;
    }
    
    .driver-card__name {
        font-size: 18px;
    }
    
    /* Страницы списков */
    .teams-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Календарь */
    .calendar-grid {
        grid-template-columns: 1fr;
    }
    
    /* Статистика на странице пилота */
    .driver-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Блок следующей гонки */
    .f1-next-race__name {
        font-size: 22px;
    }
    
    .race-info-card {
        flex-direction: row;
        gap: 15px;
    }
    
    /* Админ-панель */
    .admin-header {
        flex-direction: column;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .menu-grid {
        grid-template-columns: 1fr;
    }
    
    /* Формы */
    .admin-form .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    /* Кнопка выхода в админке */
    .dashboard-header .logout-btn {
        position: static;
        display: inline-block;
        margin-top: 15px;
    }
}

/* МАЛЕНЬКИЕ ТЕЛЕФОНЫ (< 576px) */
@media (max-width: 575px) {
    /* Шрифты */
    body {
        font-size: 14px;
    }
    
    .f1-hero__year {
        font-size: 24px;
    }
    
    .standings-title {
        font-size: 20px;
    }
    
    .driver-info h1 {
        font-size: 28px;
    }
    
    /* Карточки пилотов */
    .driver-card {
        flex-direction: row;
        text-align: center;
    }
    
    .driver-card__photo {
        width: 120px;
        height: 160px;
        margin: 0 auto;
        margin-bottom: -20px;
    }
    
    .driver-card__info {
        text-align: center;
    }
    
    .driver-card__nationality {
        justify-content: center;
    }
    
    /* Статистика */
    .driver-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    /* Таблицы */
    .f1-table th,
    .f1-table td {
        padding: 8px;
        font-size: 12px;
    }
    
    
    /* Маленькие фото в таблицах */
    .driver-small-photo,
    .driver-thumb {
        width: 30px;
        height: 30px;
    }
    
    .team-small-logo {
        width: 25px;
        height: 25px;
    }
    
    /* Кнопки */
    .f1-button {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    /* Блок следующей гонки */
    .f1-next-race {
        padding: 20px;
    }
    
    .f1-next-race__name {
        font-size: 18px;
    }
    
    /* Календарь */
    .race-card {
        padding: 15px;
    }
    
    .race-card__title {
        font-size: 16px;
    }
    
    /* Админ-панель */
    .admin-table th,
    .admin-table td {
        padding: 6px;
        font-size: 11px;
    }
    
    .btn-add, .btn-back {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Вкладки */
    .standings-tabs {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .tab-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Герой */
    .f1-hero__tabs {
        gap: 15px;
    }
    
    .f1-hero__tab {
        font-size: 14px;
    }
    
    /* Навигация */
    .nav {
        gap: 12px;
    }
    
    .nav__link {
        font-size: 11px;
    }
    
    .user-menu__link {
        font-size: 11px;
    }
}

/* На маленьких экранах включаем прокрутку и убираем лишние отступы */
@media (max-width: 768px) {
    .f1-standings-table,
    .standings-table-wrapper,
    .results-table-wrapper,
    .admin-table-wrapper {
        overflow-x: auto;
    }
    
    .f1-table,
    .standings-table,
    .results-table,
    .admin-table {
        min-width: 550px;
    }
}

/* На очень маленьких экранах таблица уже, чтобы не было слишком много пустого места */
@media (max-width: 480px) {
    .f1-table,
    .standings-table,
    .results-table,
    .admin-table {
        min-width: 450px;
    }
}

/* ОЧЕНЬ МАЛЕНЬКИЕ ТЕЛЕФОНЫ (< 400px) */
@media (max-width: 400px) {
    /* Ещё меньше шрифты */
    .f1-hero__year {
        font-size: 20px;
    }
    
    .driver-card__name {
        font-size: 16px;
    }
    
    /* Навигация в две строки */
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Карточка пилота */
    .driver-card__photo {
        width: 100px;
        height: 140px;
    }
}

