/**
 * DGLA Portfolio Filter - Estilos
 *
 * @version 1.0.0
 */

/* ==========================================================================
   CONTENEDOR PRINCIPAL
   ========================================================================== */

.dgla-portfolio-container {
    width: 100%;
    margin: 0 auto;
}

.dgla-portfolio-filters {
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: 0;
    padding-left: 0;
}

/* ==========================================================================
   DROPDOWNS (SELECT)
   ========================================================================== */

.dgla-select {
    position: relative;
    width: 19%;
    min-width: 150px;
    font-size: 12px;
    border: 2px solid #d8d8d8;
    background: #fff;
    z-index: 1;
    margin-left: 0;
}

/* Primer filtro sin margen izquierdo */
.dgla-select:first-child {
    margin-left: 0 !important;
}

/* Cuando el dropdown esta abierto, elevar z-index */
.dgla-select:has(.dgla-dropdown-toggle:checked),
.dgla-select.dgla-select-open {
    z-index: 100;
}

.dgla-select:hover {
    border-color: #CB473B;
}

/* Checkbox toggle (oculto visualmente pero funcional) */
.dgla-dropdown-toggle {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

/* Iconos de flecha */
.dgla-select > i.toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    z-index: 1;
}

.dgla-select > .dgla-dropdown-toggle:not(:checked) ~ i.toggle.icon-arrow-up {
    display: none;
}

.dgla-select > .dgla-dropdown-toggle:not(:checked) ~ i.toggle.icon-arrow-down {
    display: block;
}

.dgla-select > .dgla-dropdown-toggle:checked ~ i.toggle.icon-arrow-down {
    display: none;
}

.dgla-select > .dgla-dropdown-toggle:checked ~ i.toggle.icon-arrow-up {
    display: block;
}

/* Flecha con CSS (alternativa a iconos) */
.dgla-select::after {
    content: "";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #666;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.dgla-select:has(.dgla-dropdown-toggle:checked)::after {
    transform: translateY(-50%) rotate(180deg);
}

/* Placeholder */
.dgla-placeholder {
    display: block;
    padding: 15px 40px 15px 15px;
    text-transform: uppercase;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Indicador de filtro activo en placeholder */
.dgla-placeholder:not([data-content="all"]) {
    color: #CB473B;
    font-weight: 700;
}

/* ==========================================================================
   SCROLL ITEMS (OPCIONES DEL DROPDOWN)
   ========================================================================== */

.dgla-scroll-items {
    display: none;
    position: absolute;
    top: 100%;
    left: -2px;
    width: calc(100% + 4px);
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 2px solid #d8d8d8;
    border-top: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

/* Mostrar cuando el dropdown esta abierto */
.dgla-select > .dgla-dropdown-toggle:checked ~ .dgla-scroll-items {
    display: block;
}

/* Opciones */
.dgla-option {
    display: block;
    cursor: pointer;
}

.dgla-title {
    display: block;
    padding: 12px 15px;
    color: #333;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dgla-title:hover {
    background-color: #f5f5f5;
}

/* Estado activo */
.dgla-title.active {
    background-color: #CB473B !important;
    color: #fff !important;
    font-weight: 600;
}

/* ==========================================================================
   PORTFOLIO ITEMS
   ========================================================================== */

.dgla-portfolio-items-wrapper {
    width: 100%;
}

.dgla-portfolio-items {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.dgla-portfolio-items .et_pb_portfolio_item {
    width: calc(33.333% - 14px);
    border: 2px solid #d8d8d8;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dgla-portfolio-items .et_pb_portfolio_item:hover {
    border-color: #CB473B;
}

/* Items ocultos por filtro */
.dgla-portfolio-items .et_pb_portfolio_item.dgla-hidden-item {
    display: none !important;
    opacity: 0;
    transform: scale(0.8);
}

/* Imagen del portfolio */
.dgla-portfolio-items .et_portfolio_image img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Titulo */
.dgla-portfolio-items .et_pb_module_header {
    padding: 10px 15px 5px;
    margin: 0;
}

.dgla-portfolio-items .et_pb_module_header a {
    color: #333;
    text-decoration: none;
}

.dgla-portfolio-items .et_pb_module_header a:hover {
    color: #CB473B;
}

/* Meta/Categorias */
.dgla-portfolio-items .post-meta {
    padding: 0 15px 15px;
    margin: 0;
    font-size: 12px;
    color: #666;
}

.dgla-portfolio-items .post-meta a {
    color: #666;
    text-decoration: none;
}

.dgla-portfolio-items .post-meta a:hover {
    color: #CB473B;
}

/* ==========================================================================
   MENSAJE SIN RESULTADOS
   ========================================================================== */

.dgla-no-results {
    width: 100%;
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #666;
    background: #f9f9f9;
    border: 2px dashed #d8d8d8;
    margin: 20px 0;
}

/* ==========================================================================
   PAGINACION
   ========================================================================== */

.dgla-portfolio-pagination {
    text-align: center;
    margin-top: 30px;
}

.dgla-portfolio-pagination ul {
    list-style: none;
    display: inline-flex;
    gap: 5px;
    padding: 0;
    margin: 0;
}

.dgla-portfolio-pagination ul li a {
    display: block;
    min-width: 35px;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border: 1px solid #d8d8d8;
    transition: all 0.2s ease;
}

.dgla-portfolio-pagination ul li a:hover,
.dgla-portfolio-pagination ul li a.active {
    background: #CB473B;
    color: #fff;
    border-color: #CB473B;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1200px) {
    .dgla-select {
        width: 23%;
    }

    .dgla-portfolio-items .et_pb_portfolio_item {
        width: calc(33.333% - 14px);
    }
}

@media (max-width: 980px) {
    .dgla-select {
        width: 31%;
    }

    .dgla-portfolio-items .et_pb_portfolio_item {
        width: calc(50% - 10px);
    }
}

@media (max-width: 767px) {
    .dgla-portfolio-filters {
        flex-direction: column;
    }

    .dgla-select {
        width: 100%;
    }

    .dgla-scroll-items {
        max-height: 200px;
    }

    .dgla-portfolio-items .et_pb_portfolio_item {
        width: 100%;
    }

    .dgla-no-results {
        padding: 40px 15px;
        font-size: 14px;
    }
}

@media (max-width: 479px) {
    .dgla-placeholder {
        padding: 12px 35px 12px 12px;
        font-size: 11px;
    }

    .dgla-title {
        padding: 10px 12px;
        font-size: 11px;
    }
}
