.dir-container,
    .dir-container * {
        box-sizing: border-box;
    }

    .dir-container {
        max-width: 1600px;
        width: 95%;
        margin: 25px auto 10px;
        padding: 0 15px;
        font-family: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }

    /* Header */
    .dir-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
        width: 100%;
        margin: 0 0 20px 0;
    }
    .dir-title {
        font-family: 'Oswald', sans-serif;
        font-size: 24px;
        font-weight: 700;
        color: #212529;
        margin: 0;
        text-transform: uppercase;
        display: flex;
        align-items: center;
        gap: 8px;
        border-left: 4px solid #f39c12;
        padding-left: 12px;
        line-height: 1.2;
    }
    body.dark-mode .dir-title {
        color: #ffffff;
    }
    .dir-title .dir-count {
        font-family: 'Mulish', sans-serif;
        font-size: 14px;
        font-weight: 700;
        color: #6c757d;
        text-transform: none;
    }
    body.dark-mode .dir-title .dir-count {
        color: #b0b5c9;
    }

    /* View Mode Toggle Buttons */
    .dir-layout-btns {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
    .dir-layout-btn {
        background: #ffffff;
        border: 1px solid #dce1e7;
        height: 38px;
        padding: 0 14px;
        border-radius: 6px;
        cursor: pointer;
        color: #555555;
        font-family: 'Mulish', sans-serif;
        font-size: 13px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: all 0.2s ease;
    }
    .dir-layout-btn svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    .dir-layout-btn:hover {
        border-color: #1fb0f4;
        color: #1fb0f4;
    }
    .dir-layout-btn.active {
        background: #1fb0f4;
        color: #ffffff;
        border-color: #1fb0f4;
        box-shadow: 0 2px 6px rgba(31, 176, 244, 0.25);
    }
    body.dark-mode .dir-layout-btn {
        background: #1f212b;
        border-color: #3b4059;
        color: #c2c6d8;
    }
    body.dark-mode .dir-layout-btn:hover {
        border-color: #1fb0f4;
        color: #1fb0f4;
    }
    body.dark-mode .dir-layout-btn.active {
        background: #1fb0f4;
        color: #ffffff;
        border-color: #1fb0f4;
    }

    /* Filters Box */
    .dir-filters {
        background: #ffffff;
        width: 100%;
        margin: 0 0 28px 0;
        border-radius: 8px;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
        border: 1px solid #e2e8f0;
    }
    body.dark-mode .dir-filters {
        background: #1f212b;
        border-color: #3b4059;
        box-shadow: none;
    }

    .dir-filters-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 15px;
        width: 100%;
    }
    .filter-group {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }
    .filter-group label {
        font-size: 11.5px;
        font-weight: 700;
        color: #555555;
        margin-bottom: 6px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    body.dark-mode .filter-group label {
        color: #b0b5c9;
    }
    .filter-group select,
    .filter-group input[type="text"] {
        width: 100%;
        min-width: 0;
        height: 40px;
        padding: 0 10px;
        border: 1px solid #ced4da;
        border-radius: 5px;
        font-family: 'Mulish', sans-serif;
        font-size: 13px;
        color: #333333;
        outline: none;
        background: #f8f9fa;
        transition: border-color 0.2s;
    }
    .filter-group select {
        cursor: pointer;
    }
    .filter-group select:focus,
    .filter-group input[type="text"]:focus {
        border-color: #1fb0f4;
    }
    body.dark-mode .filter-group select,
    body.dark-mode .filter-group input[type="text"] {
        background: #303240;
        color: #ffffff;
        border-color: #474c67;
    }

    .filter-actions-group {
        grid-column: span 2;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        min-width: 0;
    }
    .filter-actions {
        display: flex;
        gap: 10px;
        width: 100%;
        height: 40px;
    }
    .btn-filter,
    .btn-clear {
        flex: 1;
        min-width: 0;
        height: 40px;
        padding: 0 14px;
        border: none;
        border-radius: 5px;
        font-family: 'Mulish', sans-serif;
        font-size: 13.5px;
        font-weight: 700;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        color: #ffffff;
        text-decoration: none;
        transition: opacity 0.2s, transform 0.15s;
        white-space: nowrap;
    }
    .btn-filter {
        background: #007bff;
    }
    .btn-filter:hover {
        background: #0062cc;
        color: #ffffff;
    }
    .btn-clear {
        background: #263238;
    }
    .btn-clear:hover {
        background: #37474f;
        color: #ffffff;
    }
    .btn-filter svg,
    .btn-clear svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    /* ==========================================================================
       VISTA EN CUADRÍCULA (.view-grid)
       ========================================================================== */
    .dir-results.view-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 20px;
        width: 100%;
    }
    .dir-results.view-grid .dir-item {
        position: relative;
        border-radius: 6px;
        overflow: hidden;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
        display: block;
        aspect-ratio: 2 / 3;
        background: var(--ba-surface-2, #e2e8f0);
        transition: transform 0.25s ease, box-shadow 0.25s ease;
        transform: translateZ(0);
    }
    .dir-results.view-grid .dir-item:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
    }
    .dir-results.view-grid .dir-card-poster {
        display: block;
        width: 100%;
        height: 100%;
        position: relative;
        text-decoration: none;
    }
    .dir-results.view-grid .dir-card-poster img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.3s ease;
    }
    .dir-results.view-grid .dir-item:hover .dir-card-poster img {
        transform: scale(1.04);
    }
    .dir-results.view-grid .dir-list-content {
        display: none;
    }

    /* Grid Badges & Overlay */
    .badges-top {
        position: absolute;
        top: 10px;
        left: 10px;
        right: 10px;
        z-index: 3;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        pointer-events: none;
    }
    .dir-item .badge {
        padding: 3px 8px;
        border-radius: 12px;
        color: #ffffff;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        line-height: 1.2;
    }
    .badge-serie {
        background: #1fb0f4;
    }
    .badge-pelicula {
        background: #9b59b6;
    }
    .badge-ova,
    .badge-ona,
    .badge-especial {
        background: #e67e22;
    }
    .badge-estado {
        background: #dc3545;
    }
    .badge-emision {
        background: #28a745;
    }

    .card-title-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 36px 10px 10px;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.6) 55%, transparent 100%);
        z-index: 2;
    }
    .card-title-overlay h3 {
        margin: 0;
        color: #ffffff;
        font-size: 13px;
        font-weight: 600;
        text-align: center;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-word;
    }

    /* ==========================================================================
       VISTA EN LISTA (.view-list)
       ========================================================================== */
    .dir-results.view-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
        width: 100%;
    }
    .dir-results.view-list .dir-item {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        height: 180px;
        transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    }
    body.dark-mode .dir-results.view-list .dir-item {
        background: #1f212b;
        border-color: #3b4059;
        box-shadow: none;
    }
    .dir-results.view-list .dir-item:hover {
        transform: translateY(-2px);
        border-color: #1fb0f4;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    }
    .dir-results.view-list .dir-card-poster {
        width: 122px;
        flex-shrink: 0;
        height: 100%;
        position: relative;
        display: block;
        overflow: hidden;
        background: var(--ba-surface-2, #e2e8f0);
    }
    .dir-results.view-list .dir-card-poster img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.3s ease;
    }
    .dir-results.view-list .dir-item:hover .dir-card-poster img {
        transform: scale(1.05);
    }
    .dir-results.view-list .dir-card-poster .badges-top,
    .dir-results.view-list .dir-card-poster .card-title-overlay {
        display: none;
    }

    .dir-results.view-list .dir-list-content {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 14px 16px;
        flex: 1;
        min-width: 0;
        height: 100%;
    }
    .dir-list-top {
        min-width: 0;
    }
    .dir-list-badges {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 6px;
    }
    .list-meta-pill {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 11px;
        font-weight: 600;
        color: #555555;
        background: #f1f3f5;
        padding: 2px 8px;
        border-radius: 12px;
        line-height: 1.3;
    }
    body.dark-mode .list-meta-pill {
        background: #303240;
        color: #d5d9e8;
    }
    .list-meta-pill.list-views-pill {
        background: rgba(255, 152, 0, 0.15);
        color: #e67e22;
    }
    body.dark-mode .list-meta-pill.list-views-pill {
        background: rgba(255, 152, 0, 0.2);
        color: #ffad33;
    }

    .dir-list-title {
        margin: 0 0 6px 0;
        font-size: 15px;
        font-weight: 700;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .dir-list-title a {
        color: #212529;
        text-decoration: none;
        transition: color 0.2s;
    }
    .dir-list-title a:hover {
        color: #1fb0f4;
    }
    body.dark-mode .dir-list-title a {
        color: #ffffff;
    }
    body.dark-mode .dir-list-title a:hover {
        color: #1fb0f4;
    }

    .dir-list-synopsis {
        margin: 0;
        font-size: 12.5px;
        color: #666666;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    body.dark-mode .dir-list-synopsis {
        color: #b0b5c9;
    }

    .dir-list-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-top: 8px;
        border-top: 1px solid #f0f2f5;
        min-width: 0;
    }
    body.dark-mode .dir-list-footer {
        border-top-color: #303240;
    }
    .dir-list-genres {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 5px;
        overflow: hidden;
        min-width: 0;
        flex: 1;
    }
    .dir-genre-tag {
        font-size: 11px;
        font-weight: 600;
        color: #007bff;
        background: rgba(0, 123, 255, 0.08);
        padding: 2px 8px;
        border-radius: 4px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    body.dark-mode .dir-genre-tag {
        color: #6ec6ff;
        background: rgba(110, 198, 255, 0.12);
    }
    .dir-list-cta {
        font-size: 12px;
        font-weight: 700;
        color: #1fb0f4;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 3px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .dir-list-cta:hover {
        color: #007bff;
    }

    /* Pagination */
    .dir-pagination {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 8px;
        margin: 36px 0 10px;
        width: 100%;
    }
    .dir-pagination a,
    .dir-pagination span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
        height: 38px;
        padding: 0 13px;
        background: #ffffff;
        border: 1px solid #dee2e6;
        border-radius: 4px;
        color: #333333;
        text-decoration: none;
        font-size: 13px;
        font-weight: 700;
        transition: all 0.2s ease;
    }
    body.dark-mode .dir-pagination a,
    body.dark-mode .dir-pagination span {
        background: #1f212b;
        border-color: #3b4059;
        color: #ffffff;
    }
    .dir-pagination a:hover {
        background: #1fb0f4;
        color: #ffffff;
        border-color: #1fb0f4;
    }
    .dir-pagination span.current {
        background: #1fb0f4;
        color: #ffffff;
        border-color: #1fb0f4;
        pointer-events: none;
    }

    /* ==========================================================================
       4 RESOLUCIONES DEL PROYECTO - BREAKPOINTS ESTRICTOS
       ========================================================================== */

    /* 1. Resolución Ultra-Wide / 2K (>= 1634px): 6 cols en Grid (4x6=24), 2 cols en Lista (12x2=24) */
    @media (min-width: 1634px) {
        .dir-results.view-grid {
            grid-template-columns: repeat(6, minmax(0, 1fr));
            gap: 22px;
        }
        .dir-results.view-list {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 20px;
        }
    }

    /* 2. Resolución Laptop / Escritorio Estándar (1200px - 1459px): 4 cols en Grid (6x4=24), 2 cols en Lista (12x2=24) */
    @media (min-width: 1200px) and (max-width: 1459px) {
        .dir-results.view-grid {
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 18px;
        }
        .dir-results.view-list {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 16px;
        }
        .dir-results.view-list .dir-card-poster {
            width: 112px;
        }
        .dir-results.view-list .dir-list-content {
            padding: 12px 14px;
        }
    }

    /* 3. Resolución Tablet (768px - 1199px): 4 cols en Grid (6x4=24), 1 col en Lista (24x1=24) */
    @media (min-width: 768px) and (max-width: 1199px) {
        .dir-container {
            width: 96%;
            margin: 20px auto 10px;
            padding: 0 12px;
        }
        .dir-title {
            font-size: 21px;
        }
        .dir-filters {
            padding: 16px;
            margin-bottom: 22px;
        }
        .dir-filters-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 12px;
        }
        .filter-actions-group {
            grid-column: 1 / -1;
            margin-top: 2px;
        }
        .dir-results.view-grid {
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 14px;
        }
        .dir-results.view-grid .card-title-overlay h3 {
            font-size: 12px;
        }
        .dir-results.view-list {
            grid-template-columns: 1fr;
            gap: 14px;
        }
        .dir-results.view-list .dir-item {
            height: 165px;
        }
        .dir-results.view-list .dir-card-poster {
            width: 110px;
        }
    }

    /* 4. Resolución Móvil (<= 767px): 2 cols en Grid (12x2=24), 1 col en Lista (24x1=24) */
    @media (max-width: 767px) {
        .dir-container {
            width: 100%;
            margin: 15px auto 10px;
            padding: 0 12px;
        }
        .dir-header {
            margin-bottom: 14px;
            gap: 10px;
        }
        .dir-title {
            font-size: 18px;
            padding-left: 10px;
        }
        .dir-title .dir-count {
            font-size: 12px;
        }
        .dir-layout-btn {
            height: 34px;
            padding: 0 10px;
            font-size: 12px;
        }
        .dir-filters {
            padding: 12px;
            margin-bottom: 20px;
        }
        .dir-filters-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
        }
        .filter-actions-group {
            grid-column: 1 / -1;
        }
        .filter-group select,
        .filter-group input[type="text"] {
            height: 38px;
            font-size: 12.5px;
            padding: 0 8px;
        }
        .filter-actions {
            height: 38px;
            gap: 8px;
        }
        .btn-filter,
        .btn-clear {
            height: 38px;
            font-size: 12.5px;
            padding: 0 10px;
        }
        .dir-results.view-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }
        .dir-results.view-grid .dir-item .badge {
            font-size: 9.5px;
            padding: 2px 6px;
        }
        .dir-results.view-grid .card-title-overlay {
            padding: 28px 8px 8px;
        }
        .dir-results.view-grid .card-title-overlay h3 {
            font-size: 12px;
        }
        .dir-results.view-list {
            grid-template-columns: 1fr;
            gap: 12px;
        }
        .dir-results.view-list .dir-item {
            min-height: 146px;
            height: auto;
        }
        .dir-results.view-list .dir-card-poster {
            width: 100px;
            height: auto;
            min-height: 146px;
        }
        .dir-results.view-list .dir-list-content {
            padding: 10px 12px;
            gap: 4px;
        }
        .dir-results.view-list .dir-list-badges {
            gap: 4px;
            margin-bottom: 4px;
            flex-wrap: nowrap;
            overflow: hidden;
        }
        .dir-results.view-list .list-year-pill {
            display: none;
        }
        .dir-results.view-list .dir-item .badge,
        .dir-results.view-list .list-meta-pill {
            font-size: 9.5px;
            padding: 2px 6px;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .dir-results.view-list .dir-list-title {
            font-size: 13.5px;
            margin-bottom: 4px;
        }
        .dir-results.view-list .dir-list-synopsis {
            font-size: 11.5px;
            line-height: 1.35;
        }
        .dir-results.view-list .dir-list-footer {
            padding-top: 6px;
        }
        .dir-results.view-list .dir-genre-tag {
            font-size: 10px;
            padding: 2px 6px;
        }
        .dir-results.view-list .dir-list-cta {
            font-size: 11px;
        }
        .dir-pagination {
            margin-top: 26px;
            gap: 6px;
        }
        .dir-pagination a,
        .dir-pagination span {
            min-width: 34px;
            height: 34px;
            padding: 0 10px;
            font-size: 12px;
        }
    }
