/* Основные переменные для легкой настройки */
:root {
    --bg-color: #0f0f0f;         /* Глубокий черный */
    --card-bg: #1e1e1e;          /* Темно-серый для карточек */
    --bg-dark: #000000cc;
    --text-main: #f1f1f1;        /* Почти белый */
    --text-gray: #aaaaaa;        /* Серый для второстепенного текста */
    --indian-red: #cd5c5c;       /* Твой основной акцентный цвет */
    --live-red: #ff4b4b;         /* Ярко-красный для значка LIVE */
    --white: #ffffff;            /* Белый */
    --gap: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

/* Шапка сайта */
header {
    height: 60px;
    display: flex;
    padding: 0 var(--gap);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #333;
    backdrop-filter: blur(10px);
    justify-content: space-between; /* Логотип слева, инфо справа */
    align-items: center;
    background: var(--bg-dark); /* Твой темный цвет */
}

header h1 {
    font-size: 1.5rem;
    color: var(--indian-red);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Контентная область */
main {
    display: flex;
    height: calc(100vh - 60px); /* Высота хедера */
    width: 100%;
    overflow: hidden;
}

/* Левая часть должна занять всё место и иметь высоту 100% от main */
.main-container {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    margin: 0;
    padding: 10px;
    flex-direction: column;
}

.logo {
    cursor: pointer;
    display: inline-block;
    transition: transform 0.3s ease-out;
    transform: translateZ(0); 
    filter: blur(0); 
    will-change: transform;
    text-decoration: none;
    color: inherit
}

.logo:hover {
    color: var(--white);
    transform: scale(1.05) translateZ(0);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px; /* Отступ между ником и числом */
    cursor: default;      /* Обычная стрелка вместо руки */
    user-select: none;    /* Запрещаем выделять текст синим цветом */
}

.header-name {
    font-weight: 500;
    font-size: 1rem;
}

.profile-trigger {

    cursor: pointer;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}
.header-profile {
    font-weight: 500;
    font-size: 1rem;
    color: rgb(160, 160, 160);
    transition: all 0.2s;
}

.profile-trigger:hover .header-auth {
    color: rgb(255, 255, 255);
    
}

.auth-trigger {
    display: none;
    cursor: pointer;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.auth-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-auth {
    font-weight: 500;
    font-size: 1rem;
    color: rgb(160, 160, 160);
    transition: all 0.2s;
}

.auth-trigger:hover .header-auth {
    color: rgb(255, 255, 255);
    
}

.header-viewers {
    background: rgba(255, 255, 255, 0.1); /* Легкая подложка */
    padding: 4px 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 6px;
    font-weight: bold;
    color: var(--indian-red); /* Делаем число акцентным */
}

/* Контейнер для обрезки */
#avatar-croppie-container {
    width: 100%;
    height: 320px; /* Увеличим высоту, чтобы влез и круг, и слайдер */
    margin-bottom: 10px;
}

/* Стилизация слайдера Croppie (зуммера) */
.cr-slider-wrap {
    margin: 10px auto;
    width: 80%;
    text-align: center;
}

.cr-slider {
    width: 100%;
    cursor: pointer;
}

/* Кнопка "Выбрать фото" под слайдером */
.upload-label {
    display: block;
    text-align: center;
    color: #ff4b4b;
    font-size: 12px;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1px;
    margin-top: 5px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.upload-label:hover {
    opacity: 0.8;
}


/*------------------------------------------------------------------------------*/

/* Оффлайн секция */
.offline-section {
    margin-top: 60px;
}

/* Оффлайн заголовок */
.offline-section h2 {
    margin-bottom: 25px;
    font-weight: 500;
    font-size: 1.5rem; /* Делаем размер одинаковым */
    padding-left: 15px;
    text-transform: none; /* Или uppercase, если хочешь капсом */
    /* Серая полоса слева */
    border-left: 4px solid var(--text-gray); /* Используем твой серый цвет */
    color: var(--text-main); /* Оставляем текст ярким, как в онлайне */
}

/* Оффлайн Контейнер */
.offline-container{
    display: grid;
    /* Автоматические колонки: минимум 280px, максимум - сколько влезет */
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--gap);
}

/* Оффлайн юзер */
.offline-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100px; /* Фиксированная ширина для ровности */
    text-decoration: none;
    color: inherit
}

.offline-user:hover {
    opacity: 0.7;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid; /* Цвет подтянется из inline-style */
    padding: 3px; /* Отступ между внешней обводкой и аватаркой */
    background: #111; /* Цвет "кольца" между обводкой и фото */
    transition: 0.3s;
}

.avatar-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: #2a2a2a; /* Фон, если картинка не загрузится */
}

.offline-user span {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-gray);
    margin-top: 8px;
    text-align: center;
    width: 100%;

    /* ИСПРАВЛЯЕМ ОБРЕЗКУ: */
    white-space: normal;    /* Разрешаем перенос на новую строку */
    overflow: visible;      /* Убираем скрытие текста */
    text-overflow: clip;    /* Убираем многоточие */

    width: 100%;
    line-height: 1.1;       /* Чтобы строки ников не слипались */
    word-break: break-word; /* Если ник — одно длинное слово, он перенесется */
}

