/* ============================================================
   GDR Smart Filter Widget — Styles (TERRA Aesthetic)
   ============================================================ */

.gdr-smart-filter-container {
    position: relative;
    display: inline-block;
    font-family: inherit;
}

/* ---- Trigger Button ---- */
.gdr-filter-trigger {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-weight: 500;
    font-size: 14px;
    color: #333;
    border-radius: 4px;
    white-space: nowrap !important;
}

.gdr-filter-trigger:hover,
.gdr-filter-trigger.is-active {
    border-color: #111;
    background: #f9f9f9;
}

.gdr-filter-label {
    display: block;
    line-height: 1;
}

.gdr-filter-trigger i {
    font-size: 12px;
    margin-left: 10px;
    transition: transform 0.3s ease;
}

.gdr-filter-trigger.is-active i {
    transform: rotate(180deg);
}

.gdr-filter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.gdr-filter-icon svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.gdr-filter-count {
    background: #111;
    color: #fff;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0 4px;
    line-height: 1;
}

/* ---- Dropdown Panel ---- */
.gdr-filter-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 999;
    width: 280px;
    background: #fff;
    border: 1px solid #ececec;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    padding: 24px;
    min-width: 280px;
    max-width: 360px;
    border-radius: 8px;
    animation: gdrFadeSlide 0.2s ease-out;
}

@keyframes gdrFadeSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Filter Rows (one per taxonomy) ---- */
.gdr-filter-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gdr-filter-section {
    padding: 16px 0;
    border-bottom: 1px solid #f2f2f2;
}

.gdr-filter-section:last-child {
    border-bottom: none;
}

/* ---- Section Title ---- */
.gdr-filter-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #999;
    margin: 0 0 12px 0;
}

.gdr-section-badge {
    background: #111;
    color: #fff;
    font-size: 9px;
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0 3px;
    line-height: 1;
}

/* ---- Options List ---- */
.gdr-filter-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ---- Single option (radio / checkbox) ---- */
.gdr-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Hierarchical indent via CSS custom property */
    padding-left: calc(var(--gdr-depth, 0) * 18px);
}

.gdr-filter-option input[type="radio"],
.gdr-filter-option input[type="checkbox"] {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #111;
}

.gdr-filter-option label {
    font-size: 13px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.4;
    transition: color 0.2s;
}

.gdr-filter-option label:hover {
    color: #111;
}

.gdr-filter-option input:checked+label {
    font-weight: 600;
    color: #111;
}

.gdr-term-count {
    color: #bbb;
    font-size: 11px;
    font-weight: 400;
}

/* Depth indicators: subtle left border for child items */
.gdr-filter-option--depth-1 {
    border-left: 2px solid #f0f0f0;
    margin-left: 6px;
    padding-left: calc(1 * 16px);
}

.gdr-filter-option--depth-2 {
    border-left: 2px solid #f0f0f0;
    margin-left: 10px;
    padding-left: calc(2 * 14px);
}

.gdr-filter-option--depth-3 {
    border-left: 2px solid #f0f0f0;
    margin-left: 14px;
    padding-left: calc(3 * 12px);
}

/* ---- Footer ---- */
.gdr-filter-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid #f2f2f2;
    gap: 12px;
}

.gdr-filter-footer button.gdr-filter-apply {
    background: #111;
    color: #fff;
    border: none;
    padding: 10px 18px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.25s ease;
    flex: 1 1 auto;
    min-width: 120px;
}

.gdr-filter-footer button.gdr-filter-apply:hover {
    background: #333;
}

.gdr-filter-clear {
    font-size: 12px;
    color: #bbb;
    text-decoration: none;
    transition: color 0.25s ease;
    white-space: nowrap;
}

.gdr-filter-clear:hover {
    color: #111;
    text-decoration: underline;
}

/* ---- Loading State ---- */
.gdr-smart-filter-container.is-loading .gdr-filter-rows {
    opacity: 0.45;
    pointer-events: none;
    filter: blur(1px);
    transition: opacity 0.2s, filter 0.2s;
}

.gdr-smart-filter-container.is-loading .gdr-filter-apply {
    position: relative;
    color: transparent;
}

.gdr-smart-filter-container.is-loading .gdr-filter-apply::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    top: 50%;
    left: 50%;
    margin: -7px 0 0 -7px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: gdrSpin 0.6s linear infinite;
}

@keyframes gdrSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Editor notice ---- */
.gdr-editor-notice {
    font-size: 12px;
    color: #888;
    padding: 8px 10px;
    background: #fafafa;
    border-radius: 4px;
    margin-bottom: 12px;
}