/* --- RESPONSIVE OVERRIDES --- */

/* Breiterer Container für mehr Platz auf Tablets und Desktop */
@media (min-width: 768px) {
    .container {
        max-width: 96%;
    }
}

/* Mobile Quick Filters: Mehrzeilig / Umbrechen */
@media (max-width: 576px) {
    .btn-group.w-100 {
        flex-wrap: wrap;
        overflow-x: visible;
        justify-content: center; /* Zentriert die Buttons */
    }
    
    .btn-group.w-100 .btn {
        flex: 1 1 auto; /* Wachsen und schrumpfen */
        margin: 2px !important; /* Etwas Abstand zwischen den Buttons */
        border-radius: 4px !important;
        font-size: 0.85rem;
        padding: 0.4rem 2.5rem 0.4rem 0.5rem; /* Rechts mehr Platz für Badge */
        min-width: 45%; /* Damit ca. 2 nebeneinander passen */
        max-width: 48%;
        position: relative; /* Für absolute Positionierung des Badges */
    }
    
    /* Positionierung des Badges auf Mobile korrigieren */
    .btn-group.w-100 .btn .badge {
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .btn-group > .btn:not(:first-child),
    .btn-group > .btn-group:not(:first-child) > .btn {
        margin-left: 0; /* Reset Bootstrap margin */
    }
    
    .btn-group > .btn:not(:last-child):not(.dropdown-toggle),
    .btn-group > .btn-group:not(:last-child) > .btn {
         border-top-right-radius: 4px !important;
         border-bottom-right-radius: 4px !important;
    }
    
    .btn-group > .btn:not(:first-child),
    .btn-group > .btn-group:not(:first-child) > .btn {
         border-top-left-radius: 4px !important;
         border-bottom-left-radius: 4px !important;
    }

    /* Neuen Film hinzufügen Button auf Mobile kompakt */
    #add-film-btn {
        width: 40px;
        padding-left: 0;
        padding-right: 0;
        font-size: 0;
        text-align: center;
    }
    
    #add-film-btn::before {
        content: "+";
        font-size: 1.8rem;
        line-height: 1;
    }

    /* Nav-Pills umbrechen */
    .nav-pills {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Tablet / Medium Screens */
@media (max-width: 991.98px) {
    .navbar .container {
        max-width: 100%;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .nav-pills {
        display: flex;
        flex-wrap: nowrap; /* Wieder einzeilig mit Scroll auf Tablet */
        overflow-x: auto;
        gap: 5px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .nav-pills::-webkit-scrollbar {
        display: none;
    }
    
    .nav-pills .nav-item {
        flex: 0 0 auto;
        margin-right: 0 !important;
        margin-bottom: 0;
    }
    
    .nav-pills .nav-link {
        margin-right: 0;
        font-size: 0.8rem;
        padding: 0.3rem 2rem 0.3rem 0.6rem !important;
    }
    
    .navbar-brand {
        margin-right: 0;
        margin-bottom: 10px;
        width: 100%;
        text-align: center;
        font-size: 1.2rem;
    }
}

/* Desktop Filter Bar Optimierung */
@media (min-width: 992px) {
    /* Mache die Selects etwas kompakter auf Desktop */
    #collapsible-filters select.form-control {
        padding-left: 0.5rem;
        padding-right: 1.5rem; /* Platz für Pfeil */
        font-size: 0.9rem;
    }

    /* Erzwinge, dass die Spalten nebeneinander passen */
    #collapsible-filters .col-lg {
        flex-basis: 0;
        flex-grow: 1;
        max-width: 100%;
    }
    
    #collapsible-filters .col-lg-auto {
        flex: 0 0 auto;
        width: auto;
        max-width: 100%;
    }
    
    /* Quick Filter Buttons kompakter auf Desktop */
    .btn-group.w-100 .btn {
        flex: 1 1 auto;
        padding-left: 0.5rem;
        padding-right: 2rem;
        font-size: 0.85rem;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }
    
    .btn-group.w-100 .btn .badge {
        right: 4px;
        transform: translateY(-50%) scale(0.9);
    }
}

/* Watch Wizard Mobile Optimization */
@media (max-width: 576px) {
    .vibe-chip {
        padding: 0.35rem 0.75rem;
        font-size: 0.85rem;
        margin-right: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    #wizard-modal .modal-body {
        padding: 0.5rem;
    }
    
    #wizard-modal .modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100%;
    }
    
    #wizard-modal .modal-content {
        height: 100%;
        border-radius: 0;
        border: none;
        display: flex;
        flex-direction: column;
    }
    
    #wizard-modal .modal-footer {
        margin-top: auto;
        background-color: var(--card-background);
        z-index: 10;
        border-top: 1px solid var(--secondary-color);
    }
}