/* Эффект при наведении на всю ссылку */
.offline-user:hover .user-avatar {
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--user-color); /* Если захочешь свечение */
}

/* Убираем черно-белый фильтр при наведении, если хочешь */
.offline-user:hover .avatar-image {
    filter: grayscale(0);
}
/*------------------------------------------------------------------------------*/

/* Онлайн заголовок */
.online-section h2 {
    margin-bottom: 25px;
    font-weight: 500;
    font-size: 1.5rem; /* Делаем размер одинаковым */
    padding-left: 15px;
    text-transform: none; /* Или uppercase, если хочешь капсом */
    /* Красная полоска для Онлайн (по умолчанию) */
    border-left: 4px solid var(--indian-red);
}

/* Онлайн Контейнер */
.online-container{
    display: grid;
    /* Автоматические колонки: минимум 280px, максимум - сколько влезет */
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--gap);
}

/* Карточка стрима */
.card {
    display: block;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    border-color: #444;
}

/* Превью (верхняя часть карточки) */
.card-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; 
    background: #000; /* Это и будут твои черные полоски */
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    
    /* Центрируем картинку внутри, если она меньше блока */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Сама картинка */
.preview-img {
    width: 100%;
    height: 100%;
    /* Вписывает картинку целиком, сохраняя пропорции */
    object-fit: contain; 
    display: block;
     /* Плавность смены прозрачности */
    transition: opacity 0.2s ease-in-out;
    opacity: 1;
    animation: initialFadeIn 0.2s ease-in-out;
}

/* Слой виньетки */
.card-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Поверх картинки (z-index: 0) */
    /* Мягкое затемнение по углам */
    background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
}

.card:hover .card-vignette {
    background: radial-gradient(circle, transparent 60%, rgba(0, 0, 0, 0.5) 100%);
    transition: background 0.3s ease;
}

/* Значок LIVE */
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--live-red);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    animation: blink 2s infinite;
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 15px 10px;
    display: flex;
    /* Изменяем это, чтобы растолкать элементы по краям */
    justify-content: space-between; 
    align-items: flex-end;
    pointer-events: none;
}

.overlay-duration {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8); /* Чуть тусклее белого */
    font-weight: 500;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
}

.overlay-nickname {
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 6px;
}

.overlay-viewers {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    pointer-events: none;
    animation: blink 2s infinite;
}

/* Информация под видео */
.card-body {
    padding: 15px;
    display: flex;
    gap: 12px;
}

.card-text h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-text p {
    font-size: 0.85rem;
    color: var(--text-gray);
}

/*------------------------------------------------------------------------------*/

/* Управление слоями */
.page-layer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    /* ЗАМЕНИ min-height: 80vh на это: */
    width: 100%;
    height: 100%; 
    
    animation: fadeIn 0.3s ease;
    overflow: hidden; /* Чтобы видео не создавало лишних скроллов */
}

.hidden { display: none !important; }

/* Контейнер видео должен растянуться на всю высоту левой части */
.video-container {
    flex: 1; /* ГОВОРИТ: "Займи всё свободное место по вертикали" */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.video-container:fullscreen {
    width: 100vw;
    height: 100vh;
    padding: 0;
    border-radius: 0; /* Убираем скругления в фуллскрине */
}

/* Специальное правило для режима "На весь экран" */
/*.video-container:fullscreen #videoElement {

}*/

/* Для Safari */
.video-container:-webkit-full-screen #videoElement {
    max-height: 100vh !important;
}

/* Обертка, которой управляет твоя функция */
.player-wrapper {
    position: relative;
    display: block; /* Важно, чтобы размеры из JS применялись корректно */
}
/* Кнопка LIVE (начальное состояние — скрыта) */
.live-badge-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    backdrop-filter: blur(4px);
    
    /* Плавное исчезновение/появление */
    opacity: 0; 
    transition: opacity 0.3s ease;
    pointer-events: none; /* Чтобы не кликалась, когда скрыта */
}

.player-wrapper:hover .live-badge-btn {
    opacity: 1;
    pointer-events: auto;
}

/* Сохраняем подсветку активного режима */
.live-badge-btn.active {
    background: #ff4b4b;
    border-color: #ff4b4b;
}

/* Показываем кнопку при наведении на обертку плеера */
.player-wrapper:hover .live-badge-btn {
    opacity: 1;
}

/* Мигание ТОЛЬКО для активного режима и ТОЛЬКО при наведении */
.player-wrapper:hover .live-badge-btn.active {
    animation: blink 2s linear infinite;
}

/* Панель управления (Снизу видео) */
.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0; /* Скрыто по умолчанию */
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* Показываем управление при наведении на обертку */
.player-wrapper:hover .player-controls {
    opacity: 1;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 100%; /* Чтобы элементы знали высоту панели */
}

#play-pause-btn {
    width: 30px; /* Зафиксируй ширину, чтобы она не "гуляла" */
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    flex-shrink: 0; /* Чтобы flex не пытался её сжать */
}

