/* ==========================================================================
   Discipline Selector — horizontal pill toggles (production match)
   ========================================================================== */

.sector-magic-form {
    margin: 0 0 20px;
}

.pf-redes-search__discipline-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    border: none;
    padding: 0;
    margin: 0 0 10px;
    justify-content: center;
}

.pf-redes-search__discipline-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.pf-redes-search__discipline-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1.5px solid #d0d0d0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-transform: none;
    color: #555;
    font-family: "Open Sans", sans-serif;
    background: #fafafa;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.pf-redes-search__discipline-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    flex-shrink: 0;
}
.pf-redes-search__discipline-check svg {
    width: 12px;
    height: 10px;
    color: #fff;
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    transition: stroke-dashoffset 0.35s ease 0.1s;
}

.pf-redes-search__discipline-pill:hover {
    color: #333;
    border-color: #aaa;
    background: #f0f0f0;
}

.pf-redes-search__discipline-pill--active,
.pf-redes-search__discipline-pill--active:hover {
    background: #C91517;
    border-color: #C91517;
    color: #fff;
    font-weight: 600;
}
.pf-redes-search__discipline-pill--active .pf-redes-search__discipline-check {
    width: 18px;
    opacity: 1;
}
.pf-redes-search__discipline-pill--active .pf-redes-search__discipline-check svg {
    stroke-dashoffset: 0;
}

.pf-redes-search__discipline-pill--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   Sub-sections area — wrapper handles open/close, containers crossfade
   ========================================================================== */

.sub-sections-area {
    position: relative;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.sub-sections-area:has(.sub-sections-container.active) {
    max-height: 200px;
    opacity: 1;
}

.sub-sections-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.sub-sections-container.active {
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

.sub-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-section label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.sub-section select {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: #efefff;
    color: #333;
    cursor: pointer;
    min-width: 160px;
    appearance: auto;
}

.sub-section select:focus {
    outline: 2px solid var(--pf-redes-primary, #c00);
    outline-offset: -1px;
}

/* ==========================================================================
   Pill attention animation — subtle shimmer on unselected pills
   ========================================================================== */

@keyframes pf-pill-shimmer {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(201, 21, 23, 0);
        border-color: #d0d0d0;
    }
    50% {
        box-shadow: 0 0 6px 0 rgba(201, 21, 23, 0.18);
        border-color: rgba(201, 21, 23, 0.35);
    }
}

.pf-redes-search__discipline-pill {
    animation: pf-pill-shimmer 3s ease-in-out infinite;
}

.pf-redes-search__discipline-pill--active,
.pf-redes-search__discipline-pill--active:hover,
.pf-redes-search__discipline-pill--disabled {
    animation: none;
}

/* ==========================================================================
   Mobile: pills fit in one row
   ========================================================================== */

@media (max-width: 700px) {
    .pf-redes-search__discipline-selector {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .pf-redes-search__discipline-pill {
        padding: 5px 8px;
        font-size: 13px;
        gap: 2px;
    }

    .pf-redes-search__discipline-pill--active .pf-redes-search__discipline-check {
        width: 14px;
    }
    .pf-redes-search__discipline-check svg {
        width: 10px;
        height: 8px;
    }

    .sub-sections-container {
        justify-content: flex-start;
        gap: 10px;
    }

    .sub-sections-area:has(.sub-sections-container.active) {
        max-height: 300px;
    }
}

@media (max-width: 450px) {
    .pf-redes-search__discipline-selector {
        gap: 4px;
    }

    .pf-redes-search__discipline-pill {
        padding: 4px 6px;
        font-size: 12px;
    }

    .sub-sections-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .sub-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .sub-section select {
        width: 100%;
        min-width: 0;
    }

    .sub-sections-area:has(.sub-sections-container.active) {
        max-height: 400px;
    }
}
