/* Smart School Filter (wizard modal) */

.soso-smart-school-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #ffffff;
    color: #0f172a;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.soso-smart-school-filter-btn:hover {
    background: #f8fafc;
}

.soso-smart-filter-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: auto;
    z-index: 1000005;
}

.soso-smart-filter-modal.is-open {
    display: flex;
}

.soso-smart-filter-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.soso-smart-filter-modal__dialog {
    position: relative;
    width: min(560px, calc(100vw - 24px));
    margin: 0;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 18px 18px 16px;
    color: #0f172a;
    max-height: calc(100vh - 24px);
    overflow: auto;
    box-sizing: border-box;
}

.soso-smart-filter-modal__dialog *,
.soso-smart-filter-modal__dialog *::before,
.soso-smart-filter-modal__dialog *::after {
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .soso-smart-filter-modal.is-open {
        align-items: flex-start;
    }
    .soso-smart-filter-modal__dialog {
        margin-top: 8vh;
        width: calc(100vw - 16px);
        max-width: 100%;
        padding: 14px 14px 12px;
    }
}

/* Verified anti-overflow rules (same as DevTools injection) */
.soso-smart-filter-modal__dialog {
    box-sizing: border-box !important;
}

.soso-smart-filter-modal__body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
}

.soso-smart-filter-modal__body > * {
    min-width: 0 !important;
    max-width: 100% !important;
}

@media (max-width: 480px) {
    .soso-smart-filter-modal__dialog {
        max-width: calc(100vw - 16px) !important;
        width: calc(100vw - 16px) !important;
    }

    .soso-smart-filter-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        align-items: stretch !important;
    }
    .soso-smart-filter-actions button {
        width: 100% !important;
    }

    /* Order to keep “上一步 + 下一步” on first row */
    .soso-smart-filter-actions > button.soso-primary {
        order: 2;
    }
    /* When “显示全部学校” exists, it is the 2nd plain button */
    .soso-smart-filter-actions > button:not(.soso-primary):not(.soso-secondary):nth-child(2) {
        order: 3;
    }
    .soso-smart-filter-actions > button.soso-secondary {
        order: 4;
    }
    /* If only 3 buttons (no “显示全部学校”), make secondary full-width on 2nd row */
    .soso-smart-filter-actions > button.soso-secondary:nth-child(2):nth-last-child(2) {
        grid-column: 1 / -1;
        order: 3;
    }
}

.soso-smart-filter-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #334155;
}

.soso-smart-filter-modal__title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 900;
}

