/* TrackSense - Custom Styles */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --purple-color: #6f42c1;
    --teal-color: #20c997;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --bs-body-bg: #1a1d20;
    --bs-body-color: #e4e6eb;
    --bs-card-bg: #242526;
    --bs-border-color: #3a3b3c;
}

[data-theme="dark"] body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

[data-theme="dark"] .card {
    background-color: var(--bs-card-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-theme="dark"] .table {
    --bs-table-bg: #242526;
    --bs-table-color: #e4e6eb;
    --bs-table-striped-bg: #2a2d2e;
    --bs-table-hover-bg: #323436;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #3a3b3c;
    border-color: #4a4b4c;
    color: #e4e6eb;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #3a3b3c;
    border-color: #6c757d;
    color: #e4e6eb;
}

[data-theme="dark"] .modal-content {
    background-color: var(--bs-card-bg);
    color: var(--bs-body-color);
}

[data-theme="dark"] .navbar {
    background-color: #242526 !important;
    border-bottom: 1px solid var(--bs-border-color);
}

[data-theme="dark"] .sidebar {
    background-color: #242526;
    border-right: 1px solid var(--bs-border-color);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: #fff;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-header h5 {
    display: none;
}

.sidebar.collapsed .nav-link {
    text-align: center;
    padding: 1rem 0.5rem;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.sidebar .nav-link {
    color: #495057;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin: 0.25rem 0.5rem;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 0.5rem;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: calc(100vh - 56px);
    transition: margin-left 0.3s;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    .sidebar {
        left: -100%;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.expanded {
        margin-left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.action-btns .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Quick Action Mobile */
@media (max-width: 768px) {
    .action-btns .btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }
}

/* Cards */
.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

/* Tables */
.table-responsive {
    border-radius: 0.25rem;
}

.table thead th {
    border-top: none;
    background-color: #f8f9fa;
    font-weight: 600;
}

[data-theme="dark"] .table thead th {
    background-color: #2a2d2e;
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Print Templates */
.print-template {
    background: #fff;
    color: #000;
}

.print-a4 {
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
    margin: 0 auto;
}

.print-problem-report {
    width: 7.69in;
    height: 8in;
    padding: 0.5in;
}

.print-label-4x6 {
    width: 4in;
    height: 6in;
    padding: 0.25in;
}

@page {
    margin: 0;
}

/* Badge Enhancements */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Theme Toggle Button */
.theme-toggle {
    cursor: pointer;
    transition: transform 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Utilities */
.cursor-pointer {
    cursor: pointer;
}

.min-vh-100 {
    min-height: 100vh;
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* Form Enhancements */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.required::after {
    content: " *";
    color: var(--danger-color);
}

/* Modal Enhancements */
.modal-header {
    background-color: var(--primary-color);
    color: #fff;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* WhatsApp Button */
.btn-whatsapp {
    background-color: #25D366;
    color: #fff;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
    color: #fff;
}

/* Status Timeline */
.status-timeline {
    position: relative;
    padding-left: 2rem;
}

.status-timeline::before {
    content: "";
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #dee2e6;
}

.status-timeline-item {
    position: relative;
    padding: 0.5rem 0;
}

.status-timeline-item::before {
    content: "";
    position: absolute;
    left: -1.4rem;
    top: 1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 2px solid #fff;
}

/* Navbar */
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

/* Import/Export buttons */
.import-export-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .import-export-btns {
        flex-direction: column;
    }
    
    .import-export-btns .btn {
        width: 100%;
    }
}

/* Custom Border Colors */
.border-purple {
    border-left-color: var(--purple-color) !important;
}

.border-teal {
    border-left-color: var(--teal-color) !important;
}

.text-purple {
    color: var(--purple-color) !important;
}

.text-teal {
    color: var(--teal-color) !important;
}
