/* === Общий стиль для всех страниц === */
body {
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    scroll-behavior: smooth;
    /* Базовый отступ с учетом safe area */
    padding-top: calc(70px + var(--safe-area-inset-top, 0px));
}

/* Специальные стили для Capacitor приложений */
body.capacitor-app {
    padding-top: calc(70px + var(--safe-area-inset-top, 0px)) !important;
}

/* === Адаптивная шапка === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0.5rem 1rem;
    display: flex;
    flex-wrap: nowrap;
    /* Safe area для обычных браузеров */
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-left: env(safe-area-inset-left, 1rem);
    padding-right: env(safe-area-inset-right, 1rem);
}

/* Стили для navbar с safe area от Capacitor */
.navbar.capacitor-safe {
    padding-top: var(--safe-area-inset-top, 0.5rem) !important;
    padding-left: var(--safe-area-inset-left, 1rem) !important;
    padding-right: var(--safe-area-inset-right, 1rem) !important;
}

@media (max-width: 767px) {
    .navbar {
        padding: 0.3rem 0.5rem;
        flex-wrap: nowrap;
        /* Учитываем безопасные зоны на мобильных */
        padding-top: max(0.3rem, env(safe-area-inset-top, 0px));
        padding-left: env(safe-area-inset-left, 0.5rem);
        padding-right: env(safe-area-inset-right, 0.5rem);
    }
    
    .navbar.capacitor-safe {
        padding-top: var(--safe-area-inset-top, 0.3rem) !important;
        padding-left: var(--safe-area-inset-left, 0.5rem) !important;
        padding-right: var(--safe-area-inset-right, 0.5rem) !important;
    }
    
    .navbar-brand {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
        margin-right: 0;
    }
    
    .navbar-collapse {
        flex-basis: auto;
        flex-grow: 0;
    }
    
    .navbar-nav {
        flex-direction: row !important;
        align-items: center;
    }
    
    .nav-item {
        margin-left: 0.3rem !important;
    }
    
    .nav-link {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.9rem;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        order: -1;
        margin-right: 0.5rem;
    }
    
    body {
        /* Уменьшенный отступ с учётом safe area */
        padding-top: calc(60px + var(--safe-area-inset-top, 0px));
    }
    
    body.capacitor-app {
        padding-top: calc(60px + var(--safe-area-inset-top, 0px)) !important;
    }

    .navbar-nav {
        flex-direction: row !important;
        align-items: center;
        /* Уменьшаем отступ между иконками на маленьких экранах */
        gap: 0.5rem; /* Bootstrap gap-2 */
    }
}

/* === Элементы шапки === */
.navbar-brand i {
    font-size: 1.3rem;
    vertical-align: middle;
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

/* Делаем navbar-nav прокручиваемым по горизонтали */
.navbar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap; /* Не переносить на новую строку */
    overflow-x: auto; /* Добавить горизонтальный скролл, если элементы не помещаются */
    -webkit-overflow-scrolling: touch; /* Для плавности скролла на iOS */
    gap: 0.75rem; /* Оставляем небольшой отступ */
    padding-bottom: 4px; /* Небольшой отступ снизу для полосы прокрутки */
    /* Убираем стандартные отступы Bootstrap, если они мешают */
    margin: 0;
    padding: 0;
}

/* Скрываем полосу прокрутки для Webkit браузеров (опционально) */
.navbar-nav::-webkit-scrollbar {
    height: 4px; /* Высота полосы прокрутки */
}

.navbar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.5); /* Цвет бегунка */
    border-radius: 2px;
}

/* Убедимся, что nav-item не сжимаются */
.navbar-nav .nav-item {
    flex: 0 0 auto; /* Не растягиваем и не сжимаем */
    display: flex;
    align-items: center;
}

.nav-link {
    padding: 0.5rem 0.8rem;
    margin: 0 0.1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: #fff !important;
    white-space: nowrap;
}

.nav-link.active,
.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* === Карточки прогнозов и матчей === */
.match-card {
    border: none;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.match-card:hover {
    transform: translateY(-3px);
}

.prediction-container {
    display: flex;
    flex-direction: column;
}

.current-prediction,
.actual-result {
    display: flex;
    align-items: center;
}

.home-score,
.away-score {
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 5px;
    width: 40px;
    text-align: center;
}

.colon {
    font-size: 1.5rem;
    margin: 0 5px;
}

.status-badge {
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
}

/* === Кнопка выхода (красная) === */
.text-danger:hover {
    background-color: rgba(255, 0, 0, 0.1);
}

/* === Форма прогноза внутри карточки === */
.prediction-form input[type="text"] {
    max-width: 60px;
    text-align: center;
}

.prediction-form button.btn-primary {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* === Подсветка правильного ответа (например, точный прогноз) === */
.correct {
    background-color: rgba(40, 167, 69, 0.2); /* светло-зелёный */
    border-left: 4px solid #28a745;
}

/* === Адаптивность иконок на мобильных === */
.bi {
    font-size: 1.2rem;
}

/* === Уведомления === */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    animation: fadeInOut 3s ease-in-out;
    opacity: 0;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* === Анимации для перехода между страницами === */
#matches-by-day {
    position: relative;
    min-height: 300px;
}

.matches-container {
    animation: fadeIn 0.5s ease-out;
}

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

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Стили для пагинации */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.page-item {
    margin: 0 3px;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f8f9fa;
    color: #0d6efd; /* Синий цвет в тон сайта */
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.page-link:hover:not(.disabled) {
    background-color: #e9ecef;
    border-color: #0d6efd;
    color: #0d6efd;
    transform: translateY(-1px);
}

.page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.page-item.disabled .page-link {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Стили для стрелок */
.page-link.arrow {
    font-size: 1rem;
}

/* Добавим немного тени для активных элементов */
.page-item.active .page-link {
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

/* Добавленные стили для иконки аналитики*/
#main-chart-icon {
    font-size: 1.5rem;
    color: #0d6efd; /* Цвет иконки */
    transition: all 0.2s ease-in-out;
}

#main-chart-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Стили для иконок в заголовках */
#rounds-table th i {
    font-size: 1.2em; /* Размер иконки */
    vertical-align: middle; /* Выравнивание по вертикали */
}

/* === Стили для аккордеона статей === */
.article {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.2s ease-in-out;
}

.article:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.article-header {
    background-color: #f8f9fa;
    padding: 1rem 1.25rem;
    margin: 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.article-header:hover {
    background-color: #e9ecef;
}

.article-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: #212529;
}

.article-toggle-icon {
    transition: transform 0.3s ease;
    color: #6c757d;
    font-size: 1.2rem;
}

.article-header.collapsed .article-toggle-icon {
    transform: rotate(-90deg);
}

.article-meta {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.article-body {
    padding: 0 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
}

.article-body.show {
    padding: 1rem 1.25rem;
    max-height: 2000px;
}

.article-content {
    margin-top: 0.5rem;
    white-space: pre-line; /* ВАЖНО: сохраняет переносы строк и множественные пробелы */
}

/* Бледно-зеленый блок для результата матча */
.match-result-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #155724;
    background-color: #d4edda;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Бледно-зеленый блок для точного счёта */
.match-score-exact {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #155724;
    background-color: #d4edda;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Бледно-жёлтый блок для правильного исхода */
.match-score-outcome {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #856404;
    background-color: #fff3cd;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Бледно-красный блок для неверного прогноза */
.match-score-wrong {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #721c24;
    background-color: #f8d7da;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
}