/* Phase 6 split from frontend/static/app.css */
/* Section: jobs_history_main */

/* Jobs Filter & Bulk */
.jobs-filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.jobs-filters-row .form-input,
.jobs-filters-row .form-select {
    flex: 1;
    min-width: 120px;
}
.jobs-bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle, rgba(59,130,246,0.12));
}
.job-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

/* ---------- Job History ---------- */
.history-filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.history-filters-row .form-select {
    flex: 1;
    min-width: 140px;
}

.history-card {
    background: var(--bg-surface, #0d1b32);
    border: 1px solid var(--border-subtle, rgba(59,130,246,0.12));
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.history-card:hover {
    border-color: var(--accent-blue, #3b82f6);
    box-shadow: var(--shadow-glow-blue, 0 0 20px rgba(59,130,246,0.22));
}

.history-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.history-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.history-mode-icon {
    font-size: 1.2rem;
}
.history-job-name {
    font-weight: 600;
    font-size: 0.95rem;
}
.history-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.history-card-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 10px;
}

.history-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}
.history-stat {
    background: var(--bg-elevated, #122444);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.history-stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 2px;
}
.history-stat-value {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-blue, #3b82f6);
}

.history-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #f87171;
    font-size: 0.8rem;
}

/* History Detail Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.hidden {
    display: none;
}

.history-detail-modal {
    background: var(--bg-surface, #0d1b32);
    border: 1px solid var(--border-default, rgba(59,130,246,0.2));
    border-radius: 14px;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.history-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.history-detail-header h3 {
    margin: 0;
    font-size: 1.1rem;
    word-break: break-all;
}
.history-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.history-detail-files {
    margin-bottom: 16px;
}
.history-detail-files-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted, #94a3b8);
}
.history-detail-file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle, rgba(59,130,246,0.1));
    font-size: 0.85rem;
}
.history-detail-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-detail-file-size {
    color: var(--text-muted, #94a3b8);
    font-size: 0.8rem;
    flex-shrink: 0;
}
.history-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* Responsive history */
@media (max-width: 600px) {
    .history-card-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .history-detail-grid {
        grid-template-columns: 1fr;
    }
    .history-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* History Detail Modal - Enhanced */
.history-detail-section {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-elevated, #122444);
    border-radius: 8px;
}
.history-detail-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.history-detail-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.history-detail-section-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.history-detail-section-tools #history-detail-selected-count {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    margin-right: 4px;
}
.history-detail-file-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.history-detail-file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle, rgba(59,130,246,0.1));
    font-size: 0.85rem;
}
.history-detail-file-row:last-child {
    border-bottom: none;
}
.history-detail-file-row .file-item-icon {
    flex-shrink: 0;
    font-size: 1rem;
}
.history-detail-file-row .history-detail-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-detail-file-row .history-detail-file-size {
    color: var(--text-muted, #94a3b8);
    font-size: 0.8rem;
    flex-shrink: 0;
}
.history-detail-file-row .btn {
    flex-shrink: 0;
    padding: 2px 8px;
    font-size: 0.75rem;
}
.history-detail-more {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    padding-top: 6px;
    text-align: center;
}
.history-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.history-detail-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* History Stats Bar */
.history-stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.history-quick-stat {
    background: var(--bg-surface, #0d1b32);
    border: 1px solid var(--border-subtle, rgba(59,130,246,0.12));
    border-radius: 10px;
    padding: 12px 20px;
    flex: 1;
    min-width: 120px;
    text-align: center;
}
.history-quick-stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-blue, #3b82f6);
    line-height: 1.2;
}
.history-quick-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 4px;
}


/* History card header checkbox */
.history-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}
.history-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Bulk actions */
.history-bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle, rgba(59,130,246,0.12));
}
.history-bulk-actions #history-selected-count {
    font-size: 0.85rem;
    color: var(--text-muted, #94a3b8);
    margin-right: auto;
}

/* Danger outline button */
.btn-danger-outline {
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}
.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Expired history card */
.history-card-expired {
    opacity: 0.6;
    filter: grayscale(0.3);
}
.history-expired-banner {
    background: rgba(100, 100, 120, 0.2);
    color: #94a3b8;
    text-align: center;
    font-size: 0.75rem;
    padding: 4px;
    border-radius: 10px 10px 0 0;
    margin: -16px -16px 12px -16px;
}

/* Empty state */
.history-empty-state {
    text-align: center;
    padding: 60px 20px;
}
.history-empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.4;
}
.history-empty-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.history-empty-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}
