

html, body {
  height: 100%;
  margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
    margin-top: 30px;
}

header, footer {
    background: linear-gradient(135deg, #87CEEB, #4169E1);
    position: relative;
    z-index: 1;
}

footer {
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* ================================
   КРАСИВЫЙ ЛОГОТИП И БРЕНДИНГ
   ================================ */

.brand-logo {
    text-decoration: none !important;
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tennis-ball-icon {
    position: relative;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.tennis-ball-icon svg {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand-primary {
    font-size: 1.1rem;
    font-weight: 800;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

.brand-secondary {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

/* Анимация при наведении на логотип */
@keyframes tennisGlow {
    0%, 100% { 
        filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    }
    50% { 
        filter: drop-shadow(2px 2px 8px rgba(139,195,74,0.8));
    }
}

@keyframes ballRotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.brand-logo:hover .tennis-ball-icon {
    animation: tennisGlow 2s ease-in-out infinite;
}

.brand-logo:hover .tennis-ball-icon svg {
    animation: ballRotate 2s ease-in-out infinite;
}

/* ================================
   СТИЛИ ДЛЯ ГЛАВНОЙ СТРАНИЦЫ
   ================================ */

#heroCarousel {
    z-index: 0;
}

/* Карусель Hero */
.hero-slide {
    height: 70vh;
    min-height: 500px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    position: relative;
}

.carousel-fade .carousel-item {
    opacity: 0;
    transition-duration: 0.6s;
    transition-property: opacity;
}

.carousel-fade .carousel-item.active,
.carousel-fade .carousel-item-next.carousel-item-start,
.carousel-fade .carousel-item-prev.carousel-item-end {
    opacity: 1;
}

.carousel-fade .carousel-item-next,
.carousel-fade .carousel-item-prev {
    transform: translateX(0);
}

/* Улучшения для карусели */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    opacity: 0.8;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

.carousel-indicators {
    margin-bottom: 2rem;
}

.carousel-indicators [data-bs-target] {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

/* Статистические карточки */
.stats-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

/* Кликабельные карточки статистики */
a:hover .stats-card .card-title,
a:hover .stats-card .display-6 {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

a:hover .stats-card .text-primary {
    color: #0056b3 !important;
}

a:hover .stats-card .text-success {
    color: #1e7e34 !important;
}

a:hover .stats-card .text-warning {
    color: #e0a800 !important;
}

a:hover .stats-card .text-info {
    color: #117a8b !important;
}

/* Карточки контента */
.content-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none !important;
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
}

/* Градиентные фоны */
.bg-gradient-primary {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
}

.bg-gradient-success {
    background: linear-gradient(135deg, #28a745, #1e7e34) !important;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800) !important;
}

.bg-gradient-info {
    background: linear-gradient(135deg, #17a2b8, #117a8b) !important;
}

/* Call to Action секция */
.cta-section {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="40" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="80" r="2" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
    opacity: 0.5;
}

/* ================================
   МОБИЛЬНОЕ БОКОВОЕ МЕНЮ
   ================================ */

.mobile-side-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background-color: #ffffff;
    z-index: 1050;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    transition: right 0.3s ease;
    overflow-y: auto;
    transform: translateX(100%);
}

.mobile-side-menu.show {
    right: 0;
    transform: translateX(0);
}

/* Overlay для мобильного меню */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.mobile-menu-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Заголовок мобильного меню */
.mobile-menu-header {
    background: linear-gradient(135deg, #87CEEB, #4169E1);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dee2e6;
}

.mobile-menu-header h5 {
  margin: 0;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    font-weight: 600;
}

.mobile-menu-content {
  padding: 0;
}

/* Список навигации в мобильном меню */
.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-list li {
  border-bottom: 1px solid #f8f9fa;
}

.mobile-nav-link {
  display: block;
  padding: 1rem 1.5rem;
  color: #333;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  background-color: #e3f2fd;
  color: #1976d2;
  text-decoration: none;
}

.mobile-nav-link i {
  margin-right: 0.5rem;
  width: 1.2rem;
}

/* Кнопка закрытия меню */
.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 1;
    color: white;
}

/* Скрытие мобильного меню на десктопе */
@media (min-width: 992px) {
    .mobile-side-menu,
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* ================================
   ОБЩИЕ СТИЛИ КОМПОНЕНТОВ
   ================================ */

.bg-light-darker {
    background-color: #e9ecef;
}

.bg-light-subtle {
    background-color: #f8f9fa;
}

.required-asterisk {
    color: #dc3545;
    font-weight: bold;
}

.participant-form {
    transition: opacity 0.3s ease;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.text-danger {
    font-size: 0.8em;
    margin-top: 0.25em;
}

#no-participants {
    margin-bottom: 1rem;
    font-style: italic;
}

/* Цветные границы для групп */
.border-primary {
    border-color: #007bff !important;
    border-left-width: 4px !important;
}

.border-success {
    border-color: #28a745 !important;
    border-left-width: 4px !important;
}

.border-info {
    border-color: #17a2b8 !important;
    border-left-width: 4px !important;
}

.border-warning {
    border-color: #ffc107 !important;
    border-left-width: 4px !important;
}

/* Стили для кнопок */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
    transition: all 0.2s ease;
    border-width: 2px;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-danger:hover {
    color: #fff;
}

/* Стили для секции */
.section {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Стили для полей формы */
.form-label {
    font-weight: 700;
    color: #343a40;
    font-size: 1rem;
}

.form-control,
.form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Стили для карточек */
.card {
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.125);
    background-color: #fff;
    margin-bottom: 15px;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.card-header.bg-light-darker {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.card-body {
    padding: 1.5rem;
}

.voluminous-label {
    margin-bottom: 0.5rem;
}

/* ================================
   СТИЛИ ДЛЯ ТАБЛИЦЫ СЕТОВ
   ================================ */

#set-formset .table {
    margin-bottom: 0;
    border-collapse: collapse;
}

#set-formset .table th,
#set-formset .table td {
    vertical-align: middle;
    padding: 8px;
}

#set-formset .table thead th {
    background-color: #f8f9fa;
    font-weight: bold;
    text-align: center;
}

#set-formset .set-number-col {
    width: 10%;
}

#set-formset .score-col {
    width: 20%;
}

#set-formset .action-col {
    width: 15%;
}

#set-formset .set-form input[type="number"] {
    width: 100%;
    padding: 5px;
    font-size: 0.9rem;
}

#set-formset .set-form .btn.delete-set {
    font-size: 0.8rem;
    padding: 4px 8px;
    min-width: 60px;
}

#set-formset .set-form .text-danger {
    font-size: 0.8rem;
}

#set-formset .set-form {
    transition: opacity 0.3s;
}

#set-formset .set-form[style*="display: none"] {
    opacity: 0;
}

