* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    padding: 10px;
    position: relative;
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.3s ease;
    padding-bottom: 120px;
}

/* ========== ТЁМНАЯ ТЕМА (КОСМОС) ========== */
body.dark {
    background: radial-gradient(ellipse at bottom, #0d1d31 0%, #0c0d13 100%);
    color: #e0e6f0;
}

/* Статичные звёзды */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}
.star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    opacity: 0.7;
    animation: moveStars linear infinite, twinkle 2s infinite alternate;
}
@keyframes moveStars {
    from { transform: translateY(0) translateX(0); }
    to { transform: translateY(1000px) translateX(200px); }
}
@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Падающие звёзды и кометы */
.shooting-star, .comet {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    animation: fall linear forwards;
}
.shooting-star {
    width: 2px;
    height: 2px;
    background: white;
    box-shadow: 0 0 4px white;
    border-radius: 50%;
}
.comet {
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #ffdd99, #ffaa44);
    box-shadow: 0 0 12px #ffaa44;
    border-radius: 50%;
}
@keyframes fall {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--x-distance, 300px), var(--y-distance, 800px)) rotate(0deg); opacity: 0; }
}

/* ========== СВЕТЛАЯ ТЕМА (НЕБО) ========== */
body.light {
    background: linear-gradient(145deg, #87CEEB 0%, #b0e0ff 50%, #e0f0ff 100%);
    color: #1e2a3a;
}

/* Солнце */
.sun {
    position: fixed;
    top: 40px;
    right: 40px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #FFD700, #FFA500);
    border-radius: 50%;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
    pointer-events: none;
    z-index: 1;
    animation: sunGlow 3s infinite alternate;
}
@keyframes sunGlow {
    from { transform: scale(1); box-shadow: 0 0 30px gold; }
    to { transform: scale(1.05); box-shadow: 0 0 60px #ffcc00; }
}
.sun-pulse {
    animation: sunPulse 0.5s ease-in-out;
}
@keyframes sunPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

/* Птицы */
.bird {
    position: fixed;
    width: 30px;
    height: 20px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M12,20c-4.41,0-8-3.59-8-8s3.59-8,8-8s8,3.59,8,8 S16.41,20,12,20z M12,6c-3.31,0-6,2.69-6,6s2.69,6,6,6s6-2.69,6-6S15.31,6,12,6z"/></svg>') no-repeat center;
    background-size: contain;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2));
    pointer-events: none;
    z-index: 2;
    animation: fly linear forwards;
}
@keyframes fly {
    0% { transform: translateX(0) translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateX(var(--fly-distance, 100vw)) translateY(-50px) rotate(5deg); opacity: 0; }
}

/* Облака */
.cloud {
    position: fixed;
    width: 120px;
    height: 70px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 80% 20% 70% 30% / 60% 50% 50% 40%;
    box-shadow: 20px 20px 30px rgba(0,0,0,0.1);
    pointer-events: none;
    z-index: 1;
    animation: drift linear forwards;
}
.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}
.cloud::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 15px;
}
.cloud::after {
    width: 70px;
    height: 70px;
    top: -35px;
    left: 45px;
}
@keyframes drift {
    0% { transform: translateX(0); opacity: 0.8; }
    100% { transform: translateX(var(--cloud-distance, 150vw)); opacity: 0; }
}

/* ========== ОБЩИЕ СТИЛИ ДЛЯ КОНТЕЙНЕРА И КАРТОЧЕК ========== */
.container {
    position: relative;
    z-index: 10;
    max-width: 100%;
    width: calc(100% - 40px);
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.62);      /* вернули фон */
    backdrop-filter: blur(12px);           /* вернули размытие */
    border-radius: 24px;
    padding: 20px;
    transition: all 0.3s;
    box-shadow: none;
}
body.light .container {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    color: #1e2a3a;
}
body.dark .container {
    background: rgba(0, 0, 0, 0.72);  /* более прозрачный, как в светлой */
    backdrop-filter: blur(10px);       /* такое же размытие, как в светлой */
}

/* ========== ВЕРХНЯЯ ПАНЕЛЬ (НОВАЯ СТРУКТУРА) ========== */
.top-bar-placeholder {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    padding: 18px 22px;
    margin-bottom: 20px;
    border-radius: 32px;
    background: transparent; /* фон прозрачный, так как фон есть у контейнера */
}
/* Все дочерние стили скопируйте из старых .top-bar .left-section и т.д., но с префиксом .top-bar-placeholder */

