/* ===== AUTOMATIONS ===== */

.badge-automation-active {
    background: var(--success-color);
    color: #fff;
}

.badge-automation-inactive {
    background: var(--border-color);
    color: var(--text-color);
}

.badge-automation-disabled {
    background: var(--border-color);
    color: var(--text-muted);
    opacity: 0.7;
}

.automation-status-disabled {
    opacity: 0.6;
}

.automation-logic-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 4px;
}

/* Automation rule pills — constrain to card width */
[data-automation-id] .card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}
[data-automation-id] .stream-card-prop {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Automation rule editor rows */
.automation-rule-row {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-secondary, var(--bg-color));
}

.rule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rule-type-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.rule-type-select {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 2px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

.rule-hint-desc {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-remove-rule {
    background: none;
    border: none;
    color: var(--danger-color, #dc3545);
    cursor: pointer;
    padding: 2px 6px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.btn-remove-rule:hover {
    opacity: 1;
}

.btn-remove-rule .icon {
    width: 16px;
    height: 16px;
}

.rule-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-field label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 3px;
    color: var(--text-muted);
}

/* ── Time-of-Day picker ────────────────────────────────────── */

.time-range-picker {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--duration-fast) ease;
}
.time-range-picker:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.time-range-slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 12px 8px;
    position: relative;
}
.time-range-slot + .time-range-slot {
    border-left: 1px solid var(--border-color);
}

.time-range-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.time-range-input-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
}

.time-range-input-wrap input[type="number"] {
    width: 2.4ch;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: inherit;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-color);
    padding: 4px 2px;
    -moz-appearance: textfield;
    transition: border-color var(--duration-fast) ease,
                background var(--duration-fast) ease;
}
.time-range-input-wrap input[type="number"]::-webkit-inner-spin-button,
.time-range-input-wrap input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.time-range-input-wrap input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 8%, var(--bg-secondary));
}

.time-range-colon {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
    padding: 0 1px;
    user-select: none;
}

.time-range-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    color: var(--text-muted);
    font-size: 1.1rem;
    align-self: center;
    user-select: none;
}


.rule-field select,
.rule-field textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: inherit;
}

.rule-apps {
    resize: vertical;
    min-height: 60px;
}

.rule-apps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* Webhook URL row */
.webhook-url-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.webhook-url-row input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.8rem;
    font-family: monospace;
}

.btn-webhook-copy {
    white-space: nowrap;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

.webhook-save-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    margin: 4px 0 0;
}
