/* ==========================================================================
   SPD Elementor Widgets — Frontend Styles
   ========================================================================== */

/* ── Placeholders (editor only) ─────────────────────────────────── */
.spd-placeholder {
    padding: 20px;
    text-align: center;
    background: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 6px;
    color: #888;
    font-style: italic;
}

/* ── Featured Image ─────────────────────────────────────────────── */
.spd-featured-wrap {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    line-height: 0;
}
.spd-featured-img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ── Image Slider ───────────────────────────────────────────────── */
.spd-slider {
    position: relative;
}
.spd-slider .swiper {
    width: 100%;
    overflow: hidden;
}
.spd-slider .swiper-slide img {
    display: block;
    width: 100%;
}
.spd-slider .spd-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    line-height: 1;
    border: none;
}
.spd-slider .spd-arrow-prev {
    left: 10px;
}
.spd-slider .spd-arrow-next {
    right: 10px;
}
.spd-slider .swiper-pagination {
    position: relative;
    margin-top: 10px;
    text-align: center;
}
.spd-slider .swiper-pagination-bullet {
    display: inline-block;
    border-radius: 50%;
    margin: 0 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease, background 0.2s ease;
}
.spd-slider .swiper-pagination-bullet-active {
    opacity: 1;
}

/* ── Image Gallery ──────────────────────────────────────────────── */
.spd-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--spd-gallery-cols, 3), 1fr);
}
.spd-gallery-grid.spd-gallery-masonry {
    /* Masonry column mode */
    display: column;
    column-count: var(--spd-gallery-cols, 3);
    column-gap: 8px;
}
.spd-gallery-masonry .spd-gallery-item {
    break-inside: avoid;
    margin-bottom: 8px;
}
.spd-gallery-item {
    position: relative;
    overflow: hidden;
    line-height: 0;
}
.spd-gallery-grid:not(.spd-gallery-masonry) .spd-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: var(--spd-gallery-aspect, auto);
}
.spd-gallery-masonry .spd-gallery-item img {
    width: 100%;
    height: auto;
}
.spd-gallery-item img {
    transition: transform 0.3s ease;
}
.spd-gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.spd-gallery-item:hover::after {
    opacity: 1;
}

/* Responsive gallery */
@media (max-width: 1024px) {
    .spd-gallery-grid:not(.spd-gallery-masonry) {
        grid-template-columns: repeat(var(--spd-gallery-cols-tablet, 2), 1fr);
    }
    .spd-gallery-masonry {
        column-count: var(--spd-gallery-cols-tablet, 2);
    }
}
@media (max-width: 767px) {
    .spd-gallery-grid:not(.spd-gallery-masonry) {
        grid-template-columns: repeat(var(--spd-gallery-cols-mobile, 1), 1fr);
    }
    .spd-gallery-masonry {
        column-count: var(--spd-gallery-cols-mobile, 1);
    }
}

/* ── Nested Taxonomy Links ──────────────────────────────────────── */
.spd-tax-links {
    display: flex;
    flex-wrap: wrap;
}
.spd-tax-links.spd-tax-list {
    flex-direction: column;
}
.spd-tax-links.spd-tax-inline {
    flex-direction: row;
    align-items: center;
}
.spd-tax-links.spd-tax-grid {
    display: grid;
    grid-template-columns: repeat(var(--spd-taxgrid-cols, 3), 1fr);
}
@media (max-width: 1024px) {
    .spd-tax-links.spd-tax-grid {
        grid-template-columns: repeat(var(--spd-taxgrid-cols-t, 2), 1fr);
    }
}
@media (max-width: 767px) {
    .spd-tax-links.spd-tax-grid {
        grid-template-columns: repeat(var(--spd-taxgrid-cols-m, 1), 1fr);
    }
}
.spd-tax-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.spd-tax-link:hover {
    text-decoration: none;
}
.spd-tax-sep {
    margin: 0 4px;
    opacity: 0.5;
}
.spd-tax-heading {
    margin-top: 0;
}

/* ── Taxonomy Filter Form ───────────────────────────────────────── */
.spd-filter-form {
    width: 100%;
}
.spd-filter-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
}
.spd-filter-fields.spd-filter-inline {
    flex-direction: row;
}
.spd-filter-fields.spd-filter-stacked {
    flex-direction: column;
}
.spd-filter-fields.spd-filter-grid {
    display: grid;
    grid-template-columns: repeat(var(--spd-filtergrid-cols, 3), 1fr);
}
@media (max-width: 1024px) {
    .spd-filter-fields.spd-filter-grid {
        grid-template-columns: repeat(var(--spd-filtergrid-cols-t, 2), 1fr);
    }
    .spd-filter-fields.spd-filter-inline {
        flex-wrap: wrap;
    }
}
@media (max-width: 767px) {
    .spd-filter-fields.spd-filter-grid {
        grid-template-columns: repeat(var(--spd-filtergrid-cols-m, 1), 1fr);
    }
    .spd-filter-fields.spd-filter-inline {
        flex-direction: column;
    }
}
.spd-filter-field {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}
.spd-filter-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}
.spd-filter-select {
    width: 100%;
    min-height: 40px;
    appearance: auto;
    cursor: pointer;
}
.spd-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}
.spd-filter-label-option {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.spd-filter-submit {
    display: inline-block;
    margin-top: 12px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: background 0.2s ease;
    padding: 10px 24px;
    white-space: nowrap;
}
.spd-filter-field.spd-loading .spd-filter-select {
    opacity: 0.5;
    pointer-events: none;
}