/* ================================
   МОБИЛЬНАЯ АДАПТИВНОСТЬ 
   ================================ */

/* Основные медиа-запросы для смартфонов */
@media (max-width: 767.98px) {
    
    /* === ОБЩИЕ СТИЛИ === */
    body {
        font-size: 14px;
        line-height: 1.4;
    }
    
    /* Контейнер с отступами для мобильных */
    main .container {
        padding-left: 15px;
        padding-right: 15px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    
    /* === НАВИГАЦИЯ === */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Адаптация логотипа для мобильных */
    .logo-container {
        gap: 8px;
    }
    
    .tennis-ball-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .brand-primary {
        font-size: 0.9rem;
        letter-spacing: 0.5px;
    }
    
    .brand-secondary {
        font-size: 0.75rem;
        letter-spacing: 0.25px;
    }
    
    /* Улучшенные стили для мобильного меню */
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #87CEEB, #4169E1) !important;
        border-top: 1px solid rgba(255,255,255,0.2);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 10000 !important;
    }
    
    .navbar-nav .nav-link {
        padding: 12px 15px;
        font-size: 16px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        color: #333 !important;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(255,255,255,0.1);
    }
    
    .navbar-nav .nav-link i {
        margin-right: 8px;
        font-size: 18px;
    }
    
    .dropdown-menu {
        border: none;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        background-color: rgba(255,255,255,0.95);
    }
    
    /* === КАРТОЧКИ И КОНТЕНТ === */
    .card-header {
        padding: 12px 15px;
        font-size: 16px;
        font-weight: 600;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* === ТАБЛИЦЫ === */
    .table-responsive {
        border: none;
        margin-bottom: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 13px;
        margin-bottom: 0;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        vertical-align: middle;
    }
    
    .table th {
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* === КНОПКИ === */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 6px;
        touch-action: manipulation;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .btn-group .btn {
        margin-right: 4px;
    }
    
    .btn i {
        font-size: 16px;
    }
    
    .btn:active {
        transform: translateY(1px);
    }
    
    /* === ФОРМЫ === */
    .form-control {
        padding: 12px 15px;
        font-size: 16px; /* Предотвращает zoom на iOS */
        border-radius: 6px;
    }
    
    .form-select {
        padding: 12px 15px;
        font-size: 16px;
        border-radius: 6px;
    }
    
    .form-label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 6px;
    }
    
    /* Адаптация форм с сеткой Bootstrap */
    .row.g-2.align-items-center {
        margin-bottom: 1rem;
    }
    
    .row.g-2.align-items-center .col-4 {
        flex: 0 0 auto;
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .row.g-2.align-items-center .col-8 {
        flex: 0 0 auto;
        width: 100%;
    }
    
    .row.g-2.align-items-center .form-label {
        text-align: left !important;
        margin-bottom: 0.25rem;
    }
    
    /* Секции форм на мобильных */
    .section {
        padding: 15px;
        max-width: 100%;
    }
    
    .p-3.rounded.bg-light-subtle {
        padding: 1rem !important;
        margin-bottom: 1rem;
    }
    
    /* Группы полей */
    .border-start.border-4 {
        border-left-width: 3px !important;
        padding-left: 1rem;
    }
    
    /* === ПАГИНАЦИЯ === */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-link {
        padding: 8px 12px;
        font-size: 14px;
        margin: 2px;
        border-radius: 4px;
    }
    
    /* === АЛЕРТЫ И УВЕДОМЛЕНИЯ === */
    .alert {
        padding: 12px 15px;
        font-size: 14px;
        border-radius: 6px;
        margin-bottom: 15px;
    }
    
    /* === СТАТИСТИКА === */
    .row.text-center .col {
        margin-bottom: 15px;
    }
    
    .row.text-center h4 {
        font-size: 1.5rem;
    }
    
    .row.text-center small {
        font-size: 12px;
    }
    
    /* === ФУТЕР === */
    footer {
        padding: 15px 0;
        text-align: center;
        font-size: 13px;
    }
    
    /* === СПЕЦИАЛЬНЫЕ КОМПОНЕНТЫ === */
    .list-group-item {
        padding: 12px 15px;
        border-left: none;
        border-right: none;
    }
    
    .progress {
        height: 8px;
        border-radius: 4px;
    }
    
    /* === УЛУЧШЕНИЯ UX === */
    .mb-3 {
        margin-bottom: 1.2rem !important;
    }
    
    .mt-3 {
        margin-top: 1.2rem !important;
    }
    
    .d-mobile-none {
        display: none !important;
    }
    
    .btn-mobile-full {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Таблица сетов на мобильных */
    #set-formset .table th,
    #set-formset .table td {
        padding: 6px 4px;
        font-size: 12px;
    }
    
    #set-formset .set-form input[type="number"] {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    #set-formset .set-form .btn.delete-set {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 50px;
    }
    
    /* === СПЕЦИФИЧНЫЕ СТРАНИЦЫ === */
    .tournament-bracket {
        font-size: 12px;
    }
    
    .game-details .row > div {
        margin-bottom: 10px;
    }
    
    /* === АНИМАЦИИ И ПЕРЕХОДЫ === */
    .nav-link,
    .btn,
    .card {
        transition: all 0.2s ease;
    }
    
    /* Главная страница на мобильных */
    .hero-slide {
        height: 60vh;
        min-height: 400px;
    }
    
    .hero-slide .display-4 {
        font-size: 2rem !important;
    }
    
    .hero-slide .lead {
        font-size: 1rem !important;
    }
    
    .hero-slide .btn-lg {
        padding: 0.75rem 1.5rem !important;
        font-size: 1rem !important;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .stats-card .display-6 {
        font-size: 2rem !important;
    }
    
    .stats-card .h2 {
        font-size: 1.5rem !important;
    }
}

/* === ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 576px) === */
@media (max-width: 575.98px) {
    
    main .container {
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 15px;
        padding-bottom: 15px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .table th,
    .table td {
        padding: 6px 4px;
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .row > .col {
        margin-bottom: 10px;
    }
    
    .text-muted {
        display: none;
    }
    
    /* Упрощение логотипа на очень маленьких экранах */
    .brand-primary {
        font-size: 0.8rem;
    }
    
    .brand-secondary {
        font-size: 0.7rem;
    }
    
    .tennis-ball-icon svg {
        width: 20px;
        height: 20px;
    }
    
    /* Главная страница на очень маленьких экранах */
    .hero-slide {
        height: 50vh;
        min-height: 350px;
    }
    
    .hero-slide .display-4 {
        font-size: 1.5rem !important;
        line-height: 1.2;
    }
    
    .hero-slide .lead {
        font-size: 0.9rem !important;
    }
    
    .hero-slide .btn-lg {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem;
    }
    
    .carousel-control-prev,
    .carousel-control-next {
        display: none;
    }
    
    .carousel-indicators {
        margin-bottom: 1rem;
    }
}

/* === LANDSCAPE ОРИЕНТАЦИЯ ДЛЯ МОБИЛЬНЫХ === */
@media (max-width: 767.98px) and (orientation: landscape) {
    
    main .container {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    
    .card {
        margin-bottom: 10px;
    }
    
    .card-body {
        padding: 10px;
    }
}

/* === УТИЛИТАРНЫЕ КЛАССЫ ДЛЯ МОБИЛЬНЫХ === */
@media (max-width: 767.98px) {
    .mobile-text-center { text-align: center !important; }
    .mobile-text-left { text-align: left !important; }
    .mobile-text-right { text-align: right !important; }
    .mobile-d-none { display: none !important; }
    .mobile-d-block { display: block !important; }
    .mobile-w-100 { width: 100% !important; }
    .mobile-mb-3 { margin-bottom: 1rem !important; }
    .mobile-mt-3 { margin-top: 1rem !important; }
}