/* public/css/advanced-search.css */

/* ==========================================
   ADVANCED SEARCH LAYOUT
   ========================================== */
.adv-search-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    margin-top: 20px;
    padding-bottom: 100px;
}

/* --- FORCE WHITE ICONS --- */
h1 i, 
.mobile-filter-toggle i,
.filter-header i {
    color: #ffffff !important;
}

/* --- SIDEBAR FILTER (Desktop) --- */
.filter-sidebar {
    background: #000;
    border-radius: 12px;
    border: 1px solid #333;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 90px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.filter-header h3 {
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-transform: uppercase;
    margin: 0;
}

.filter-section {
    margin-bottom: 25px;
}

.filter-label {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    margin-bottom: 10px;
    display: block;
    text-transform: uppercase;
}

/* --- GENRE GRID (Fixed Sizing) --- */
.genre-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.genre-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 4px;
    background: #111;
    border: 1px solid #333;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    
    /* Prevent weird stretching */
    flex-grow: 0;
    width: auto;
}

.genre-btn:hover { border-color: #666; color: #fff; }

.genre-btn.include {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #4ade80;
}

.genre-btn.exclude {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #f87171;
    text-decoration: line-through;
}

/* --- INPUTS --- */
.filter-select {
    width: 100%;
    padding: 10px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    box-sizing: border-box;
}

/* --- SORT BUTTONS --- */
.sort-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.sort-btn {
    padding: 10px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
}

.sort-btn.active {
    background: #fff;
    color: #000;
    border-color: #fff;
}

/* --- APPLY BUTTON --- */
.apply-btn {
    width: 100%;
    padding: 14px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 15px;
    transition: transform 0.2s;
}
.apply-btn:hover { background: #ddd; }

/* --- RESULT HEADER --- */
.results-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* --- MOBILE TOGGLE --- */
.mobile-filter-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 20px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

/* ==========================================
   ERIS CARD GRID (3 Cols = Small Cards)
   ========================================== */
.browse-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 Columns Mobile */
    gap: 10px;
    padding: 0;
}

@media (min-width: 640px) { .browse-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .browse-grid { grid-template-columns: repeat(5, 1fr); } }

.eris-card { display: flex; flex-direction: column; cursor: pointer; }

.eris-poster-box {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
    background: #1a1a1a;
}

.eris-img { width: 100%; height: 100%; object-fit: cover; }

.eris-badges {
    position: absolute; top: 4px; left: 4px;
    display: flex; flex-direction: column; gap: 2px; z-index: 2;
}

.eb-row { display: flex; gap: 2px; }

.eb-tag {
    font-size: 8px;
    font-family: sans-serif;
    font-weight: 700;
    color: #fff;
    padding: 1px 4px;
    border-radius: 2px;
    text-transform: capitalize;
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.eb-new { background: #1a1a1a; border: 1px solid #333; }
.eb-type { background: #333; }
.eb-completed { background: #d93025; }
.eb-ongoing { background: #0d6efd; }
.eb-lang { background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }

.eris-card-title {
    font-size: 11px;
    font-weight: 700; color: #fff; margin: 0 0 2px 0;
    line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.eris-card-genres {
    font-size: 9px; color: #888; margin: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ==========================================
   PAGINATION
   ========================================== */
.pagination { display: flex; gap: 10px; align-items: center; }
.pagination-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: #111; border: 1px solid #333; color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.pagination-btn:disabled { opacity: 0.5; cursor: default; }

/* ==========================================
   MOBILE SIDEBAR (Full Overlay > Everything)
   ========================================== */
@media (max-width: 992px) {
    .adv-search-layout { grid-template-columns: 1fr; gap: 0; }
    
    .filter-sidebar { 
        display: none;
        position: fixed;
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100dvh;
        /* MAX Z-INDEX: Covers Header, BottomNav, Ads */
        z-index: 2147483647; 
        background: #000;
        border: none;
        overflow-y: auto;
        padding: 20px;
        padding-bottom: 100px; /* Space for fixed button */
    }
    
    .filter-sidebar.active { display: block; animation: slideUp 0.2s ease-out; }
    
    .mobile-filter-toggle { display: flex; }
    
    .genre-btn {
        padding: 10px; font-size: 12px;
        flex: 1 1 30%; text-align: center;
    }
    
    /* APPLY BUTTON - FIXED ABOVE OVERLAY BOTTOM */
    .apply-btn {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        z-index: 2147483648; /* +1 higher than sidebar */
        box-shadow: 0 0 20px rgba(0,0,0,1);
        border: 2px solid #fff;
    }
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
