/* Toast notifikace */
.toast-container {
    position: fixed;
    bottom: 80px; /* Vzdálenost od spodní části, ponechá místo pro mobilní navigaci */
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    z-index: 9999;
    pointer-events: none; /* Propouští interakce skrz container */
}

.toast {
    max-width: 90%;
    width: 300px;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: auto; /* Umožňuje interakci s jednotlivými toasty */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Toast typy */
.toast-info {
    background-color: #3498db;
}

.toast-success {
    background-color: #2ecc71;
}

.toast-error {
    background-color: #e74c3c;
}

.toast-warning {
    background-color: #f39c12;
}

/* Nastavení safe area pro zařízení s výřezem (notch) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
    
    .toast-container {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

/* Optimalizace pro dotykové ovládání */
button, 
.btn,
.nav-item,
.list-item,
.track-action-btn,
.album,
.playlist-item {
    cursor: pointer;
    touch-action: manipulation; /* Optimalizace pro touch events */
}

/* Aktivní stavy pro mobilní dotyková zařízení */
@media (hover: none) {
    button:active, 
    .btn:active,
    .track-action-btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
    
    .list-item:active,
    .album:active,
    .playlist-item:active {
        background-color: var(--bg-element-hover);
    }
    
    .nav-item:active {
        opacity: 0.8;
    }
}

/* Zvětšení interaktivních prvků na dotykových zařízeních */
@media (hover: none) and (max-width: 767px) {
    button, 
    .btn,
    .track-action-btn,
    .player-control-btn {
        min-height: 44px; /* Doporučená velikost pro dotykové prvky */
        min-width: 44px;
        padding: 10px 16px;
    }
    
    .nav-item {
        padding: 10px;
    }
    
    .progress-bar {
        height: 8px; /* Tlustší progress bar pro snazší manipulaci */
    }
    
    .progress-handle {
        width: 20px;
        height: 20px;
    }
    
    /* Zvětšená velikost fontů pro lepší čitelnost */
    body {
        font-size: 16px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    h3 {
        font-size: 18px;
    }
}

/* Optimalizace poměru stran pro malé displeje */
@media (max-width: 576px) {
    .albums-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .player-container {
        padding: 10px;
    }
    
    /* Úprava formulářů pro lepší mobilní zobrazení */
    #createPlaylistForm {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 8px;
    }
}

/* Vylepšení scrollování */
.current-playlist,
.album-tracks,
.popup-content {
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

/* Optimalizace pro režim na šířku (landscape) */
@media (max-width: 767px) and (orientation: landscape) {
    body {
        padding-bottom: 50px;
    }
    
    .mobile-nav {
        padding: 5px 0;
    }
    
    .nav-icon {
        margin-bottom: 2px;
    }
    
    .now-playing-info {
        flex-direction: row;
    }
    
    .toast-container {
        bottom: 50px;
    }
    
    #auth-forms {
        max-width: 70%;
    }
}

/* Print Media Query - vypnutí přehrávače při tisku */
@media print {
    .player-container,
    .mobile-nav,
    .popup-overlay {
        display: none !important;
    }
    
    body {
        padding-bottom: 0;
        background-color: white;
        color: black;
    }
}