/* Global Styles */
body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

h1,
h4,
h5 {
    color: #444;
}

ol,
ul {
    padding-left: 1em;
    margin: 0;
}

/* Navigation & Header */
.header-container {
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center;
    padding-left: 5px;
    padding-right: 5px;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
}

.header-top-row h1 {
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
}

.header-actions {
    margin-left: auto; /* Pushes to the right if not absolute, but here we use flex/absolute mix */
    margin-bottom: 0;
}

.tab-pane {
    padding: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tab-pane-videos {
    margin-bottom: 240px;
}

.tab-pane-yt {
    margin-bottom: 80px;
}

/* Forms & Inputs */
.form-container {
    background-color: #f1f1f1;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #e3e3e3;
}

.form-group-box {
    background-color: #e9ecef;
    padding: 5px;
    margin: 5px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    display: inline-block;
    vertical-align: top;
    min-width: 200px;
}

.form-group-box h5 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control-custom {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Footer / Bottom Bar */
.footer-new-job {
    background-color: #e9ecef;
    border-top: 1px solid #dee2e6;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1030;
}

.footer-new-job h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

.footer-new-job form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
}

.footer-new-job .form-group-box {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.footer-new-job h5 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
}

.footer-new-job .btn-primary {
    align-self: center;
    height: 40px;
    padding: 0 30px;
}

/* Loaders */
.loader-container {
    margin: 20px auto;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Status Chips */
.status-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.1px;
    background: #eef2f7;
    color: #344054;
    width: fit-content;
}

.status-chip .fas {
    font-size: 10px;
}

.status-subtext {
    font-size: 11px;
    color: #6c757d;
    line-height: 1.35;
}
.status-action {
    color: #0d6efd;
    text-decoration: underline;
    cursor: pointer;
}
.status-action:hover {
    color: #0b5ed7;
}

.statusQueued {
    background: #eef1f7;
    color: #6c757d;
}
.statusFinished {
    background: #e8f6ed;
    color: #1f7a34;
}
.statusTraining {
    background: #f1e8ff;
    color: #6f42c1;
}
.statusProcessing {
    background: #e6f0ff;
    color: #0a58ca;
}
.statusNotReady {
    background: #fdeaea;
    color: #c53030;
}
.statusNegativeViewcounts {
    background: #fff4e5;
    color: #d66a00;
}
.statusXDownloading {
    background: #eef0f4;
    color: #495057;
}
.statusWaitingForDownload {
    background: #e3f2fd;
    color: #0d47a1;
}
.statusErrorTrain {
    background: #fdeaea;
    color: #c53030;
}
.statusIsCreatingTSV {
    background: #fff0f6;
    color: #c2255c;
}
.statusWarning {
    background: #fff8e1;
    color: #b58900;
}

/* Jobs & DataTables Styling */
table.dataTable tbody td {
    vertical-align: middle;
}

.job-name a {
    font-weight: normal;
    color: #0d6efd;
    text-decoration: none;
    word-break: break-word;
}
.job-name a:hover {
    text-decoration: underline;
}

.batches-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.batch-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    font-size: 13px;
    line-height: 1.3;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.batch-chip-warning {
    background: #fff5f5;
    border-color: #feb2b2;
    color: #c53030;
}

.batch-chip a {
    color: #0d6efd;
    font-weight: 600;
}

.batch-chip .chip-meta {
    color: #6c757d;
    font-weight: 600;
}

.batch-separator {
    display: block;
    width: 100%;
    height: 1px;
    margin: 4px 0 8px 0;
    background: linear-gradient(to right, transparent 0%, #e6e9ed 15%, #e6e9ed 85%, transparent 100%);
}

.chip-muted {
    background: #f8f9fa;
    color: #6c757d;
}

.chip-action {
    background: #e8f1ff;
    border-color: #c9ddff;
}

.chip-action-subtle {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
}

.chip-action-subtle a {
    color: #6c757d;
    font-weight: normal;
}

.createYoloBatch.loading {
    color: #0a58ca !important;
    background: rgba(13, 110, 253, 0.08);
}

.batch-upload-form {
    display: none;
    margin-top: 6px;
    background: #f8f9fa;
    padding: 6px;
    border-radius: 6px;
    border: 1px dashed #cfd3d8;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    width: fit-content;
}
.pill a {
    color: inherit;
}
.pill-success {
    background: #e8f6ed;
    color: #1f7a34;
}
.pill-muted {
    background: #f1f3f5;
    color: #6c757d;
}
.pill-link {
    background: #eef2f7;
    color: #0d6efd;
    border: 1px solid #d8deeb;
}
.meta-muted {
    font-size: 11px;
    color: #6c757d;
    margin-top: 2px;
}

.progress-card {
    min-width: 160px;
}

.progress-compact {
    margin-bottom: 4px;
    height: 18px;
    background-color: #e9ecef;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.progress-compact .progress-bar {
    line-height: 16px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
}

.progress-meta {
    font-size: 11px;
    color: #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.prio-select {
    width: 100%;
    min-width: 110px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    background: #fff;
}

.toggle-checkbox {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.toggle-checkbox input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ced4da;
    transition: 0.2s;
    border-radius: 999px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox input:checked + .toggle-slider {
    background-color: #28a745;
}

.toggle-checkbox input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.toggle-checkbox input:disabled + .toggle-slider {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.control-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.control-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.control-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.control-dropdown .control-btn {
    width: 100%;
    justify-content: center;
}

.control-stack .dropdown-menu > li > a {
    padding: 6px 12px;
}

.voice-pill {
    min-width: 180px;
}
/* Utility Classes */
.hidden {
    display: none;
}
.text-center {
    text-align: center;
}
.mt-2 {
    margin-top: 0.5rem;
}
.mb-2 {
    margin-bottom: 0.5rem;
}
.mr-2 {
    margin-right: 0.5rem;
}
.ml-2 {
    margin-left: 0.5rem;
}


.error-container {
    margin: 0 auto;
    width: 100px;
    height: 100px;
    display: none;
    text-align: center;
}

.loader-container {
    margin: 0 auto;
    width: 100px;
    height: 100px;
}

/* NProgress Overrides */
#nprogress .spinner {
    z-index: 1000000;
}
#nprogress .bar {
    z-index: 1000000;
    height: 5px;
}

/* Modal Backdrop */
.modal-backdrop.in {
    opacity: 0.7;
}


/* Table Enhancements */
table.dataTable {
    border-collapse: collapse !important;
}
table.dataTable thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.unselectable-label {
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -o-user-select: none;
    user-select: none;
}

.form-margin-bottom {
    margin-bottom: 8px;
}

.status-message-container {
    display: none;
}


.upload-container {
    padding-left: 17px;
    background-color: #bbbb;
}

/* Force left alignment for all DataTables content */
table.dataTable thead th,
table.dataTable thead td,
table.dataTable tbody th,
table.dataTable tbody td {
    text-align: left !important;
}

/* Jobs Toolbar */
.jobs-toolbar {
    display: flex;
    align-items: center;
    padding: 5px;
}

.jobs-filter {
    margin-right: auto;
}

.jobs-status {
    margin-right: 20px;
    background-color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
}

.status-label {
    margin-right: 8px;
    color: #666;
    font-weight: 600;
}

.status-badge {
    font-size: 90%;
    margin-left: 4px;
    padding: 0.4em 0.6em;
    display: inline-flex;
    align-items: center;
}

.status-badge i {
    margin-right: 4px;
}

.jobs-search input {
    display: inline-block;
    width: auto;
    margin-left: 5px;
}

/* Hide default DataTables search for jobs table */
#jobs_filter {
    display: none;
}

/* Jobs Actions */
.jobs-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.jobs-actions button {
    margin-right: 10px;
}

/* Video Tab Toolbar */
.video-toolbar-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 5px;
}

