/* Control Flow Configuration Overlay */
#control-flow-config-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.control-flow-config-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 550px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header */
.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    background: white;
    border-radius: 8px 8px 0 0;
}

.config-header h2 {
    margin: 0;
    font-weight: bold;
    font-size: 1.25rem;
}

.config-header .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    color: #6c757d;
    transition: opacity 0.15s ease;
}

.config-header .close-btn:hover {
    opacity: 0.7;
}

/* Content */
.config-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    max-height: 70vh;
}

.config-section {
    margin-bottom: 28px;
}

.config-section:last-child {
    margin-bottom: 0;
}

.config-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-text {
    margin: 0 0 16px 0;
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.5;
}

/* Form Elements */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #34495e;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #95a5a6;
    font-style: italic;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

/* Checkbox Labels */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Branch Info */
.branch-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
}

.branch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 14px;
}

.branch-item:last-child {
    margin-bottom: 0;
}

.branch-item i {
    font-size: 20px;
}

.branch-true {
    background: rgba(46, 204, 113, 0.1);
    border: 2px solid #2ecc71;
}

.branch-true i {
    color: #2ecc71;
}

.branch-false {
    background: rgba(231, 76, 60, 0.1);
    border: 2px solid #e74c3c;
}

.branch-false i {
    color: #e74c3c;
}

/* Loop Type Selector */
.loop-type-selector,
.trigger-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.loop-type-card,
.trigger-type-card {
    position: relative;
    cursor: pointer;
}

.loop-type-card input[type="radio"],
.trigger-type-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.card-content {
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem 0.75rem;
    text-align: center;
    transition: all 0.15s ease;
    background: white;
}

.card-content i {
    font-size: 2rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.card-content h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
}

.card-content p {
    margin: 0;
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.3;
}

.loop-type-card input[type="radio"]:checked + .card-content,
.trigger-type-card input[type="radio"]:checked + .card-content {
    border-color: #0d6efd;
    background: rgba(13, 110, 253, 0.05);
}

.loop-type-card input[type="radio"]:checked + .card-content i,
.trigger-type-card input[type="radio"]:checked + .card-content i {
    color: #0d6efd;
}

.loop-type-card:hover .card-content,
.trigger-type-card:hover .card-content {
    border-color: #adb5bd;
}

/* Footer */
.config-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    background: white;
    border-radius: 0 0 8px 8px;
}

.btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.15s ease;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background: #5c636a;
    border-color: #565e64;
}

.btn-primary {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background: #0b5ed7;
    border-color: #0a58ca;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .control-flow-config-container {
        width: 95%;
        max-height: 95vh;
    }

    .config-header {
        padding: 16px 18px;
    }

    .config-header h2 {
        font-size: 18px;
    }

    .config-content {
        padding: 18px;
    }

    .loop-type-selector,
    .trigger-type-selector {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
.config-content::-webkit-scrollbar {
    width: 8px;
}

.config-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.config-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.config-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

