/* ===== Layout & Modal Structure ===== */
.scenario-config-form .modal-dialog,
#ScenarioModal .modal-dialog {
    margin: 1.75rem auto;
    max-height: calc(100vh - 3.5rem);
    display: flex;
    align-items: flex-start;
    max-width: min(960px, calc(100vw - 2rem));
}

.scenario-config-form .modal-content,
#ScenarioModal .modal-content {
    max-height: calc(100vh - 3.5rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}

/* ===== Header ===== */
.scf-header {
    padding: 1.25rem 1.75rem;
    background: #fff;
    border-bottom: 1px solid #e9ecef !important;
    flex-shrink: 0;
}

.scf-header-content {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.scf-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a73e8;
    font-size: 1rem;
    flex-shrink: 0;
}

/* ===== Body ===== */
.scf-body {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 200px);
    flex: 1;
    padding: 1.5rem 1.75rem;
    background: #f8f9fa;
}

.scf-body::-webkit-scrollbar {
    width: 5px;
}

.scf-body::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 4px;
}

/* ===== Sections ===== */
.scf-section {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.scf-section:last-child {
    margin-bottom: 0;
}

.scf-section-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f3f5;
}

.scf-section-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #1a73e8;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.scf-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.125rem;
}

.scf-section-subtitle {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0;
}

.scf-section-body {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

/* ===== Form Fields ===== */
.scf-field-group {
    display: flex;
    flex-direction: column;
}

.scf-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.scf-label-icon {
    color: #6c757d;
    font-size: 0.75rem;
    width: 16px;
    text-align: center;
}

.scf-input {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.scf-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
    outline: none;
}

.scf-input::placeholder {
    color: #adb5bd;
}

.scf-textarea {
    resize: vertical;
    min-height: 100px;
}

.scf-select {
    cursor: pointer;
}

/* ===== Add Property Button ===== */
.scf-add-btn {
    border-radius: 0.5rem;
    font-size: 0.8rem;
    padding: 0.4rem 0.875rem;
    white-space: nowrap;
    margin-left: auto;
}

/* ===== Property Table ===== */
.scf-property-list {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    overflow: hidden;
}

.scf-table {
    margin-bottom: 0;
    font-size: 0.82rem;
}

.scf-table thead th {
    background: #f8f9fa;
    color: #6c757d;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
}

.scf-table tbody td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
}

.scf-table tbody tr:last-child td {
    border-bottom: 0;
}

.scf-table tbody tr {
    transition: background-color 0.15s;
}

.scf-table tbody tr:hover {
    background-color: #f8f9fa;
}

.scf-table tbody tr.is-active {
    background-color: #e8f0fe;
}

.scf-prop-key {
    font-weight: 600;
    color: #212529;
    font-size: 0.82rem;
}

.scf-prop-value {
    display: block;
    font-size: 0.75rem;
    color: #495057;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scf-row-actions {
    display: flex;
    gap: 0.375rem;
    justify-content: flex-end;
}

.scf-btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #6c757d;
    border: 1px solid #dee2e6;
    background: #fff;
    transition: all 0.15s;
}

.scf-btn-icon:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}

.scf-btn-icon-danger:hover {
    background: #fdf0f0;
    border-color: #dc3545;
    color: #dc3545;
}

/* ===== Empty State ===== */
.scf-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.scf-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f1f3f5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

/* ===== Property Editor Panel ===== */
.scf-editor {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    overflow: hidden;
}

.scf-editor-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.scf-back-btn {
    font-size: 0.8rem;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: #fff;
    transition: all 0.15s;
}

.scf-back-btn:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}

.scf-editor-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1a73e8;
    background: #e8f0fe;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
}

.scf-editor-body {
    padding: 1.5rem;
}

.scf-value-editor {
    min-height: 180px;
    resize: vertical;
    line-height: 1.6;
    font-size: 0.82rem;
}

.scf-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* ===== Footer ===== */
.scf-footer {
    padding: 1rem 1.75rem;
    background: #fff;
    border-top: 1px solid #e9ecef !important;
    flex-shrink: 0;
}

/* ===== Property Edit Mode ===== */
.scenario-config-form.property-edit-mode .scf-header {
    border-bottom-color: #e9ecef !important;
}

/* ===== Responsive ===== */
@media (max-width: 767.98px) {
    .scf-header {
        padding: 1rem 1.25rem;
    }

    .scf-body {
        padding: 1rem;
    }

    .scf-section {
        padding: 1.25rem;
    }

    .scf-section-header {
        flex-wrap: wrap;
    }

    .scf-add-btn {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }

    .scf-editor-body {
        padding: 1.25rem;
    }

    .scf-table thead th,
    .scf-table tbody td {
        padding: 0.5rem;
    }
}
