/* Базовые общие стили для main.html
 * Вынесены переменные темы, типографика и ключевые блоки:
 * навигация, логотип, главная карточка и action-кнопки.
 * Цвета оставлены исходными.
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00bcd4;
    --primary-dark: #0097a7;
    --secondary-color: #ff9800;
    --background-dark: #1a1a1a;
    --background-card: #2a2a2a;
    --background-card-hover: #333333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    --border-color: #333333;
    --shadow-light: 0 4px 20px rgba(0, 188, 212, 0.1);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-heavy: 0 15px 50px rgba(0, 0, 0, 0.5);
    --gradient-primary: linear-gradient(135deg, #00bcd4, #0097a7);
    --gradient-secondary: linear-gradient(135deg, #ff9800, #f57c00);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --background-dark: #f8f9fa;
    --background-card: #ffffff;
    --background-card-hover: #f1f3f4;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow-light: 0 4px 20px rgba(0, 188, 212, 0.15);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 15px 50px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Альтернативный шрифт для главной (main.html) */
body.use-arial {
    font-family: 'Arial', sans-serif;
}

/* Info / Help link in nav */
.info-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.info-nav-link img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.info-nav-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px) scale(1.08);
    opacity: 0.9;
}

.info-nav-link:active {
    transform: translateY(-1px) scale(0.98);
}

/* Theme toggle in nav */
.theme-toggle-btn {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 18%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.theme-toggle-btn:hover {
    background: var(--background-card-hover);
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.theme-toggle-btn:active {
    transform: translateY(-1px) scale(0.95);
}

.theme-icon {
    font-size: 18px;
    transition: all 0.3s ease;
}

/* Кнопка темы в навбаре — единый «красивый» стиль на всех страницах (main, statistic, list, edit_participants) */
.main-nav .nav-controls .theme-toggle-btn {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 18%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.main-nav .nav-controls .theme-toggle-btn:hover {
    background: var(--background-card-hover);
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.main-nav .nav-controls .theme-toggle-btn:active {
    transform: translateY(-1px) scale(0.95);
}

.main-nav .nav-controls .theme-icon {
    font-size: 18px;
    transition: all 0.3s ease;
}

/* Language selector (statistic, list) */
.language-selector {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    min-width: 80px;
    height: 28px;
}

.language-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.2);
}

.language-selector option {
    background-color: var(--background-card-hover);
    color: var(--text-primary);
}

/* Общий контейнер страницы */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Заголовок страницы */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 0;
}

.header h1 {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 188, 212, 0.3);
}

.header p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 20px;
}

/* Ссылка «Назад» */
.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    display: inline-block;
    margin-top: 10px;
    padding: 0;
    font-size: 18px;
}

.back-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Блок кнопки «На главную» */
.home-button-container {
    text-align: center;
    margin-top: 0;
    padding: 0 20px;
}

.home-button {
    background: var(--background-card);
    color: var(--text-primary);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    border-top: none;
    width: 50%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.home-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
}

.home-button:hover {
    background: var(--gradient-secondary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.header-button {
    margin-top: 0;
    margin-bottom: 0;
}

.header-home-button {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: none;
}

/* Индикатор загрузки */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--primary-color);
    font-size: 18px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Блок ошибки */
.error {
    background: var(--background-card-hover);
    color: #ff6b6b;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    border: 1px solid var(--border-color);
}

/* Вариант лого-секции для страниц статистики/списка (центр, подчёркивание) */
.logo-section.page-header {
    text-align: center;
    padding: 40px 20px;
    background: var(--background-card);
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 0;
}

.logo-section.page-header .logo {
    font-size: 48px;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(0, 188, 212, 0.5);
    margin-bottom: 10px;
}

.logo-section.page-header .tagline {
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.main-nav {
    background: var(--gradient-primary);
    padding: 18px 25px;
    box-shadow:
        0 4px 20px rgba(0, 188, 212, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 35px;
    flex-wrap: wrap;
    padding: 0 10px;
}

.main-nav a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 12px 18px;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-nav a img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: 25px;
    padding-right: 10px;
}

.logo-section {
    padding: 30px 20px 40px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    margin-bottom: 20px;
}

.logo {
    font-size: 34px;
    font-weight: bold;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    letter-spacing: 1px;
}

.tagline {
    color: var(--text-muted);
    font-size: 17px;
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.5px;
}

.content-sections {
    padding: 0;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.main-card-container {
    display: flex;
    justify-content: center;
    margin: 40px auto 60px auto;
    padding: 0 20px;
}

.main-card {
    background: linear-gradient(135deg, var(--background-dark), var(--background-card));
    border-radius: 28px;
    overflow: visible;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 188, 212, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 188, 212, 0.25);
    display: flex;
    flex-direction: column;
    min-height: 300px;
    width: fit-content;
    max-width: 100%;
    position: relative;
}

.main-card .card-image {
    position: relative;
    overflow: hidden;
    padding: 25px;
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.12), rgba(0, 151, 167, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border-radius: 28px 28px 0 0;
}

.main-card .card-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 16px;
    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(0, 188, 212, 0.15);
    border: 2px solid rgba(0, 188, 212, 0.25);
}

.main-card .card-content {
    padding: 55px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    text-align: center;
    background: linear-gradient(135deg, var(--background-dark), var(--background-card));
    border-radius: 0 0 28px 28px;
}

.main-card .card-content h2 {
    color: var(--primary-color);
    font-size: 34px;
    font-weight: 700;
    margin: 0 0 20px 0;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.main-card .card-content p {
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.75;
    margin: 0 0 18px 0;
}

.main-card .card-content p:first-of-type {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 19px;
}

.action-buttons-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 1200px;
    margin: 80px auto;
    padding: 0 20px;
}

.action-button {
    background: var(--gradient-primary);
    border-radius: 18px;
    padding: 18px 24px;
    text-align: center;
    cursor: pointer;
    box-shadow:
        0 6px 25px rgba(0, 188, 212, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
}

.button-content h3 {
    color: white;
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 12px 0;
    letter-spacing: 0.3px;
}

.button-content p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 17px;
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .main-nav {
        padding: 15px 18px;
        position: relative;
    }

    .main-card-container {
        margin: 25px 0 40px 0;
        padding: 0 15px;
    }

    .main-card {
        min-height: auto;
        max-width: 100%;
        width: 100%;
        border-radius: 20px;
    }

    .action-buttons-container {
        grid-template-columns: 1fr;
        gap: 25px;
        margin: 50px 0;
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .main-nav {
        padding: 10px 12px;
    }

    .main-card-container {
        margin: 10px 8px 20px 8px;
        padding: 0;
    }
}

/* Общие адаптивы для страниц со списками/статистикой */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    .header h1 {
        font-size: 28px;
    }

    .header p {
        font-size: 16px;
    }

    .nav-controls {
        gap: 10px;
        margin-left: 10px;
    }

    .language-selector {
        min-width: 70px;
        height: 26px;
        font-size: 11px;
    }

    .theme-toggle-btn,
    .main-nav .nav-controls .theme-toggle-btn {
        width: 30px;
        height: 30px;
    }

    .logo-section.page-header .logo {
        font-size: 36px;
    }

    .logo-section.page-header .tagline {
        font-size: 16px;
    }
}

