/* ============================================================
   PORTAL IOP - SELETOR.CSS
   Estilos do seletor de órgãos
   ============================================================ */

/* ---------- SEÇÃO SELETOR ---------- */
.selector-section {
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.selector-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
    pointer-events: none;
}

.selector-wrapper {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.selector-header {
    text-align: center;
    margin-bottom: 36px;
}

.selector-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    margin-bottom: 12px;
}

.selector-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* ---------- FORM ---------- */
.selector-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.selector-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.selector-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selector-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.selector-group label i {
    color: var(--primary-light);
    font-size: 0.85rem;
}

.selector-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: var(--transition);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    padding-right: 42px;
}

.selector-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.selector-select:hover {
    border-color: var(--primary-light);
}

/* ---------- BOTÃO ACESSAR ---------- */
.selector-btn-group {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.btn-acessar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 48px;
    background: var(--gradient-primary);
    color: var(--text-white);
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.btn-acessar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-acessar:hover::before {
    left: 100%;
}

.btn-acessar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.btn-acessar:active {
    transform: translateY(0);
}

.btn-acessar i {
    transition: var(--transition);
}

.btn-acessar:hover i {
    transform: translateX(4px);
}

/* ---------- INFO ---------- */
.selector-info {
    text-align: center;
    margin-top: 24px;
    padding: 16px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.selector-status {
    min-height: 1.5em;
    margin: 18px 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.selector-status.is-error {
    color: #b91c1c;
    font-weight: 600;
}

.selector-info i {
    color: var(--primary-light);
}

#fonte-dados {
    font-weight: 600;
    color: var(--primary);
}

/* ============================================================
   SELECT2 - TEMA PERSONALIZADO
   ============================================================ */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    width: 100%;
    height: 52px;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.select2-container--default .select2-selection--single:hover {
    border-color: var(--primary-light);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary);
    line-height: 30px;
    padding-right: 30px;
    font-weight: 500;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-light);
    font-weight: 400;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px;
    right: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--text-light) transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--primary-light) transparent;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    color: var(--text-light);
    font-size: 1.2rem;
    margin-right: 8px;
}

/* Dropdown */
.select2-dropdown {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--bg-secondary);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.select2-results {
    max-height: 280px;
    overflow-y: auto;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--gradient-primary);
    color: var(--text-white);
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary);
    font-weight: 600;
}

.select2-container--default .select2-results__option {
    padding: 10px 16px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.select2-container--default .select2-results__option:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* Scrollbar customizada */
.select2-results__options::-webkit-scrollbar {
    width: 6px;
}

.select2-results__options::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.select2-results__options::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 768px) {
    .selector-wrapper {
        padding: 32px 24px;
    }

    .selector-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .btn-acessar {
        width: 100%;
        justify-content: center;
        padding: 16px 32px;
    }
}

@media (max-width: 480px) {
    .selector-wrapper {
        padding: 24px 16px;
    }

    .selector-header h2 {
        font-size: 1.4rem;
    }

    .selector-header p {
        font-size: 0.95rem;
    }
}
