/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.4;
    color: #333;
    background-color: #f8f9fa;
    font-size: 14px;
    padding-top: 40px;
    margin: 0;
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ===== BOOTSTRAP GRID SYSTEM ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

/* Bootstrap column classes */
.col-md-3,
.col-md-4,
.col-md-6,
.col-md-8,
.col-md-9,
.col-md-12 {
    padding: 0 15px;
}

/* ===== HEADER & NAVIGATION ===== */
.header {
    background: #132649;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Minimal Header - Very Small */
.header-minimal {
    background: #132649;
    color: white;
    padding: 0;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
    height: 40px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    margin: 0;
}

.navbar-brand-minimal {
    display: flex;
    align-items: center;
    height: 40px;
}

.brand-link {
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
    width: 250px;
    background: white;
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: fixed;
    left: 0;
    top: 40px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Custom scrollbar for sidebar (Chrome, Safari, Edge) */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile Toggle Button - Hidden by default, shown only on mobile */
.sidebar-toggle {
    display: none !important;
}

/* Show toggle button only on mobile devices */
@media (max-width: 767.98px) {
    .sidebar-toggle {
        display: block !important;
    }
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-item {
    border-bottom: 1px solid #eee;
}

.sidebar-link {
    display: block;
    padding: 1rem 1.5rem;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-link:hover {
    background-color: #f8f9fa;
    color: #132649;
    padding-left: 2rem;
}

.sidebar-link.active {
    background-color: #132649;
    color: white;
}

/* ===== SIDEBAR DROPDOWN STYLES ===== */
.sidebar-item.dropdown {
    position: relative;
}

.sidebar-link.dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.dropdown-icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    margin-left: auto;
}

.sidebar-item.dropdown.show .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    background-color: #f8f9fa;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    position: static;
    float: none;
    width: 100%;
    max-width: 100%;
    border-top: 1px solid #eee;
    display: none;
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    border-bottom: 1px solid #eee;
    padding: 0;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item .sidebar-link {
    padding: 0.75rem 1.5rem 0.75rem 3rem;
    font-size: 0.9rem;
    color: #666;
    background-color: transparent;
}

.dropdown-item .sidebar-link:hover {
    background-color: #e9ecef;
    color: #132649;
    padding-left: 3.5rem;
}

.dropdown-item .sidebar-link.active {
    background-color: #132649;
    color: white;
    padding-left: 3rem;
}

.dropdown-item .sidebar-link i {
    margin-right: 0.5rem;
    font-size: 0.8rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 250px;
    margin-top: 20px;
    
    min-height: calc(100vh - 40px);
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    background: #e9ebec;
    color: #333;
    padding: 0.75rem 1rem;
    font-weight: bold;
    font-size: 15px;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #132649;
    box-shadow: 0 0 0 3px rgba(19, 38, 73, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #132649;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(19, 38, 73, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th {
    background: #132649 !important;
    color: white !important;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

/* Ensure table headers are always visible */
#vialsTable th,
.vials-table th,
.table-bordered th,
.table-striped th,
.table-hover th {
    background: #132649 !important;
    color: white !important;
    border-color: #dee2e6 !important;
}

/* DataTables specific overrides */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
    color: #333 !important;
}

/* Force table header visibility */
table.dataTable thead th {
    background: #132649 !important;
    color: white !important;
    border-color: #dee2e6 !important;
}

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    background: #132649 !important;
    color: white !important;
}

/* Additional DataTables header styling */
.dataTables_wrapper .dataTable thead th,
.dataTables_wrapper .dataTable thead th.sorting,
.dataTables_wrapper .dataTable thead th.sorting_asc,
.dataTables_wrapper .dataTable thead th.sorting_desc {
    background: #132649 !important;
    color: white !important;
    border-color: #dee2e6 !important;
}

/* Ensure sorting icons are visible */
.dataTables_wrapper .dataTable thead th.sorting:after,
.dataTables_wrapper .dataTable thead th.sorting_asc:after,
.dataTables_wrapper .dataTable thead th.sorting_desc:after {
    color: white !important;
    opacity: 0.8;
}

.table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody tr:last-child td {
    border-bottom: none;
}





/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
}

.modal-header {
    background: #132649;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px 10px 0 0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    text-align: right;
}

.close {
    color: white;
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    opacity: 0.7;
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        top: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .navbar-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .table-container {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}

/* ===== LOADING SPINNER ===== */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #132649;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* ===== TOOLTIPS ===== */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ===== CARD HEADER STYLING - GLOBAL ===== */
.card-header {
    background-color: #e9ebec !important;
    border-bottom: 1px solid #dee2e6 !important;
    color: #333 !important;
    font-weight: 600 !important;
    padding: 1rem 1.25rem !important;
}

.card-header h5,
.card-header h6,
.card-header .card-title {
    color: #333 !important;
    margin: 0 !important;
    font-weight: 600 !important;
}

/* Page Header Styling */
.page-header {
    background-color: #e9ebec !important;
    border-radius: 0.375rem !important;
    padding: 1rem 1.25rem !important;
    margin-bottom: 1.5rem !important;
    border: 1px solid #dee2e6 !important;
}

.page-header h1,
.page-header h2,
.page-header h3 {
    color: #333 !important;
    margin: 0 !important;
    font-weight: 600 !important;
}

/* ===== COMPACT STYLING FOR DATA-HEAVY PAGES ===== */
.compact-mode {
    font-size: 13px;
    line-height: 1.3;
}

.compact-mode .card {
    margin-bottom: 0.75rem;
}

.compact-mode .card-header {
    padding: 0.5rem 0.75rem;
    font-size: 14px;
}

.compact-mode .card-body {
    padding: 0.75rem;
}

.compact-mode .table th,
.compact-mode .table td {
    padding: 0.375rem 0.5rem;
    font-size: 12px;
}

.compact-mode .btn {
    padding: 0.5rem 1rem;
    font-size: 13px;
}

.compact-mode .badge {
    font-size: 11px;
    padding: 0.25rem 0.5rem;
}

.compact-mode .progress {
    height: 6px;
}

/* Bootstrap handles grid classes - don't override them */

.compact-mode .mb-4 {
    margin-bottom: 1rem !important;
}

.compact-mode .mb-5 {
    margin-bottom: 1.25rem !important;
}

.compact-mode .py-4 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.compact-mode .py-5 {
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
}



/* Chart containers */
.compact-mode canvas {
    max-height: 200px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .compact-mode .table th,
    .compact-mode .table td {
        padding: 0.25rem 0.375rem;
        font-size: 11px;
    }
    
    .compact-mode .card-body {
        padding: 0.5rem;
    }
}