.video-toolbar-top .dataTables_length,
.video-toolbar-top .dataTables_filter {
    float: none !important;
    margin: 0;
}

#video-date-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

/* Select2 Customization */
.select2-container .select2-selection--single {
    height: 34px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 32px;
}

.tooltip-inner {
    max-width: 500px;
    text-align: left;
    white-space: pre-wrap;
}

.popover {
    max-width: 550px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #ddd;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.popover-title {
    background: #f8f9fa;
    color: #444;
    font-weight: 600;
    border-radius: 3px 3px 0 0;
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid #e9ecef;
}

.popover-content {
    font-size: 12px;
    line-height: 1.5;
    padding: 10px 14px;
    color: #333;
    background: #fff;
}

.popover-content .worker-line {
    padding: 6px 8px;
    margin: 2px 0;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.popover-content .worker-name {
    font-weight: 600;
    color: #444;
}

.popover-content .worker-job {
    color: #0d6efd;
    word-break: break-all;
}

.popover-content .worker-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
    font-weight: 600;
}

.popover-content .status-finished {
    background: #e8f6ed;
    color: #1f7a34;
}

.popover-content .status-processing {
    background: #e6f0ff;
    color: #0a58ca;
}

.popover-content .status-initializing {
    background: #eef1f7;
    color: #6c757d;
}

