/* ====================================================================== */
/* 1. OGÓLNE STYLY BODY & HTML */
/* ====================================================================== */
body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    /* KLUCZOWE: Zapobiega przewijaniu całej strony */
    overflow: hidden; 
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #121212;
    color: #ffffff;
    line-height: 1.6;
}

/* ====================================================================== */
/* 2. SCROLLBARS (BEZ ZMIAN) */
/* ====================================================================== */
/* Firefox */
* {
    scrollbar-width: auto;
    scrollbar-color: rgb(236, 32, 32) #191919;
}

/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
    width: 16px;
}
*::-webkit-scrollbar-track {
    background: #191919;
}
*::-webkit-scrollbar-thumb {
    background-color: rgb(236, 32, 32);
    border-radius: 10px;
    border: 3px solid #191919;
}

/* ====================================================================== */
/* 3. WIDEO I TŁO (BEZ ZMIAN) */
/* ====================================================================== */
#mainVideo, #video {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: #000;
    object-fit: cover;
    z-index: 1; 
}
.mainstream{
    z-index: 0;
    position: static;
}
#smallVideo {
    max-width: 50px;
    height: auto;
    opacity: 0.8;
    z-index: 10;
    cursor: pointer;
}

/* ====================================================================== */
/* 4. PANELE BOCZNE - KLUCZOWA RESPONSZYWNOŚĆ */
/* ====================================================================== */
#leftPanel, #rightPanel {
    position: fixed;
    top: 0;
    /* Domyślna szerokość na większych ekranach */
    width: 20%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.4em;
    box-sizing: border-box;
    z-index: 20; 
    display: flex;	    
    /* KLUCZOWE: Użycie Flexbox do kontroli pionowej przestrzeni */
    flex-direction: column; 
    min-height: 0; /* Zapobieganie rozciąganiu w Flexboxie */
    transition: transform 1s;
}

#leftPanel {
    left: 0;
    transform: translateX(0);
    /* Lewy panel może się przewijać, bo ma dużo statycznej treści */
    overflow-y: auto;
}
#rightPanel {
    right: 0;
    transform: translateX(0);
    /* Prawy panel musi mieć ukryte przewijanie (przewija się tylko czat) */
    overflow-y: hidden; 
}

.hidden {
    transform: translateX(-100%);
}
.right-hidden {
    transform: translateX(100%);
}

/* ====================================================================== */
/* 5. ZAWARTOSĆ CZATU - POPRAWNE PRZEWIJANIE (FLEXBOX) */
/* ====================================================================== */

/* Elementy wideo i satelita, muszą być "sztywne", by czat zajął resztę miejsca */
#video2 {
    width: 100%;
    height: auto;
    max-height: 30vh; /* Zapobieganie zbytniej dominacji wideo */
    flex-shrink: 0; /* Nie pozwól Flexboxowi go ściskać */
    margin-bottom: 5px;
}
#rzut, #satelita {
    width: 100%;
    flex-shrink: 0;
    margin-bottom: 5px;
}
#rzutImage, #satelitaImage {
    width: 100% !important;
    height: auto !important;
}

/* Główny kontener czatu */
#czat {
    display: flex;
    flex-direction: column;
    /* KLUCZOWE: #czat zajmuje całą pozostałą przestrzeń */
    flex-grow: 1;
    min-height: 0; /* Niezbędne w zagnieżdżonym Flexboxie */
    overflow: auto; /* Przenosimy scrolla na #chatMessages */
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Kontener Wiadomości - to jest ten, który się przewija */
#chatMessages {
    /* KLUCZOWE: Pochłania całą wolną przestrzeń w #czat */
    flex: 1;
    /* Włącza wewnętrzne przewijanie */
    overflow-y: auto;
    min-height: 0; 
    margin-bottom: 10px;
    text-align: left;
    padding-right: 5px;
}

/* Formularz Czatu - ma stałą wysokość i nie przewija się */
#chatForm {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ====================================================================== */
/* 6. RESPONSZYWNOŚĆ DLA URZĄDZEŃ MOBILNYCH (MEDIA QUERIES) */
/* ====================================================================== */

/* Przy szerokości ekranu mniejszej niż 768px (typowy tablet/telefon w poziomie) */
@media (max-width: 768px) {
    
    /* Panele zajmują więcej miejsca, aby były czytelne */
    #leftPanel, #rightPanel {
        width: 35%; 
        max-width: 35%;
        padding: 0.2em;
        font-size: 0.9em;
    }
    
    /* Zmniejszenie rozmiaru zegara */
    #clock {
        font-size: 1.5em;
        padding-left: 0.4em;
        padding-right: 0.4em;
    }
}

