/* ============================================================
   automation.css
   ============================================================ */

/* ── Progress bar ────────────────────────────────────────── */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
}

.progress-bar-track {
    flex: 1;
    height: 6px;
    background: var(--border-color, #e5e7eb);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--primary, #2563eb);
    transition: width 0.4s ease;
}

.progress-bar-fill--completed {
    background: #16a34a;
}

.progress-bar-fill--failed {
    background: #dc2626;
}

.progress-bar-fill--pending {
    background: #d97706;
}

.progress-bar-fill--in_progress {
    background: #2563eb;
}

.progress-pct {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    white-space: nowrap;
    min-width: 36px;
    text-align: right;
}

/* ── Status badges ───────────────────────────────────────── */
.badge--in_progress {
    background: #eff6ff;
    color: #2563eb;
}

/* ── Stat icon colours ───────────────────────────────────── */
.stat-card__icon--red {
    background: #fef2f2;
    color: #dc2626;
}

/* ── Modal tweaks for prepare ────────────────────────────── */
.pm-count-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary, #6b7280);
    background: var(--hover-bg, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    padding: 7px 10px;
}

.pm-count-hint i {
    flex-shrink: 0;
    color: var(--primary, #2563eb);
}

/* ── Modal shared (if not already in app.css) ────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fade-in .15s ease;
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

@keyframes fade-in {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.modal-box {
    background: var(--card-bg, #fff);
    border-radius: 14px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
    display: flex;
    flex-direction: column;
    animation: slide-up .18s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slide-up {
    from {
        transform: translateY(16px);
        opacity: 0
    }

    to {
        transform: translateY(0);
        opacity: 1
    }
}

.modal-box--sm {
    max-width: 480px;
}

.modal-box--lg {
    max-width: 700px;
}

.modal-box__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.modal-box__title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-box__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0;
}

.modal-box__close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.modal-box__close:hover {
    color: var(--text-primary, #111827);
    background: var(--hover-bg, #f3f4f6);
}

.modal-box__body {
    padding: 24px;
}

.modal-box__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--card-header-bg, #fafafa);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-radius: 0 0 14px 14px;
}

.btn-cancel {
    padding: 9px 18px;
    background: transparent;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary, #374151);
    cursor: pointer;
    transition: background .15s;
}

.btn-cancel:hover {
    background: var(--hover-bg, #f3f4f6);
}

.btn-settings-save {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px;
    background: var(--primary, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s, transform .1s;
}

.btn-settings-save:hover {
    background: var(--primary-dark, #1d4ed8);
}

.btn-settings-save:active {
    transform: scale(.98);
}

.btn-settings-save:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-settings-save.loading i {
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.settings-panel__icon--blue {
    background: #eff6ff;
    color: #2563eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.req {
    color: #dc2626;
}

.settings-input {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 9px 13px;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 8px;
    background: var(--input-bg, #fff);
    color: var(--text-primary, #111827);
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.settings-input:focus {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px var(--primary-ring, rgba(37, 99, 235, .12));
}

.settings-input.font-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.825rem;
}
