/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background-color: #f8f9fa;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background-color: #f8f9fa;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    border-bottom: 1px solid #dee2e6;
    background-color: #fff;
    padding: 1rem;
    text-align: center;
}

.sidebar-header h5 {
    color: #4650dd;
    font-weight: 600;
    margin: 0;
    font-size: 1.25rem;
}

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

.sidebar .menu-button {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: #343a40;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar .menu-button i {
    width: 1.25rem;
    margin-right: 1rem;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar .menu-button:hover {
    background-color: rgba(70, 80, 221, 0.1);
    color: #4650dd;
    border-left-color: #4650dd;
}

.sidebar .menu-button.active {
    background-color: rgba(70, 80, 221, 0.15);
    color: #4650dd;
    border-left-color: #4650dd;
    font-weight: 600;
}

.sidebar .menu-button.active i {
    color: #4650dd;
}

/* Mobile Menu Button - CSS Hamburger Icon */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #4650dd;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.mobile-menu-toggle:hover {
    background: #343a40;
}

/* Hamburger Lines */
.hamburger-line {
    width: 20px;
    height: 2px;
    background-color: white;
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 1px;
}

/* Hamburger Animation (improved for X icon centering) */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* Content Area */
.content-area {
    margin-left: 250px;
    padding: 20px;
    min-height: 100vh;
    background-color: #fff;
    transition: margin-left 0.3s ease;
    width: calc(100% - 250px);
    overflow-x: hidden;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .content-area {
        margin-left: 0;
        padding-top: 60px;
        width: 100%;
    }

    .sidebar-header {
        padding-top: 60px;
    }

    .device-map {
        height: calc(100vh - 180px);
    }

    /* Ensure table responsiveness on mobile */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        min-width: 100%;
    }

    .table {
        min-width: 600px; /* Ensure table is wide enough to trigger scrolling */
    }
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Flash Messages */
.flash-message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 4px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.flash-message.success {
    border-left: 4px solid #35b653;
}

.flash-message.error {
    border-left: 4px solid #dc3545;
}

.flash-message.warning {
    border-left: 4px solid #ffc107;
}

.flash-message.info {
    border-left: 4px solid #17a2b8;
}

.top-nav {
    display: none;
}

/* Bubbly Table Overrides */
.card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.card-heading {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.card-body {
    padding: 1rem;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.5rem; /* Reduced padding to minimize row height */
    vertical-align: middle; /* Center content vertically */
    border-top: 1px solid #dee2e6;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.075);
}

/* Action Column Styles */
.action-col {
    min-width: 100px; /* Reduced from 150px to 100px */
    width: 100px; /* Fixed width for consistency */
}

/* Ensure forms in table cells are properly centered */
.action-col form {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    margin: 0;
    padding: 0; /* Remove any padding */
}

.action-col form button {
    margin: 0;
    padding: 0.25rem 0.5rem; /* Compact padding */
    font-size: 0.75rem; /* Slightly smaller font */
    white-space: nowrap; /* Prevent text wrapping */
}

.form-select-sm {
    max-width: 100px; /* Slightly reduced for better fit */
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.btn-run-ocr {
    background-color: #4650dd; /* Changed to a less aggressive color */
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem; /* Smaller font size */
    border-radius: 4px;
    border: none;
    transition: background-color 0.2s;
    min-width: 70px; /* Set minimum width for consistency */
}

.btn-run-ocr:hover {
    background-color: #343a40;
}

/* Home Page Styles */
.home-content-outer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.home-top-card {
    width: 100%;
}

.lab-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.lab-logo-container {
    margin-bottom: 1rem;
}

.lab-title {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.emphasized {
    color: #ff4136;
    font-weight: bold;
}

.display-4 {
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1.2;
    color: #333;
}

.lead {
    font-size: 1.25rem;
    font-weight: 300;
    color: #333;
}

.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-5px);
}

.card-heading {
    color: #333;
    margin: 0;
}

.card-body p {
    color: #333;
}

.card-row {
    display: flex;
    gap: 1.5rem;
}

.card-row > [class^='col-'] {
    flex: 1 1 0;
    padding-left: 0;
    padding-right: 0;
}

/* Device Map Styles */
.device-map-container {
    position: absolute;
    top: 0;
    left: 250px;
    right: 0;
    bottom: 0;
    background-color: #f8f9fa;
}

.device-map-header {
    padding: 1.5rem 2rem;
    background: white;
    border-bottom: 1px solid #dee2e6;
}

.device-map-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: #343a40;
}

.device-map-content {
    padding: 20px;
    height: calc(100% - 85px);
}

.device-map {
    width: 100%;
    height: calc(100vh - 150px);
    min-height: 400px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
}

.device-map iframe,
.device-map .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    border: none;
}

.content-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto; /* Changed to auto to support table scrolling */
}

.content-body {
    width: 100%;
    max-width: 100%;
    overflow-x: auto; /* Changed to auto to support table scrolling */
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}