.popover-content .worker-progress {
    font-size: 11px;
    color: #6c757d;
    margin-left: 4px;
}

.popover-content .empty-message {
    color: #6c757d;
    font-style: italic;
    padding: 8px;
    text-align: center;
}

/* Job Details Styles */
.loading {
    position: fixed;
    z-index: 999;
    height: 2em;
    width: 2em;
    overflow: visible;
    margin: auto;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

.loading:before {
    content: "";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
}

.loading:not(:required) {
    font: 0/0 a;
    color: transparent;
    text-shadow: none;
    background-color: transparent;
    border: 0;
}

.loading:not(:required):after {
    content: "";
    display: block;
    font-size: 10px;
    width: 1em;
    height: 1em;
    margin-top: -0.5em;
    -webkit-animation: spinner 1500ms infinite linear;
    -moz-animation: spinner 1500ms infinite linear;
    -ms-animation: spinner 1500ms infinite linear;
    -o-animation: spinner 1500ms infinite linear;
    animation: spinner 1500ms infinite linear;
    border-radius: 0.5em;
    -webkit-box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0,
        rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0,
        rgba(0, 0, 0, 0.75) 0 1.5em 0 0,
        rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0,
        rgba(0, 0, 0, 0.5) -1.5em 0 0 0,
        rgba(0, 0, 0, 0.5) -1.1em -1.1em 0 0,
        rgba(0, 0, 0, 0.75) 0 -1.5em 0 0,
        rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
    box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0,
        rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0,
        rgba(0, 0, 0, 0.75) 0 1.5em 0 0,
        rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0,
        rgba(0, 0, 0, 0.75) -1.5em 0 0 0,
        rgba(0, 0, 0, 0.75) -1.1em -1.1em 0 0,
        rgba(0, 0, 0, 0.75) 0 -1.5em 0 0,
        rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
}

#output {
    border: dotted black 1px;
    overflow-y: scroll;
}

.mfp-no-margins img.mfp-img {
    padding: 0;
}

.mfp-no-margins .mfp-figure:after {
    top: 0;
    bottom: 0;
}

.mfp-no-margins .mfp-container {
    padding: 0;
}

.break-all {
    word-break: break-all;
}

.break-word {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Floating Video Player */
#videoFloatingContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 480px;
    height: auto !important; /* Force container to wrap video height */
    z-index: 9999;
    background: #000;
    border: 1px solid #444;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border-radius: 4px;
    overflow: hidden;
}

#videoFloatingContainer video {
    display: block;
    width: 100%;
    height: auto;
}

.video-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 5px 10px;
    cursor: move;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-handle i {
    margin-right: 5px;
}

/* Minimized State */
#videoFloatingContainer.minimized {
    width: 250px !important;
    height: auto !important;
}

#videoFloatingContainer.minimized video {
    display: none;
}

#videoFloatingContainer.minimized .video-handle {
    position: relative;
    background: #333;
}