/* Przy szerokości ekranu mniejszej niż 480px (typowe telefony) */
@media (max-width: 480px) {
    
    /* Panele zajmują większość ekranu */
    #leftPanel, #rightPanel {
        width: 80%; 
        max-width: 80%;
    }

    /* Przesuń przyciski switch/toggle, aby nie kolidowały z panelami */
    #switchStream, #toggleButton {
        left: 50%;
        transform: translateX(-50%);
    }

    /* Zmniejszenie fontów w informacjach */
    #lacznosc, #weather, #pajth, #czattext {
        font-size: 0.7em;
    }
}

#rescue_logo img{
    max-width: 100%;
    height: auto;
    margin: 0px;
    padding: 0px;
}
/* ====================================================================== */
/* 7. POZOSTAŁE STYLE (ZOPTYMALIZOWANE I POSPRZĄTANE) */
/* ====================================================================== */
#clock {
    position: fixed;
    top: 0.2%;
    left: 50%;
    font-weight: bold;
    letter-spacing: 2px;
    transform: translateX(-50%);
    text-shadow: 1px 2px #000000;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding-left: 0.5em;
    padding-right: 0.5em;
    border-radius: 10px;
    font-size: 2em;
    z-index: 25; 
}

#lacznosc, #weather, #pajth, #czattext {
    line-height: 140%;
    text-shadow: 1px 2px #000000;
    font-size: 0.8em;
    text-transform: uppercase;
}
#logo {
    width: 100%;
    top: 2px;
    margin-bottom: 0.2em;
}

p#czattext{
    font-size: large
}
p {
    line-height: 180%;
    text-shadow: 1px 2px #000000;
    font-size: 1em;
    margin: 0;
    padding: 0;
}
.username, .timestamp {
    color: rgb(255, 0, 0);
}
.message {
    padding: 5px;
    padding-left: 1em;
    margin: 5px 0;
    font-size: 0.8em;
    border-radius: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
}

/* PRZYCISKI I INPUTY */
#nameInput, #chatInput {
    width: calc(100% - 20px);
    margin-bottom: 5px;
    padding: 5px;
    font-size: 1em; 
    border: 1px solid black;
    border-radius: 5px;
    box-sizing: border-box;
}

#chatButton, #switchStream, #toggleButton, #menu, #logoutButton {
    background-color: rgb(236, 32, 32);
    color: white;
    border: none;
    padding: 5px 18px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
    box-sizing: border-box;
    z-index: 20;
}

#chatButton {
    width: 95%;
}
#chatButton:hover, #logoutButton:hover, #toggleButton:hover {
    background-color: rgb(194, 29, 29);
}

#switchStream{
    position: fixed;
    bottom: 10px;
    left: 10px;
    background-color: rgb(63, 118, 201);
    padding: 5px;
}
#toggleButton {
    position: fixed;
    bottom: 45px;
    left: 10px;
    padding: 5px;
}
/* MODAL / POWIĘKSZANIE ZDJĘĆ */
.enlarged {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}
.enlarged img {
    max-width: 95%; 
    max-height: 95%; 
    object-fit: contain;
    cursor: pointer;
}
.modal {
    display: none ; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; 
    background-color: rgba(0, 0, 0, 0.8); 
    align-items: center; 
    justify-content: center; 
}
.modal-content-wrapper {
    position: relative; 
    max-width: 80%;
    max-height: 80%;
}
.modal-content {
    max-width: 100%;
    max-height: 100%;
    display: block; 
    margin: auto; 
}
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}
.close:hover,
.close:focus {
    color: #999;
    text-decoration: none;
}
/* Nowy kontener ustawiający przyciski w jednej linii */
#bottomButtons {
    display: flex;
    justify-content: space-between; /* Rozsuwa przyciski do boków */
    gap: 10px;                      /* Odstęp między przyciskami */
    width: 100%;
    padding: 0 10px;                /* Dopasowanie do marginesów panelu */
    box-sizing: border-box;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Przycisk Menu jest domyślnie ukryty (skrypt JS pokaże go tylko adminowi) */
#menu {
    display: none;
}

/* Wspólne style dla obu przycisków wewnątrz kontenera */
#logoutButton, #menu {
    flex: 1;                        /* Sprawia, że oba przyciski mają równą szerokość */
    padding: 6px 10px;
    font-weight: bold;
    margin-bottom: 5px;
    cursor: pointer;
}
