/**
 * Industry Jobs CSS - Optimized for performance and usability
 */

/* Base Styles */
.job-item {
    transition: background-color 0.2s ease;
}

.job-item:hover {
    background-color: rgb(0 123 255 / 5%) !important;
}

/* Statistics Cards */
.stats-card {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 20px rgb(0 0 0 / 15%);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgb(0 0 0 / 25%);
}

.stats-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stats-content {
    flex: 1;
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bs-body-color);
    line-height: 1;
}

.stats-label {
    font-size: 0.875rem;
    color: var(--bs-body-color);
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Specific card colors */
.active-jobs .stats-icon {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.completed-jobs .stats-icon {
    background: linear-gradient(135deg, #17a2b8, #6610f2);
}

.manufacturing-jobs .stats-icon {
    background: linear-gradient(135deg, #fd7e14, #e83e8c);
}

.research-jobs .stats-icon {
    background: linear-gradient(135deg, #6f42c1, #e83e8c);
}

.copying-jobs .stats-icon {
    background: linear-gradient(135deg, #007bff, #6610f2);
}

.total-jobs .stats-icon {
    background: linear-gradient(135deg, #6c757d, #495057);
}

/* Filter Controls */
.job-filter-panel {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-xl, 1.25rem);
    padding: 1.75rem;
    box-shadow: 0 1.5rem 3rem rgb(15 23 42 / 12%);
}

.job-filter-panel__form .form-control,
.job-filter-panel__form .form-select {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius, 0.75rem);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.job-filter-panel__form .form-control:focus,
.job-filter-panel__form .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.job-filter-panel__form .form-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}

.job-filter-panel__actions {
    display: grid;
    align-items: stretch;
}

.job-filter-panel__actions .btn {
    height: 100%;
}

@media (max-width: 991.98px) {
    .job-filter-panel {
        padding: 1.25rem;
    }

    .job-filter-panel__actions {
        grid-column: span 2;
    }
}

/* Activity Badges */
.activity-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-1 { /* Manufacturing */
    background: linear-gradient(135deg, #fd7e14, #ff6b35);
    color: white;
}

.activity-3 { /* TE Research */
    background: linear-gradient(135deg, #6f42c1, #8e44ad);
    color: white;
}

.activity-4 { /* ME Research */
    background: linear-gradient(135deg, #e83e8c, #d63384);
    color: white;
}

.activity-5 { /* Copying */
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.activity-8 { /* Invention */
    background: linear-gradient(135deg, #28a745, #198754);
    color: white;
}

.activity-9 { /* Reverse Engineering */
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.activity-11 { /* Reactions */
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

/* Custom badge variants */
.badge-violet {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
}

.badge-blue {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}

.badge-green {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
}

.badge-orange {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
}

/* Custom badge variants */
.badge-violet {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
}

.badge-blue {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}

.badge-green {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
}

.badge-orange {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--bs-border-radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background-color: var(--bs-success);
    color: var(--bs-light);
}

.status-paused {
    background-color: var(--bs-warning);
    color: var(--bs-dark);
}

.status-ready {
    background-color: var(--bs-info);
    color: var(--bs-light);
}

.status-delivered {
    background-color: var(--bs-primary);
    color: var(--bs-light);
}

.status-cancelled {
    background-color: var(--bs-danger);
    color: var(--bs-light);
}

.status-reverted {
    background-color: var(--bs-dark);
    color: var(--bs-light);
}

/* Completed alias */
.status-completed {
    background-color: var(--bs-secondary);
    color: var(--bs-light);
}

/* Runs Badge styling */
.runs-badge {
    display: inline-block;
    background-color: var(--bs-info);
    color: var(--bs-light);
    border-radius: var(--bs-border-radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.75rem;
}

/* Progress Bars */
.progress {
    height: 1rem !important;
    background-color: var(--bs-border-color);
    border-radius: var(--bs-border-radius-pill, var(--bs-border-radius));
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
}

.job-progress .progress-bar,
.progress-bar {
    background-color: var(--bs-primary);
    color: var(--bs-light);
    transition: width 0.6s ease-in-out, background-color 0.3s ease;
    border-radius: inherit;
    font-size: 0.75rem;
    font-weight: 600;
}

.job-progress .progress-bar.bg-success {
    background: linear-gradient(90deg, #28a745, #20c997) !important;
}

.job-progress-bar {
    height: 14px;
    background: #e3e8ef;
    border-radius: 6px;
    overflow: hidden;
    width: 100%;
    margin-top: 2px;
    margin-bottom: 2px;
    position: relative;
}

html[data-theme="darkly"] .job-progress-bar {
    background: rgba(var(--bs-light-rgb), 0.15);
}

.job-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #34d399);
    transition: width 0.5s;
    position: absolute;
    left: 0; top: 0;
    z-index: 1;
}

.job-progress-label {
    position: relative;
    z-index: 2;
    text-align: center;
    font-size: 1em;
    font-weight: 700;
    color: var(--indy-text-primary, #222);
    line-height: 14px;
    pointer-events: none;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px #fff, 0 0 2px #e3e8ef;
}

html[data-theme="darkly"] .job-progress-wrapper {
    text-shadow: none;
}

.job-progress-percent {
    font-variant-numeric: tabular-nums;
    color: var(--bs-info, #1565c0);
    font-size: 1.1em;
    font-weight: 700;
    margin-right: 0.5em;
}

.job-progress-eta {
    font-variant-numeric: tabular-nums;
    color: var(--bs-success, #2e7d32);
    font-size: 1.1em;
    font-weight: 700;
    margin-left: 0.5em;
}

.job-progress-row {
    background: #f8fafc;
    border-bottom: 2px solid #e3e8ef;
}

html[data-theme="darkly"] .job-progress-row {
    background: rgba(var(--bs-light-rgb), 0.08);
    border-bottom-color: rgba(var(--bs-light-rgb), 0.12);
}

.job-progress-panel {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.gradient-progress {
    --progress-gradient-start: #2563eb;
    --progress-gradient-end: #7c3aed;
    --progress-label-color: var(--bs-progress-bar-color, var(--bs-light));
    --progress-track-border: rgba(148, 163, 184, 0.4);
    --progress-bar-glow: rgba(99, 102, 241, 0.38);

    position: relative;
    height: 1.1rem !important;
    background: linear-gradient(135deg, rgb(15 23 42 / 0.22), rgb(31 41 55 / 0.08));
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--progress-track-border);
    box-shadow: inset 0 1px 2px rgb(255 255 255 / 0.12);
}

.gradient-progress .progress-bar {
    background: linear-gradient(90deg, var(--progress-gradient-start), var(--progress-gradient-end));
    border-radius: inherit;
    box-shadow: 0 4px 18px var(--progress-bar-glow);
    position: relative;
}

.gradient-progress .progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgb(255 255 255 / 0.3), transparent 45%);
    mix-blend-mode: screen;
    opacity: 0.6;
}

.gradient-progress .progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--progress-label-color);
    text-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    pointer-events: none;
}

.progress-state-early {
    --progress-gradient-start: #f97316;
    --progress-gradient-end: #facc15;
    --progress-label-color: var(--bs-emphasis-color, #212529);
    --progress-bar-glow: rgba(249, 115, 22, 0.45);
}

.progress-state-mid {
    --progress-gradient-start: #38bdf8;
    --progress-gradient-end: #6366f1;
    --progress-label-color: var(--bs-progress-bar-color, var(--bs-light));
    --progress-bar-glow: rgba(99, 102, 241, 0.45);
}

.progress-state-late {
    --progress-gradient-start: #0ea5e9;
    --progress-gradient-end: #22c55e;
    --progress-label-color: var(--bs-progress-bar-color, var(--bs-light));
    --progress-bar-glow: rgba(34, 197, 94, 0.45);
}

.progress-state-complete {
    --progress-gradient-start: #16a34a;
    --progress-gradient-end: #22c55e;
    --progress-label-color: var(--bs-progress-bar-color, var(--bs-light));
    --progress-bar-glow: rgba(22, 163, 74, 0.5);
}

.progress-state-idle {
    --progress-gradient-start: #94a3b8;
    --progress-gradient-end: #cbd5f5;
    --progress-label-color: var(--bs-emphasis-color, #212529);
    --progress-bar-glow: rgba(148, 163, 184, 0.4);
    --progress-track-border: rgba(148, 163, 184, 0.45);
}

.progress-state-complete .progress-bar {
    animation: progress-finish-pulse 2.4s ease-in-out infinite;
}

@keyframes progress-finish-pulse {
    0%, 100% {
        box-shadow: 0 4px 18px var(--progress-bar-glow);
    }
    50% {
        box-shadow: 0 6px 24px rgba(34, 197, 94, 0.55);
    }
}

/* Item Info */
.item-info strong {
    color: var(--indy-text-primary, #2c3e50);
    font-weight: 600;
}

html[data-theme="darkly"] .item-info strong {
    color: #f8f9fa;
}

.item-info small {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-controls button {
    border-radius: 8px;
    transition: all 0.2s ease;
}

.pagination-controls button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgb(0 0 0 / 18%);
}

.pagination-controls button:disabled {
    opacity: 50%;
    cursor: not-allowed;
}

/* Export Button */
.export-button {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    color: white;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.export-button:hover {
    background: linear-gradient(135deg, #20c997, #28a745);
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgb(0 0 0 / 18%);
    color: white;
}

/* Table Enhancements */
.table thead th {
    background: linear-gradient(135deg, #343a40, #495057);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.875rem;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: #e9ecef;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgb(0 123 255 / 2%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .stats-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .stats-number {
        font-size: 1.5rem;
    }

    .filter-controls .row {
        gap: 0.5rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .activity-badge,
    .status-badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 991px) {
    .table-responsive {
        font-size: 0.92em;
    }
    .job-progress-bar {
        min-width: 60px;
        max-width: 100%;
    }
    .job-progress-label {
        font-size: 0.85em;
        padding: 0 2px;
    }
    .table thead th, .table tbody td {
        padding: 0.4rem 0.2rem;
        font-size: 0.92em;
    }
    .d-flex.gap-2, .d-flex.gap-3 {
        gap: 0.3rem !important;
    }
    .d-flex.align-items-center.gap-2.flex-nowrap {
        flex-wrap: wrap !important;
        gap: 0.2rem !important;
    }
    .job-progress-bar {
        margin-top: 0.15em;
        margin-bottom: 0.15em;
    }
    .activity-badge, .status-badge {
        font-size: 0.7em;
        padding: 0.2em 0.5em;
    }
}
@media (max-width: 700px) {
    .table-responsive {
        font-size: 0.80em;
    }
    .job-progress-bar {
        min-width: 40px;
        max-width: 100%;
    }
    .job-progress-label {
        font-size: 0.75em;
        padding: 0 1px;
    }
    .table thead th, .table tbody td {
        padding: 0.25rem 0.08rem;
        font-size: 0.78em;
    }
    .d-flex.align-items-center.gap-2.flex-nowrap {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    .job-progress-bar {
        margin-top: 0.1em;
        margin-bottom: 0.1em;
    }
}
@media (max-width: 500px) {
    .table-responsive {
        font-size: 0.70em;
    }
    .job-progress-bar {
        min-width: 20px;
        max-width: 100%;
    }
    .job-progress-label {
        font-size: 0.65em;
        padding: 0 0.5px;
    }
    .table thead th, .table tbody td {
        padding: 0.12rem 0.04rem;
        font-size: 0.65em;
    }
    .activity-badge, .status-badge {
        font-size: 0.6em;
        padding: 0.12em 0.3em;
    }
}

/* Loading States */
.loading {
    opacity: 60%;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Performance Optimizations */
.job-item,
.stats-card,
.filter-controls {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stats-card {
        border: 2px solid #000;
    }

    .activity-badge,
    .status-badge {
        border: 1px solid rgb(255 255 255 / 30%);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .stats-card,
    .job-item,
    .export-button,
    .pagination-controls button {
        transition: none;
    }

    .stats-card:hover,
    .export-button:hover,
    .pagination-controls button:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .filter-controls,
    .pagination-controls,
    .export-button {
        display: none !important;
    }

    .stats-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .table {
        font-size: 0.75rem;
    }

    .activity-badge,
    .status-badge {
        background: #f8f9fa !important;
        color: var(--bs-dark);
        border: 1px solid var(--bs-dark);
    }

    html[data-theme="darkly"] .activity-badge,
    html[data-theme="darkly"] .status-badge {
        background: rgba(var(--bs-body-bg-rgb), 0.88) !important;
        color: var(--bs-body-color);
        border-color: rgba(var(--bs-light-rgb), 0.2);
    }
}

html[data-theme="darkly"] .activity-badge,
html[data-theme="darkly"] .status-badge {
    background: #343a40 !important;
    color: #fff;
    border: 1px solid #495057;
}

/* Bootstrap utility classes overrides */
html[data-theme="darkly"] .bg-body-tertiary,
html[data-theme="darkly"] .bg-body-secondary,
html[data-theme="darkly"] .bg-light,
html[data-theme="darkly"] .bg-white {
    background-color: #303030 !important;
}

html[data-theme="darkly"] .badge.bg-light.text-dark,
html[data-theme="darkly"] .badge.bg-light.text-dark.border {
    background-color: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

html[data-theme="darkly"] [class*="subtle"] {
    background-color: #303030 !important;
}
