/* =================================== */
/* JOB CARDS STYLES */
/* =================================== */

.jobs-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
    width: 100%;
    min-height: 100px; /* Ensure some height even when empty */
}

/* Fallback for browsers that don't support grid */
@supports not (display: grid) {
    .jobs-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .job-card {
        flex: 0 0 350px;
        margin: 0 1.25rem 1.25rem 0;
    }
}

/* Ensure jobs view is properly displayed */
.jobs-view {
    width: 100%;
    display: block;
}

/* Default view states - allow JavaScript to override */
.jobs-view#jobsCardView {
    display: block;
}

.jobs-view#jobsTableView {
    display: none;
}

.job-card {
    background-color: rgb(var(--card));
    color: rgb(var(--card-foreground));
    border: 1px solid rgb(var(--border));
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.job-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.job-card.paused {
    opacity: 0.7;
    background-color: rgb(var(--muted));
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    flex: 1;
}

.job-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
    color: rgb(var(--foreground));
}

.job-description {
    color: rgb(var(--muted-foreground));
    font-size: 14px;
}

.job-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

/* Ensure Bootstrap badges work properly in job cards */
.job-card .badge {
    font-size: 0.75em;
    padding: 0.35em 0.65em;
    border-radius: 0.375rem;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
}

/* A job card deliberately restyles Bootstrap's badges as quiet metadata chips
   — trigger, priority, schedule — rather than the brand-coloured pills they
   are elsewhere. That means overriding the fill AND the ink, and both need
   `!important`: the app-wide `.badge.bg-*` rules in 00-base.css carry it, and
   an important declaration beats a more specific one that lacks it.
   Overriding only the fill is what happened before, and it left every chip
   wearing an ink chosen for a solid brand fill that this card never paints. */
.job-card .badge.bg-primary {
    color: rgb(var(--foreground)) !important;
    background-color: rgb(var(--muted) / 0.7) !important;
}

.job-card .badge.bg-secondary {
    color: rgb(var(--muted-foreground)) !important;
    background-color: rgb(var(--muted) / 0.5) !important;
}

.job-card .badge.bg-success {
    color: rgb(var(--tint-green-ink)) !important;
    background-color: rgb(var(--tint-green) / 0.15) !important;
}

.job-card .badge.bg-info {
    color: rgb(var(--muted-foreground)) !important;
    background-color: rgb(var(--muted) / 0.5) !important;
}

.job-card .badge.bg-warning {
    color: rgb(var(--tint-amber-ink)) !important;
    background-color: rgb(var(--tint-amber) / 0.18) !important;
}

.job-card .badge.bg-danger {
    color: rgb(var(--tint-red-ink)) !important;
    background-color: rgb(var(--tint-red) / 0.15) !important;
}

.job-type-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 20px;
    color: rgb(var(--muted-foreground));
}

.job-schedule {
    background-color: rgb(var(--muted));
    color: rgb(var(--foreground));
    padding: 6px 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.job-schedule span {
    flex: 1;
}

.job-schedule small {
    color: rgb(var(--muted-foreground));
    white-space: nowrap;
}

.job-stats {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid rgb(var(--border));
    border-bottom: 1px solid rgb(var(--border));
    margin-bottom: 15px;
}

.job-stats .stat-item {
    text-align: center;
}

.job-stats .stat-item .value {
    font-weight: bold;
    font-size: 16px;
    color: rgb(var(--foreground));
}

.job-stats .stat-item .label {
    font-size: 11px;
    color: rgb(var(--muted-foreground));
    text-transform: uppercase;
}

.jobs-header .flex-1-center {
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.jobs-page .form-select {
    width: auto;
}

.jobs-page .input-group {
    width: auto;
    min-width: 180px;
}

/* Ensure Bootstrap buttons work properly in job cards */
.job-card .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    border: 1px solid transparent;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    line-height: 1.5;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Bootstrap's own green, pasted in with a white label. Fixed on both themes,
   and the app has a token pair for exactly this shape. */
.job-card .btn-success {
    color: rgb(var(--success-foreground));
    background-color: rgb(var(--success));
    border-color: rgb(var(--success));
}

.job-card .btn-success:hover {
    color: rgb(var(--success-foreground));
    background-color: rgb(var(--success) / 0.85);
    border-color: rgb(var(--success) / 0.85);
}

/* The three `.job-card .btn-outline-*` blocks that were here are GONE.
   They were verbatim copies of raw Bootstrap's literals — #0d6efd, #ffc107,
   #0dcaf0 — written when this card needed them because nothing overrode the
   family app-wide. v2.57.96 does override it, correctly and per theme, so
   these copies were no longer additions: they were a more specific rule
   reinstating the bug directly on top of the fix. Deleting them is what makes
   the card inherit it. */

/* Job modal configurations */
.type-config {
    background-color: rgb(var(--muted));
    color: rgb(var(--foreground));
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.schedule-config {
    background-color: rgb(var(--muted));
    color: rgb(var(--foreground));
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* Empty state styling */
.empty-state {
    background-color: rgb(var(--card));
    color: rgb(var(--card-foreground));
    border: 1px solid rgb(var(--border));
    border-radius: 8px;
    padding: 3rem 2rem;
    margin-top: 2rem;
}

.empty-state .fa-3x {
    color: rgb(var(--muted-foreground));
}

.empty-state h5 {
    color: rgb(var(--foreground));
    margin-bottom: 1rem;
}

.empty-state .text-muted {
    color: rgb(var(--muted-foreground)) !important;
}

/* Mobile responsive job cards */
@media (max-width: 768px) {
    .jobs-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 0 0.5rem;
        margin-top: 1rem;
    }
    
    .job-card {
        min-width: 0;
        width: 100%;
    }
    
    .jobs-page {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .jobs-grid {
        gap: 0.75rem;
        padding: 0;
    }
    
    .job-card {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .jobs-page {
        padding: 0.5rem;
    }
}