.volume-box {
    display: flex;
    align-items: center;
    position: relative;
    padding: 5px;
}

/* Обертка для ползунка */
/* Контейнер слайдера (скрыт по умолчанию) */
.slider-wrapper {
    width: 0;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    padding-left: 0;
}

/* Плавное раскрытие при наведении на весь блок */
.volume-box:hover .slider-wrapper {
    width: 90px; /* Финальная ширина с учетом отступа */
    opacity: 1;
    transform: translateX(0); /* Возвращаем в нормальное положение */
    pointer-events: auto; /* Разрешаем клики */
}

.ctrl-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.1s;
    filter: grayscale(1) brightness(2);
    line-height: 1; /* Убирает лишнее пространство вокруг текста/символа */
}

.ctrl-btn:active { transform: scale(0.9); }

/* Настраиваем таймер */
.stream-timer {
    display: flex;
    align-items: center;
    line-height: 1;
    margin: 0;
}

/* Стилизация самого ползунка (тонкая белая линия) */
#volume-slider {
    width: 80px;
    height: 4px;
    cursor: pointer;
    accent-color: #fff; /* Белый цвет ползунка */
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* Убираем стандартный вид кружка для Chrome, Edge, Safari */
#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 5px;  /* Твой новый размер (был около 15-20) */
    height: 5px; /* Твой новый размер */
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transform: scale(0.8);
    transition: transform 0.1s ease;
}

/* Аналогично для Firefox */
#volume-slider::-moz-range-thumb {
    width: 5px;
    height: 5px;
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transform: scale(0.8);
}

/* Дополнительно: чуть увеличиваем кружок при наведении, чтобы было легче попасть */
#volume-slider:hover::-webkit-slider-thumb {
    transform: scale(1);
}

/* Магия растягивания видео */
#videoElement {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Стили для сообщений (Бан / Оффлайн) */
.status-msg { text-align: center; }

.big-avatar {
    width: 140px;          /* Жесткая ширина */
    height: 140px;         /* Такая же высота для круга */
    border-radius: 50%;
    margin: 0 auto 20px;   /* Центрируем и даем отступ вниз */
    
    /* Картинка всегда по центру и заполняет весь круг */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Рамка */
    border: 4px solid #ff4b4b; 
    background-color: #222; /* Цвет фона, пока грузится фото */
    
    flex-shrink: 0;        /* Чтобы не сплющило в flex-контейнере */
    display: block;
}

/* Эффект для забаненных (опционально - ч/б ава) */
#banned-layer .big-avatar {
    filter: grayscale(1) opacity(0.5);
    border-color: #555;
}

.back-btn {
    margin-top: 20px;
    background: transparent;
    border: 1px solid var(--indian-red);
    color: var(--indian-red);
    padding: 10px 30px;
    cursor: pointer;
    transition: 0.3s;
}

.back-btn:hover {
    background: var(--indian-red);
    color: white;
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 12px;
    width: 340px;
    text-align: center;
}

.modal-header {
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 1px; }

.modal-info p:first-child {
    font-size: 14px;
    color: #888;
    margin-bottom: 2px;
}

.modal-info p:nth-last-child(2) {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.modal-info p:last-child {
    font-size: 12px;
    color: rgb(199, 0, 0);
    margin-bottom: 0px;
}

.modal-input {
    width: 100%;
    padding: 12px;
    background: #000;
    border: 1px solid #333;
    color: #fff;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9em;
    font-weight: bold;
    outline: none;
}

.modal-btn {
    width: 100%;
    padding: 12px;
    background: #ff4b4bc0; /* Твой цвет */
    color: rgb(220, 220, 220);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.modal-btn:hover {
    background: #ff4b4b; /* Твой цвет */
    color: white;
}

.modal-close-btn {
    margin-top: 15px;
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    color: #979797;
}

.settings-card { width: 380px; }

.avatar-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 2px solid #ff4b4b;
    margin-bottom: 10px;
    overflow: hidden;
    object-fit: cover;
}

.input-group {
    text-align: left;
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-size: 11px;
    color: #777;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #000;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #333;
}

.color-input {
    border: none;
    width: 30px;
    height: 30px;
    cursor: pointer;
    background: none;
}

.hex-text-input {
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    width: 150px;
    font-family: monospace;
    outline: none;
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
}
.hex-text-input:focus {
    border-color: #ff4b4b;
}

.main-content-wrapper {
    display: flex;
    width: 100%;             /* Растягиваем на всю ширину экрана */
    height: 100%; /* Высота на весь экран минус хедер */
    overflow: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* Анимация мигания для LIVE */
@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Адаптивность для мобилок */
@media (max-width: 480px) {
    main { padding: 10px; }
    .grid { gap: 10px; }
}

/* Эффект: из прозрачности и чуть-чуть снизу или просто проявление */
@keyframes initialFadeIn {
    from {
        opacity: 0;
        filter: brightness(0.5); /* Начинаем с темного кадра */
    }
    to {
        opacity: 1;
        filter: brightness(1);
    }
}