/* settings-form.css - The schema-driven form inputs (Number, Checkbox, Textarea) */

/* Settings Panel (Expandable with slide animation) */
.rule-settings-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, margin-top 0.3s ease-out, margin-bottom 0.3s ease-out;
    margin-top: 0;
    margin-bottom: 0;
}

.rule-settings-panel.expanded {
    max-height: 500px;
    margin-top: 8px;
    margin-bottom: 12px;
}

/* --- Schema-Driven Settings Form Styles --- */

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 24px; /* Increased from 16px to push groups apart */
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Tightened from 6px - label and input form a single visual unit */
    margin-bottom: 24px; /* Increased from 16px for clear separation between fields */
}

.setting-group:last-child {
    margin-bottom: 0; /* Remove bottom margin from last group */
}

.setting-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 2px; /* Very tight to the input - creates single visual unit */
    display: block; /* Ensure it takes full width */
    line-height: 1.2;
}

[data-theme="light"] .setting-label {
    color: #1e293b; /* slate-800 */
}

.setting-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: normal;
    font-weight: 400;
    margin-top: 0; /* Tight under the label */
    margin-bottom: 6px; /* Space between description and input */
    line-height: 1.3;
}

[data-theme="light"] .setting-description {
    color: #475569; /* slate-600 - darker for better contrast */
}

[data-theme="dark"] .setting-description {
    color: #94a3b8; /* slate-400 - lighter for better contrast on dark */
}

.setting-input,
.setting-list-input,
.config-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    height: 40px; /* Force consistent height for text and selects */
    line-height: normal;
    box-sizing: border-box; /* Include padding in height calculation */
}

.setting-input:focus,
.setting-list-input:focus,
.config-select:focus {
    outline: none;
    border-color: #9333ea; /* purple-600 */
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

[data-theme="light"] .setting-input,
[data-theme="light"] .setting-list-input,
[data-theme="light"] .config-select {
    background: white;
    border-color: #cbd5e1; /* slate-300 */
    color: #0f172a; /* slate-900 */
}

[data-theme="light"] .setting-input:focus,
[data-theme="light"] .setting-list-input:focus,
[data-theme="light"] .config-select:focus {
    border-color: #9333ea;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.15);
}

.setting-list-input {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    resize: vertical;
    height: auto; /* Override fixed height for textareas */
    min-height: 80px; /* Minimum height for textareas */
}

.setting-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #9333ea; /* purple-600 */
    margin-top: 8px;
}

.setting-checkbox:focus {
    outline: 2px solid #9333ea;
    outline-offset: 2px;
    border-radius: 2px;
}

.setting-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    margin-bottom: 0;
    font-style: italic;
}

[data-theme="light"] .setting-hint {
    color: #64748b; /* slate-500 */
}

[data-theme="dark"] .setting-hint {
    color: #94a3b8; /* slate-400 */
}

/* Legacy JSON Textarea (Fallback for dict/object types) */
.rule-settings-json {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    background: #020617; /* slate-950 - dark panel */
    color: #f1f5f9; /* slate-100 */
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.75rem;
    border: 1px solid #1e293b; /* slate-800 */
    border-radius: 6px;
    resize: vertical;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

[data-theme="light"] .rule-settings-json {
    background: #0f172a; /* slate-900 */
    color: #e2e8f0; /* slate-200 */
    border-color: #334155; /* slate-700 */
}

.rule-settings-json:focus {
    outline: none;
    border-color: #9333ea; /* purple-600 */
}

/* JSON Validation States */
.rule-settings-json.json-valid {
    border-color: #10b981; /* green-500 - valid JSON */
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.rule-settings-json.json-invalid {
    border-color: #ef4444; /* red-500 - invalid JSON */
    border-width: 2px;
}

.rule-settings-error {
    color: #ef4444; /* red-500 */
    font-size: 0.75rem;
    margin-top: 8px;
    padding: 8px;
    background: rgba(239, 68, 68, 0.1); /* red-500/10 */
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    display: none;
}

[data-theme="dark"] .rule-settings-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171; /* red-400 */
}

/* Legacy Settings Styles (if still used) */
.rule-settings {
    margin-top: 12px;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.settings-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 8px;
}

.settings-json {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