/* Стили для элементов внутри top-bar-placeholder */
.top-bar-placeholder .logo {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
}
body.dark .top-bar-placeholder .logo { color: #fff; }
body.light .top-bar-placeholder .logo { color: #1e2a3a; text-shadow: 0 0 4px rgba(136,170,255,0.6); }

.top-bar-placeholder .left-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.top-bar-placeholder .right-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.top-bar-placeholder .top-buttons {
    display: flex;
    gap: 12px;
}

.top-bar-placeholder .theme-toggle,
.top-bar-placeholder .complaint-btn,
.top-bar-placeholder .admin-btn,
.top-bar-placeholder .lang-btn,
.top-bar-placeholder .profile-btn {
    background: rgba(255,255,255,0.08);
    color: white;
    border: 1px solid rgba(255,255,255,0.18);
    padding: 10px 18px;
    border-radius: 40px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    font-size: 16px;
    font-weight: 600;
}
body.light .top-bar-placeholder .theme-toggle,
body.light .top-bar-placeholder .complaint-btn,
body.light .top-bar-placeholder .admin-btn,
body.light .top-bar-placeholder .lang-btn,
body.light .top-bar-placeholder .profile-btn {
    background: rgba(255,255,255,0.92);
    color: #1e2a3a;
    border-color: rgba(0,0,0,0.12);
}
.top-bar-placeholder .theme-toggle:hover,
.top-bar-placeholder .complaint-btn:hover,
.top-bar-placeholder .admin-btn:hover,
.top-bar-placeholder .lang-btn:hover,
.top-bar-placeholder .profile-btn:hover {
    background: rgba(255,255,255,0.16);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.15);
}

.top-bar-placeholder .admin-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: rgba(255,255,255,0.85);
}
body.light .top-bar-placeholder .admin-meta {
    color: #1e2a3a;
}

/* ========== НИЖНЯЯ НАВИГАЦИЯ ========== */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: calc(100% - 40px);
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(16px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    z-index: 100;
    border-radius: 60px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.25);
}
body.light .bottom-nav {
    background: rgba(255,255,255,0.75);
}
/* Исправление для кнопок нижней навигации - текст не выходит за рамки */
.bottom-nav a,
.bottom-nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    min-width: 64px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: white;
    font-size: 28px; /* Увеличен размер иконки */
    text-decoration: none;
    border-radius: 50%;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    white-space: nowrap;
    overflow: visible;
}
body.light .bottom-nav a,
body.light .bottom-nav button {
    color: #1e2a3a;
    background: rgba(255,255,255,0.92);
    border-color: rgba(0,0,0,0.12);
}
.bottom-nav a:hover,
.bottom-nav button:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}
/* Анимация перехода */
.page-transition {
    animation: pageFlip 0.4s ease-in-out;
}
@keyframes pageFlip {
    0% { transform: rotateX(0deg); opacity: 1; }
    50% { transform: rotateX(90deg); opacity: 0.3; }
    100% { transform: rotateX(0deg); opacity: 1; }
}

/* ========== КНОПКИ И ФОРМЫ ========== */
.btn {
    display: inline-block;
    background: rgba(255,255,255,0.08);
    color: white;
    padding: 10px 20px;
    border-radius: 40px;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    border: 1px solid rgba(255,255,255,0.18);
    cursor: pointer;
    margin: 5px;
}
body.light .btn {
    background: rgba(255,255,255,0.92);
    color: #1e2a3a;
    border-color: rgba(0,0,0,0.12);
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.35);
    background: rgba(255,255,255,0.15);
}

/* Карточки */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.card {
    background: rgba(255,255,255,0.9);
    border-radius: 32px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
body.dark .card {
    background: rgba(30,30,40,0.9);
    color: #eee;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.2);
}
.card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.card-content {
    padding: 15px;
}
.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}
.photo-gallery a {
    max-width: 100%;
    display: block;
}
.photo-gallery img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 600px;
    border-radius: 28px;
    object-fit: contain;
    display: block;
}
.comment {
    background: rgba(0,0,0,0.05);
    border-radius: 28px;
    padding: 15px;
    margin-bottom: 15px;
}
body.dark .comment {
    background: rgba(255,255,255,0.1);
}
.comment-actions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.admin-actions .btn {
    flex: 1 1 150px;
    min-width: 140px;
}

.stats-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 14px;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.8);
}

.stats-summary p {
    margin: 0;
}

#visitsChart {
    width: 100% !important;
    max-height: 480px;
    height: 400px;
    display: block;
}
.form-group {
    margin-bottom: 20px;
}
.form-control {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 40px;
    font-size: 16px;
    transition: 0.2s;
    background: rgba(0,0,0,0.85);
    color: white;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.05);
}
body.light .form-control {
    background: rgba(255,255,255,0.95);
    color: #1e2a3a;
    border-color: rgba(0,0,0,0.14);
}
.notification {
    padding: 12px 18px;
    border-radius: 16px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}
