/* VBT Analytics - Custom Styles */

/* Root Variables */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;

    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Navigation Enhancements */
.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: -0.025em;
}

.navbar-nav .nav-link {
    font-weight: 500;
    margin: 0 0.25rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar .dropdown-menu {
    border: none;
    box-shadow: var(--box-shadow-lg);
    border-radius: var(--border-radius);
}

/* Cards and Components */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all 0.2s ease-in-out;
}

.card.border-danger {
    border: 2px solid var(--bs-danger) !important;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(13, 110, 253, 0.25);
}

/* Form Elements */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
    transition: all 0.2s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.125rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Upload Form Styles */
.upload-item {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: var(--light-color);
    transition: all 0.2s ease-in-out;
}

.upload-item:hover {
    border-color: var(--primary-color);
}

.upload-item.active {
    border-color: var(--primary-color);
    border-style: solid;
    box-shadow: var(--box-shadow);
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.upload-number {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.875rem;
}

.remove-upload {
    color: var(--danger-color);
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.remove-upload:hover {
    color: #b02a37;
    transform: scale(1.1);
}

/* Video Grid and Cards */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.video-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.2s ease-in-out;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-lg);
}

.video-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumbnail .placeholder {
    color: var(--secondary-color);
    font-size: 3rem;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Filters and Search */
.filters-section {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

/* Video Player Styles */
.video-container {
    position: relative;
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

.video-player {
    width: 100%;
    height: auto;
    max-height: 70vh;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 1rem;
    color: white;
}

/* ML Results Visualization */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.kpi-card {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border-radius: var(--border-radius);
}

.kpi-card-danger {
    background: linear-gradient(135deg, #dc3545, #a71d2a);
}

.kpi-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.kpi-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rep-summary-table {
    font-size: 0.875rem;
}

.rep-summary-table th {
    background-color: var(--light-color);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
}

.rep-summary-table td {
    vertical-align: middle;
}

/* Charts and Images */
.ml-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1rem;
}

.image-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Admin Dashboard */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    text-align: center;
    padding: 2rem 1rem;
    border-left: 4px solid var(--primary-color);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--secondary-color);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
}

/* Loading and Progress */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow-lg);
}

.progress-custom {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

/* Pagination */
.pagination .page-link {
    border-radius: var(--border-radius);
    margin: 0 0.125rem;
    border: 1px solid #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .upload-item {
        padding: 1rem;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .navbar-nav {
        margin-top: 1rem;
    }

    .stat-card {
        padding: 1.5rem 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .upload-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

.border-dashed {
    border-style: dashed !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-in-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus States */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] {
    --primary-color: #6ea8fe;
    --light-color: #2b3035;
    --dark-color: #dee2e6;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
    --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] body {
    --primary-color: #6ea8fe;
    --light-color: #2b3035;
    --dark-color: #dee2e6;
}

[data-bs-theme="dark"] .kpi-card {
    background: linear-gradient(135deg, #375a8c, #1a3a5c);
}

[data-bs-theme="dark"] .kpi-card-danger {
    background: linear-gradient(135deg, #a71d2a, #6b1520);
}

[data-bs-theme="dark"] .upload-item {
    border-color: #495057;
    background-color: var(--light-color);
}

[data-bs-theme="dark"] .upload-item:hover {
    border-color: var(--primary-color);
    background-color: #1e2a38;
}

[data-bs-theme="dark"] .filters-section {
    background-color: var(--light-color);
}

[data-bs-theme="dark"] .loading-content {
    background-color: #212529;
}

[data-bs-theme="dark"] .image-title {
    color: var(--primary-color);
}

[data-bs-theme="dark"] .rep-summary-table th {
    background-color: var(--light-color);
    border-bottom-color: var(--primary-color);
}

[data-bs-theme="dark"] .video-thumbnail {
    background-color: #1a1d21;
}

[data-bs-theme="dark"] .stat-card {
    border-left-color: var(--primary-color);
}

[data-bs-theme="dark"] .stat-number {
    color: var(--primary-color);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    border-color: #495057;
}

[data-bs-theme="dark"] .upload-item.active {
    background-color: var(--bs-body-bg, #212529);
}

[data-bs-theme="dark"] .upload-header {
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .pagination .page-link {
    border-color: #495057;
}

[data-bs-theme="dark"] .bg-gradient-primary {
    background: linear-gradient(135deg, #375a8c, #1a3a5c);
}

[data-bs-theme="dark"] .clickable-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .video-container.loading::after {
    border-color: #495057;
    border-top-color: var(--primary-color);
}

/* Print Styles */
@media print {

    .navbar,
    .btn,
    .filters-section {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* Video Player Enhancements */
.video-container {
    position: relative;
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

.video-player {
    width: 100%;
    height: auto;
    max-height: 70vh;
    display: block;
}

.video-player:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.speed-control.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.video-feedback {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

/* Video loading states */
.video-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Responsive video controls */
@media (max-width: 768px) {
    .video-player {
        max-height: 50vh;
    }

    .btn-group-sm .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}


.clickable-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

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

/* Remove default link styling */
a.text-decoration-none:hover .clickable-card {
    color: inherit;
}

/* Trends Page */
.trends-chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

@media (max-width: 768px) {
    .trends-chart-container {
        height: 260px;
    }
}