/* ==========================================================================
   My Tasks Page — status badges and table
   CSS is used here for :hover pseudo-classes and shared table styling.
   ========================================================================== */

/* --- Status badges ------------------------------------------------------- */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border: none;
    background: transparent;
}

.badge-PENDING {
    color: var(--status-pending);
}

.badge-STARTED {
    color: var(--status-started);
}

.badge-SUCCESS {
    color: var(--status-success);
}

.badge-FAILURE {
    color: var(--status-failure);
}

.badge-REVOKED {
    color: var(--status-revoked);
}

.badge-TIMEOUT {
    color: var(--status-timeout);
}

/* --- Jobs table ---------------------------------------------------------- */
.jobs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.jobs-table th {
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}

.jobs-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.jobs-table tr:hover td {
    background: #F7FAFC;
}

/* --- Action buttons in table rows ---------------------------------------- */
.btn-job-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
    /* Ghost style: invisible border */
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-job-action:hover {
    background: var(--bg-body);
    color: var(--primary-color);
}

.btn-job-action.view-results:hover {
    background: color-mix(in srgb, var(--status-success) 8%, white);
    color: var(--status-success);
}

.btn-job-action.cancel:hover {
    background: color-mix(in srgb, var(--status-failure) 8%, white);
    color: var(--status-failure);
}

.btn-job-action:disabled,
.btn-job-action[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Stat cards (shared across all pages) -------------------------------- */
.jobs-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.jobs-stat-card {
    flex: 1;
    min-width: 140px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.jobs-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.jobs-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* --- Toolbar ------------------------------------------------------------- */
.jobs-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.btn-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-toolbar:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.btn-toolbar.danger {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-toolbar.danger:hover {
    border-color: var(--status-failure);
    color: var(--status-failure);
    background: color-mix(in srgb, var(--status-failure) 8%, white);
}

/* --- Results table export scope radios ----------------------------------- */

/* Bootstrap's form-check defaults are 1rem and blue; these match the
   adjacent .btn-toolbar so the scope radios read as one control with it.
   Each label carries a native title tooltip, hence cursor: help. */
.jobs-toolbar-radios .form-check {
    margin-bottom: 0;
    min-height: auto;
}

/* Tighter than Bootstrap's 1rem so the pair reads as one control. */
.jobs-toolbar-radios .form-check-inline {
    margin-right: 0.75rem;
}

.jobs-toolbar-radios .form-check-inline:last-child {
    margin-right: 0;
}

.jobs-toolbar-radios .form-check-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: help;
}

/* The title lives on the label's inner span, so stretch it to fill the
   label — otherwise the tooltip only fires over the glyphs themselves. */
.jobs-toolbar-radios .form-check-label > span {
    display: inline-block;
    padding: 0.3rem 0;
}

.jobs-toolbar-radios .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.jobs-toolbar-radios .form-check-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--secondary-color) 25%, transparent);
}

/* --- Empty state --------------------------------------------------------- */
.jobs-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.jobs-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* --- Shared page wrapper ------------------------------------------------- */
.jobs-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Wider layout for the results detail page (AG Grid tables need room). */
.jobs-page-wide {
    max-width: 95%;
    margin: 0 auto;
    padding: 2rem 2rem;
}

/* --- My Tasks page header ------------------------------------------------- */
.jobs-page-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.jobs-page-header-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.jobs-page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* --- Back link ----------------------------------------------------------- */
.jobs-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

/* Shared section title (Job Details, Results) */
.jobs-section-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Status banner (active jobs) ----------------------------------------- */
.jobs-status-banner {
    background: color-mix(in srgb, var(--status-started) 12%, white);
    border: 1px solid color-mix(in srgb, var(--status-started) 35%, transparent);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.jobs-status-banner-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--status-started);
}

.jobs-status-banner-icon {
    font-size: 1.1rem;
}

.jobs-status-banner-hint {
    font-size: 0.8rem;
    color: var(--status-started);
    opacity: 0.75;
}

/* --- Error & log boxes --------------------------------------------------- */
.jobs-error-box {
    background: color-mix(in srgb, var(--status-failure) 12%, white);
    border: 1px solid color-mix(in srgb, var(--status-failure) 35%, transparent);
    border-radius: var(--radius-sm);
    padding: 1rem;
    color: var(--status-failure);
    font-size: 0.85rem;
    white-space: pre-wrap;
    font-family: monospace;
    margin-top: 1rem;
}

.jobs-log-box {
    background: #F7FAFC;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.8rem;
    white-space: pre-wrap;
    font-family: monospace;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
}

/* --- Divider ------------------------------------------------------------- */
.jobs-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* --- Badge icon ---------------------------------------------------------- */
.badge-status-icon {
    font-size: 0.7rem;
}

/* --- Table action cell --------------------------------------------------- */
.jobs-actions-cell {
    display: flex;
    gap: 0.5rem;
}

/* --- Input parameters section -------------------------------------------- */
.jobs-params-section {
    margin-bottom: 1.5rem;
}

.jobs-params-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.jobs-params-table tr:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.jobs-params-label {
    width: 160px;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: top;
    white-space: nowrap;
    background: var(--bg-body);
}

.jobs-params-value {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
    white-space: pre;
    overflow-x: auto;
    max-width: 0;
}

/*.jobs-params-value-long {*/
/*    padding: 0.6rem 1rem;*/
/*    font-family: monospace;*/
/*    font-size: 0.8rem;*/
/*    color: var(--text-primary);*/
/*    white-space: pre;*/
/*    overflow-x: auto;*/
/*    max-width: 0;*/
/*}*/

/*
    max-width: 100% with object-fit: contain and a max-height: 220px cap — 
    the image now fills the available table cell width instead of being squeezed into 400px. 
*/
.jobs-params-preview {
    display: block;
    max-width: 100%;
    max-height: 220px;
    width: auto;
    height: auto;
    border-radius: var(--radius-sm);
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 0.25rem;
    object-fit: contain;
}