.soso-smart-filter-modal__desc {
    margin: 0 0 14px 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

.soso-smart-filter-modal__body {
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.soso-smart-filter-modal__body > * {
    min-width: 0;
    max-width: 100%;
}

.soso-smart-filter-field label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #334155;
    margin-bottom: 6px;
}

.soso-smart-filter-field select {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    background: #ffffff;
    color: #0f172a;
    box-sizing: border-box;
}

.soso-smart-filter-field input[type="date"],
.soso-smart-filter-field input[type="text"],
.soso-smart-filter-field input[type="number"] {
    width: 100%;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    background: #ffffff;
    color: #0f172a;
    box-sizing: border-box;
}

.soso-smart-filter-field input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

.soso-smart-filter-calc-box {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    background: #e3f2fc;
    display: grid;
    gap: 10px;
}

.soso-smart-date {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
}

.soso-smart-date__input {
    padding-right: 44px !important;
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.soso-smart-date__btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 4;
    padding: 0;
    font-size: 0; /* hide any text content */
    color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A//www.w3.org/2000/svg'%20viewBox%3D'0%200%2024%2024'%20fill%3D'none'%3E%3Cpath%20d%3D'M7%202V4M17%202V4'%20stroke%3D'%23334155'%20stroke-width%3D'2'%20stroke-linecap%3D'round'/%3E%3Cpath%20d%3D'M4.5%209H19.5'%20stroke%3D'%23334155'%20stroke-width%3D'2'%20stroke-linecap%3D'round'/%3E%3Cpath%20d%3D'M6%204H18C19.1046%204%2020%204.89543%2020%206V18C20%2019.1046%2019.1046%2020%2018%2020H6C4.89543%2020%204%2019.1046%204%2018V6C4%204.89543%204.89543%204%206%204Z'%20stroke%3D'%23334155'%20stroke-width%3D'2'%20stroke-linejoin%3D'round'/%3E%3Cpath%20d%3D'M8%2013H8.01M12%2013H12.01M16%2013H16.01M8%2017H8.01M12%2017H12.01M16%2017H16.01'%20stroke%3D'%23334155'%20stroke-width%3D'2'%20stroke-linecap%3D'round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
}

.soso-smart-date__picker {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
}

.soso-smart-filter-calc-title {
    font-size: 13px;
    font-weight: 900;
    color: #0f172a;
}

.soso-smart-filter-help {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.soso-smart-filter-calc-result {
    font-size: 13px;
    font-weight: 800;
    color: #4682B4;
}

.soso-smart-filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
    flex-wrap: wrap;
}

.soso-smart-filter-actions button {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #0f172a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

@media (max-width: 480px) {
    .soso-smart-filter-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        align-items: stretch;
    }
    .soso-smart-filter-actions button {
        width: 100%;
    }

    .soso-smart-filter-actions > button.soso-primary {
        order: 2;
    }
    .soso-smart-filter-actions > button:not(.soso-primary):not(.soso-secondary):nth-child(2) {
        order: 3;
    }
    .soso-smart-filter-actions > button.soso-secondary {
        order: 4;
    }
    .soso-smart-filter-actions > button.soso-secondary:nth-child(2):nth-last-child(2) {
        grid-column: 1 / -1;
        order: 3;
    }
}

.soso-smart-filter-actions button.soso-primary {
    background: #4682B4;
    border-color: #4682B4;
    color: #ffffff;
}

.soso-smart-filter-actions button.soso-secondary {
    border-color: rgba(70, 130, 180, 0.35);
    color: #356691;
    background: #ffffff;
}

.soso-smart-filter-actions button.soso-secondary:hover {
    background: rgba(227, 242, 252, 0.9);
}

.soso-smart-filter-status {
    margin-top: 6px;
    font-size: 13px;
    color: #475569;
}

.soso-smart-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 6px;
}

.soso-smart-step {
    font-size: 12px;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
}

.soso-smart-step.is-active {
    background: #4682B4;
    border-color: #4682B4;
    color: #ffffff;
}

.soso-smart-note {
    font-size: 12px;
    line-height: 1.5;
    color: #334155;
    background: #e3f2fc;
    border: 1px solid rgba(70, 130, 180, 0.22);
    border-radius: 12px;
    padding: 10px 12px;
}

.soso-smart-flow {
    display: grid;
    gap: 6px;
    padding: 10px 0;
}

.soso-smart-flow-row {
    font-size: 13px;
    color: #334155;
}

.soso-smart-option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 420px) {
    .soso-smart-option-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .soso-smart-option-grid { grid-template-columns: 1fr; }
}

.soso-smart-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
}

.soso-smart-option:hover {
    background: #f8fafc;
}

.soso-smart-option.is-selected {
    border-color: rgba(70, 130, 180, 0.7);
    box-shadow: 0 6px 20px rgba(70, 130, 180, 0.14);
}

.soso-smart-option.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.soso-smart-search {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    background: #ffffff;
    color: #0f172a;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.soso-smart-extras {
    display: grid;
    gap: 10px;
    font-size: 13px;
}

.soso-smart-extra {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    background: #ffffff;
}

.soso-smart-extra-group {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.55);
}

.soso-smart-extra-group > summary {
    font-weight: 900;
}

.soso-smart-extra-group > .soso-smart-extra {
    margin-top: 8px;
}

.soso-smart-extra summary {
    cursor: pointer;
    font-weight: 500;
    color: #0f172a;
    list-style: none;
    font-size: 13px;
}

.soso-smart-extra summary::-webkit-details-marker {
    display: none;
}

.soso-smart-check {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: #334155;
    margin-top: 8px;
}

@media (max-width: 480px) {
    .soso-smart-extras { font-size: 12px; }
    .soso-smart-extra { padding: 9px 10px; }
    .soso-smart-extra summary { font-size: 12px; }
}

.soso-smart-check input {
    margin: 0;
}