.notification.success {
    background: rgba(76, 175, 80, 0.18);
    border-left: 3px solid #4caf50;
    color: #4caf50;
}
.notification.error {
    background: rgba(255, 87, 87, 0.18);
    border-left: 3px solid #ff5757;
    color: #ff5757;
}
body.light .notification.success {
    background: rgba(76, 175, 80, 0.12);
}
body.light .notification.error {
    background: rgba(255, 87, 87, 0.12);
}
.char-counter {
    display: block;
    text-align: right;
    font-size: 12px;
    margin-top: 5px;
    color: #aaa;
}
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    animation: fadeIn 0.2s;
}
.modal-content {
    background: #fefefe;
    margin: 15% auto;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    border-radius: 48px;
    animation: slideIn 0.3s;
}
body.dark .modal-content {
    background: #2c3e50;
    color: white;
}
body.light .modal-content {
    background: #ffffff;
    color: #1e2a3a;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.profile-box {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(255,255,255,0.12);
    border-radius: 40px;
}
.profile-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.2);
}

/* ========== МОБИЛЬНАЯ ВЕРСИЯ - УВЕЛИЧЕННЫЕ РАЗМЕРЫ ========== */
@media (max-width: 768px) {
    /* Контейнер */
    .container {
        padding: 16px;
        border-radius: 24px;
        width: calc(100% - 20px);
        margin: 0 auto;
    }
    
    /* Заголовки */
    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    /* Формы и поля ввода */
    .form-control {
        padding: 14px 18px;
        font-size: 16px;
        border-radius: 48px;
    }
    
    label {
        font-size: 14px;
        margin-bottom: 6px;
        display: block;
    }
    
    /* Кнопки */
    .btn {
        padding: 14px 24px;
        font-size: 16px;
        border-radius: 48px;
        width: 100%;
        text-align: center;
        margin: 8px 0;
    }
    
    /* Чекбокс */
    .form-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
        transform: scale(1.2);
        margin-right: 8px;
    }
    
    /* Ссылки */
    .auth-links {
        margin-top: 20px;
        text-align: center;
    }
    
    .auth-links p {
        font-size: 14px;
    }
    
    .auth-links a {
        font-size: 14px;
        padding: 8px 16px;
        display: inline-block;
    }
    
    /* Нижняя панель - УВЕЛИЧЕННАЯ */
    .bottom-nav {
        position: fixed;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 30px);
        max-width: 350px;
        background: rgba(0,0,0,0.7);
        backdrop-filter: blur(16px);
        display: flex;
        justify-content: space-around;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        border-radius: 60px;
        z-index: 100;
    }
    
    .bottom-nav a,
    .bottom-nav button {
        width: 60px;
        height: 60px;
        min-width: 60px;
        font-size: 28px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Отступ снизу для контента, чтобы не перекрывался панелью */
    body {
        padding-bottom: 100px;
    }
    
    /* Модальные окна */
    .modal-content {
        margin: 25% auto;
        padding: 20px;
        width: 92%;
        border-radius: 32px;
    }
    
    .modal-content h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .modal-content .btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* Для очень маленьких экранов (до 480px) */
@media (max-width: 480px) {
    .bottom-nav {
        gap: 5px;
        padding: 6px 10px;
    }
    
    .bottom-nav a,
    .bottom-nav button {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 20px;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    .container {
        padding: 10px;
        border-radius: 16px;
    }
    
    .modal-content {
        margin: 40% auto;
        padding: 14px;
    }
}

/* Убираем скроллбары, где они не нужны на мобильных */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 3px;
        height: 3px;
    }
    
    /* Улучшаем отступы для touch элементов */
    button, 
    .btn,
    .dialog-item,
    .rec-chip {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Исправляем переполнение текста */
    p, li, td, th {
        word-break: break-word;
    }
    
    /* Чат сообщения */
    .msg-row.mine .msg-wrap,
    .msg-row.other .msg-wrap {
        max-width: 90%;
    }
}
/* ── Пункт 13: textarea жалоб розширюється вниз, не в бік ── */
.modal-content textarea.form-control {
    border-radius: 16px;
    resize: vertical;
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
}

/* ── Пункт 14: відступ від скролбара для #msgList ── */
#msgList {
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
#msgList::-webkit-scrollbar { width: 4px; }
#msgList::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* ── Пункт 11: плавний перехід теми ── */
body { transition: background 0.4s ease, color 0.3s ease, opacity 0.25s ease; }

/* ── Пункт 7: вирівнювання top-bar-placeholder ── */
.top-bar-placeholder {
    width: 100%;
    box-sizing: border-box;
}
/* ── Textarea жалоб — розширюється вниз ── */
.modal-content textarea.form-control {
    resize: vertical;
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ── Місяць ── */
.moon {
    position: fixed;
    top: 40px;
    right: 40px;
    width: 70px;
    height: 70px;
    background: radial-gradient(circle at 30% 30%, #f5f5dc, #c0c0c0);
    border-radius: 50%;
    box-shadow: 0 0 20px silver;
    pointer-events: none;
    z-index: 1;
    transition: transform 0.5s, opacity 0.3s;
}

/* ── Анімація небесних тіл ── */
@keyframes rotateAndMove {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(-150px, 80px) rotate(360deg); opacity: 0; }
}

/* ── msgList відступ від скролбара ── */
#msgList {
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
#msgList::-webkit-scrollbar { width: 4px; }
#msgList::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }