/* Ogólne style */
body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    margin: 0;
    overflow-x: hidden; /* Zapobiega poziomemu scrollowaniu na małych ekranach */
}

.hidden {
    display: none !important;
}

/* --- Panel Startowy --- */
#start-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    max-width: 90%; /* Zapewnia responsywność */
    width: 500px;
}

#start-panel h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.2em;
}

#start-panel p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.start-options {
    display: flex;
    gap: 20px;
}

.start-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.start-button:hover {
    background-color: #0056b3;
}

/* --- Główny Kontener Banera --- */
#banner-main-wrapper {
    display: flex; /* Kontroluje wyświetlanie banera i panelu opcji */
    flex-direction: column;
    align-items: center;
    width: 100%; /* Ustawienie na 100% dla responsywności */
    max-width: 900px; /* Maksymalna szerokość dla większych ekranów */
    padding: 20px;
    box-sizing: border-box; /* Upewnia się, że padding nie zwiększa całkowitej szerokości */
}

#banner-container {
    position: relative; /* Dla pozycjonowania treści i kontrolek */
    width: 100%;
    height: 450px; /* Stała wysokość na desktopie */
    background-color: #f8f8f8;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow: hidden; /* Ważne dla animacji */
    display: flex;
    flex-direction: column;
}

#banner-content {
    flex-grow: 1; /* Zajmuje dostępną przestrzeń */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    font-size: 2em;
    font-weight: bold;
    color: #333;
    transition: background-color 0.5s ease; /* Płynna zmiana koloru tła */
    position: relative; /* Dla pozycjonowania animowanego tekstu */
}

#animated-text {
    position: absolute;
    width: calc(100% - 40px); /* Szerokość tekstu z paddingiem */
    padding: 10px;
    box-sizing: border-box;
}

#dynamic-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Kontrolki Banera (przyciski nawigacyjne i narzędziowe) --- */
#banner-controls {
    display: flex;
    flex-wrap: wrap; /* Pozwala przyciskom zawijać się na mniejszych ekranach */
    justify-content: center;
    padding: 10px;
    gap: 10px; /* Odstęp między grupami przycisków */
    background-color: #eee;
    border-top: 1px solid #ddd;
}

#navigation-buttons, #tool-buttons {
    display: flex;
    flex-wrap: wrap; /* Pozwala przyciskom zawijać się */
    justify-content: center;
    gap: 8px; /* Odstęp między przyciskami w grupie */
}

.nav-button, .tool-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    white-space: nowrap; /* Zapobiega łamaniu tekstu w przycisku */
}

.nav-button:hover, .tool-button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.nav-button.active {
    background-color: #28a745; /* Zielony dla aktywnego slajdu */
}

/* --- Panel Opcji --- */
#options-panel {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    position: relative;
}

#options-panel h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

#options-panel label {
    display: block;
    margin-bottom: 10px;
    color: #555;
}

#options-panel input[type="checkbox"],
#options-panel input[type="range"],
#options-panel select {
    margin-right: 8px;
}

#options-panel button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 15px;
}

#options-panel button:hover {
    background-color: #5a6268;
}

#close-options {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5em;
    color: #aaa;
    cursor: pointer;
}

#close-options:hover {
    color: #777;
}

/* --- Podgląd Banera (iframe) --- */
#preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#preview-frame-container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    width: 90%; /* Responsywna szerokość */
    height: 90%; /* Responsywna wysokość */
    display: flex;
    flex-direction: column;
}

#preview-iframe {
    width: 100%;
    height: calc(100% - 40px); /* Odjąć wysokość przycisku */
    border: 1px solid #ddd;
}

#close-preview {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

#close-preview:hover {
    background-color: #c82333;
}


/* --- Animacje --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-30px); }
    60% { transform: translateY(-15px); }
}

.fadeIn { animation: fadeIn var(--animation-duration) ease-out forwards; }
.slideIn { animation: slideIn var(--animation-duration) ease-out forwards; }
.bounce { animation: bounce var(--animation-duration) ease-out forwards; }


/* --- Media Queries dla Responsywności --- */

/* Tryb mobilny (ekrany do 768px szerokości) */
@media (max-width: 768px) {
    body {
        min-height: auto; /* Zezwól na naturalną wysokość na mobilnych */
    }

    #start-panel {
        padding: 20px;
        width: 100%; /* Rozszerz panel startowy na całą szerokość */
        box-sizing: border-box;
    }

    #start-panel h1 {
        font-size: 1.5em;
    }

    #start-panel p {
        font-size: 0.9em;
    }

    .start-options {
        flex-direction: column; /* Przyciski startowe w kolumnie */
        gap: 15px;
        width: 100%;
    }

    .start-button {
        width: 80%; /* Przyciski startowe */
        max-width: 300px;
        padding: 12px 20px;
        font-size: 1em;
    }

    #banner-main-wrapper {
        padding: 10px; /* Mniejszy padding na mobilnych */
    }

    #banner-container {
        height: 300px; /* Mniejsza wysokość banera na telefonach */
        font-size: 1em; /* Mniejsza czcionka dla treści */
    }

    #banner-content {
        padding: 10px; /* Mniejszy padding wewnątrz treści */
        font-size: 1.5em; /* Zmniejsz czcionkę treści */
    }

    #animated-text {
        width: calc(100% - 20px); /* Dostosuj szerokość tekstu */
    }

    #banner-controls {
        flex-direction: column; /* Kontrolki w kolumnie */
        gap: 10px; /* Odstęp między grupami */
        padding: 8px;
    }

    #navigation-buttons, #tool-buttons {
        width: 100%; /* Przyciski zajmują całą szerokość */
        justify-content: center; /* Centrowanie przycisków */
        gap: 5px; /* Mniejszy odstęp między przyciskami */
    }

    .nav-button, .tool-button {
        padding: 8px 12px; /* Mniejszy padding dla przycisków */
        font-size: 0.8em; /* Mniejsza czcionka przycisków */
    }

    #options-panel {
        padding: 15px;
        width: 95%; /* Większa szerokość panelu opcji */
    }

    #options-panel h2 {
        font-size: 1.2em;
    }

    #preview-frame-container {
        padding: 10px;
    }
}

/* Bardzo małe ekrany (do 480px szerokości) */
@media (max-width: 480px) {
    .nav-button, .tool-button {
        font-size: 0.7em; /* Jeszcze mniejsza czcionka dla przycisków */
        padding: 6px 8px;
    }
    #banner-content {
        font-size: 1.2em; /* Jeszcze mniejsza czcionka dla treści */
    }
}

/* W przypadku użycia iframe, baner powinien być responsywny sam w sobie */
/* Style dla trybu mobilnego banera (gdy jest uruchomiony jako samodzielna strona lub w iframe) */
#banner-main-wrapper.mobile-mode #banner-container {
    height: 300px; /* Mniejsza wysokość dla trybu mobilnego */
}

#banner-main-wrapper.mobile-mode #banner-content {
    font-size: 1.5em; /* Mniejsza czcionka */
    padding: 10px;
}

#banner-main-wrapper.mobile-mode #banner-controls {
    flex-direction: column;
}

#banner-main-wrapper.mobile-mode .nav-button,
#banner-main-wrapper.mobile-mode .tool-button {
    font-size: 0.8em;
    padding: 8px 12px;
}
