/* Warehouse Management System - Custom Styles */

/* Variables */
:root {
    --primary-color: #0d6efd;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --navbar-height: 56px;
}

/* Body */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

body[data-bs-theme="dark"] {
    background-color: #1a1a2e;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

body[data-bs-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #16213e 0%, #0f0f23 100%);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-brand span {
    display: none;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    border-radius: 8px;
    margin: 4px 8px;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 20px;
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Cards */
.card {
    border-radius: 12px;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card.warning {
    border-left-color: #ffc107;
}

.stat-card.success {
    border-left-color: #28a745;
}

.stat-card.danger {
    border-left-color: #dc3545;
}

.stat-card.info {
    border-left-color: #17a2b8;
}

/* Tables */
.table {
    vertical-align: middle;
}

.table th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom-width: 1px;
}

body[data-bs-theme="dark"] .table th {
    color: #adb5bd;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-group-sm > .btn {
    border-radius: 6px;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
    border-radius: 6px;
}

/* Navbar */
.navbar {
    z-index: 1100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #2d2d2d;
}

body[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #555;
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
}

/* Quick Actions Panel */
.quick-actions .btn {
    padding: 1rem;
    text-align: center;
}

.quick-actions .btn i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Status Badges */
.status-active {
    background-color: #28a745;
}

.status-pending {
    background-color: #ffc107;
    color: #212529;
}

.status-inactive {
    background-color: #dc3545;
}

/* Print Styles */
@media print {
    .sidebar, .navbar, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}

/* Responsive Styles */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stock Level Indicators */
.stock-level {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.stock-level.critical {
    background-color: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.stock-level.low {
    background-color: rgba(255, 193, 7, 0.2);
    color: #856404;
}

.stock-level.normal {
    background-color: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

/* Location Tag */
.location-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background-color: #e9ecef;
    border-radius: 20px;
    font-size: 0.875rem;
}

body[data-bs-theme="dark"] .location-tag {
    background-color: #374151;
}

.location-tag i {
    margin-right: 0.375rem;
}

/* Quantity Selector */
.quantity-selector {
    display: flex;
    align-items: center;
}

.quantity-selector .btn {
    padding: 0.375rem 0.75rem;
}

.quantity-selector input {
    width: 80px;
    text-align: center;
    margin: 0 0.25rem;
}

/* ============================================
   DARK THEME FIXES
   ============================================ */

/* Cards in dark mode */
body[data-bs-theme="dark"] .card {
    background-color: #1e293b;
    border-color: #334155;
}

body[data-bs-theme="dark"] .card-header {
    background-color: #334155 !important;
    border-color: #475569;
}

body[data-bs-theme="dark"] .card-header.bg-light {
    background-color: #334155 !important;
}

/* Tables in dark mode */
body[data-bs-theme="dark"] .table {
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

body[data-bs-theme="dark"] .table thead {
    border-color: #475569;
}

body[data-bs-theme="dark"] .table td,
body[data-bs-theme="dark"] .table th {
    border-color: #334155;
}

/* Forms in dark mode */
body[data-bs-theme="dark"] .form-control,
body[data-bs-theme="dark"] .form-select {
    background-color: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .form-control:focus,
body[data-bs-theme="dark"] .form-select:focus {
    background-color: #1e293b;
    border-color: #0d6efd;
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .form-control::placeholder {
    color: #94a3b8;
}

body[data-bs-theme="dark"] .form-label {
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .form-check-label {
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .input-group-text {
    background-color: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

/* Dropdown menus in dark mode */
body[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color: #475569;
}

body[data-bs-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .dropdown-item:hover,
body[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: #334155;
    color: #fff;
}

body[data-bs-theme="dark"] .dropdown-divider {
    border-color: #475569;
}

/* Modal in dark mode */
body[data-bs-theme="dark"] .modal-content {
    background-color: #1e293b;
    border-color: #475569;
}

body[data-bs-theme="dark"] .modal-header {
    border-color: #475569;
}

body[data-bs-theme="dark"] .modal-footer {
    border-color: #475569;
}

/* Buttons in dark mode */
body[data-bs-theme="dark"] .btn-outline-secondary {
    color: #94a3b8;
    border-color: #475569;
}

body[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #334155;
    border-color: #475569;
    color: #fff;
}

body[data-bs-theme="dark"] .btn-outline-primary {
    color: #60a5fa;
    border-color: #3b82f6;
}

body[data-bs-theme="dark"] .btn-outline-info {
    color: #38bdf8;
    border-color: #0ea5e9;
}

body[data-bs-theme="dark"] .btn-outline-success {
    color: #4ade80;
    border-color: #22c55e;
}

body[data-bs-theme="dark"] .btn-outline-warning {
    color: #fbbf24;
    border-color: #f59e0b;
}

body[data-bs-theme="dark"] .btn-outline-danger {
    color: #f87171;
    border-color: #ef4444;
}

/* Links in dark mode */
body[data-bs-theme="dark"] a {
    color: #60a5fa;
}

body[data-bs-theme="dark"] a:hover {
    color: #93c5fd;
}

body[data-bs-theme="dark"] .text-primary {
    color: #60a5fa !important;
}

/* Text colors in dark mode */
body[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

body[data-bs-theme="dark"] .text-body-secondary {
    color: #94a3b8 !important;
}

/* Code in dark mode */
body[data-bs-theme="dark"] code {
    background-color: #334155;
    color: #f472b6;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

/* Alerts in dark mode */
body[data-bs-theme="dark"] .alert-info {
    background-color: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.3);
    color: #7dd3fc;
}

body[data-bs-theme="dark"] .alert-success {
    background-color: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

body[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

body[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Stat cards in dark mode */
body[data-bs-theme="dark"] .stat-card {
    background-color: #1e293b;
}

/* Description lists */
body[data-bs-theme="dark"] dt {
    color: #94a3b8;
}

body[data-bs-theme="dark"] dd {
    color: #e2e8f0;
}

/* Pagination in dark mode */
body[data-bs-theme="dark"] .page-link {
    background-color: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .page-link:hover {
    background-color: #334155;
    border-color: #475569;
    color: #fff;
}

body[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

body[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: #1e293b;
    border-color: #334155;
    color: #64748b;
}

/* List groups in dark mode */
body[data-bs-theme="dark"] .list-group-item {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .list-group-item:hover {
    background-color: #334155;
}

/* Breadcrumb in dark mode */
body[data-bs-theme="dark"] .breadcrumb-item a {
    color: #60a5fa;
}

body[data-bs-theme="dark"] .breadcrumb-item.active {
    color: #94a3b8;
}

body[data-bs-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: #64748b;
}

/* Stock level indicators in dark mode */
body[data-bs-theme="dark"] .stock-level.critical {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body[data-bs-theme="dark"] .stock-level.low {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body[data-bs-theme="dark"] .stock-level.normal {
    background-color: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

/* Borders in dark mode */
body[data-bs-theme="dark"] .border-bottom {
    border-color: #334155 !important;
}

body[data-bs-theme="dark"] .border-top {
    border-color: #334155 !important;
}

body[data-bs-theme="dark"] hr {
    border-color: #334155;
}

/* Footer in dark mode */
body[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: #0f172a !important;
}

/* Navbar in dark mode */
body[data-bs-theme="dark"] .navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body[data-bs-theme="dark"] .nav-link {
    color: #94a3b8;
}

body[data-bs-theme="dark"] .nav-link:hover,
body[data-bs-theme="dark"] .nav-link.active {
    color: #fff;
}

/* Image placeholders */
body[data-bs-theme="dark"] .bg-light {
    background-color: #334155 !important;
}

/* Photo gallery thumbnails */
body[data-bs-theme="dark"] .photo-thumbnail {
    border-color: #475569;
}

body[data-bs-theme="dark"] .photo-thumbnail:hover {
    border-color: #0d6efd;
}

/* Card footer in dark mode */
body[data-bs-theme="dark"] .card-footer {
    background-color: #1e293b;
    border-color: #334155;
}

/* Shadows in dark mode */
body[data-bs-theme="dark"] .shadow,
body[data-bs-theme="dark"] .shadow-sm,
body[data-bs-theme="dark"] .shadow-lg {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.4) !important;
}

/* Navbar brand */
body[data-bs-theme="dark"] .navbar-brand {
    color: #fff;
}

/* Close buttons */
body[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Drop zone styles */
.border-dashed {
    border-style: dashed !important;
}

#dropZone:hover {
    border-color: #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.05);
}

body[data-bs-theme="dark"] #dropZone {
    border-color: #475569 !important;
}

body[data-bs-theme="dark"] #dropZone:hover {
    border-color: #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.1);
}

/* List group items - better dark mode support */
body[data-bs-theme="dark"] .list-group-item-action:hover,
body[data-bs-theme="dark"] .list-group-item-action:focus {
    background-color: #334155;
    color: #fff;
}

/* Warning card in dark mode */
body[data-bs-theme="dark"] .warning-card {
    border-left: 4px solid #f59e0b !important;
}

body[data-bs-theme="dark"] .warning-card .card-body {
    background-color: #1e293b;
}

/* h6 headings in dark mode */
body[data-bs-theme="dark"] h6 {
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .text-warning {
    color: #fbbf24 !important;
}

body[data-bs-theme="dark"] .text-danger {
    color: #f87171 !important;
}

body[data-bs-theme="dark"] .text-success {
    color: #4ade80 !important;
}

body[data-bs-theme="dark"] .text-info {
    color: #38bdf8 !important;
}

body[data-bs-theme="dark"] .text-secondary {
    color: #94a3b8 !important;
}

/* Card body text in dark mode */
body[data-bs-theme="dark"] .card-body {
    color: #e2e8f0;
}

/* Small text in cards */
body[data-bs-theme="dark"] .card small.text-muted {
    color: #94a3b8 !important;
}

/* Fix bg-opacity classes in dark mode */
body[data-bs-theme="dark"] .bg-warning.bg-opacity-75 {
    background-color: rgba(245, 158, 11, 0.75) !important;
}

/* Card header with bg-body-secondary */
body[data-bs-theme="dark"] .card-header.bg-body-secondary {
    background-color: #334155 !important;
    border-color: #475569;
}

body[data-bs-theme="dark"] .bg-body-secondary {
    background-color: #334155 !important;
}

/* Fix bg-light in dark mode - make it dark friendly */
body[data-bs-theme="dark"] .card-header.bg-light {
    background-color: #334155 !important;
    border-color: #475569;
    color: #e2e8f0;
}

body[data-bs-theme="dark"] .bg-light {
    background-color: #334155 !important;
    color: #e2e8f0;
}

/* ================================
   MOBILE RESPONSIVE STYLES
   ================================ */

/* Touch-friendly buttons */
@media (max-width: 767.98px) {
    .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.375rem 0.75rem;
    }
    
    .btn-group-sm > .btn {
        padding: 0.4rem 0.6rem;
    }
}

/* Mobile Navigation */
@media (max-width: 991.98px) {
    .navbar-brand span {
        font-size: 1rem;
    }
    
    .navbar-nav {
        padding: 1rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 8px;
        margin: 2px 0;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }
    
    body[data-bs-theme="dark"] .navbar-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .navbar-nav .dropdown-menu {
        border: none;
        box-shadow: none;
        padding-left: 1rem;
        background: transparent;
    }
    
    .navbar-nav .dropdown-item {
        border-radius: 6px;
        padding: 0.5rem 1rem;
    }
}

/* Page Headers Mobile */
@media (max-width: 767.98px) {
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between.align-items-center.mb-4 > div:first-child {
        text-align: center;
    }
    
    .d-flex.justify-content-between.align-items-center.mb-4 > a,
    .d-flex.justify-content-between.align-items-center.mb-4 > div:last-child {
        width: 100%;
    }
    
    .d-flex.justify-content-between.align-items-center.mb-4 .btn {
        width: 100%;
        justify-content: center;
    }
    
    .d-flex.justify-content-between.align-items-center.mb-4 .d-flex.gap-2 {
        flex-direction: column;
    }
    
    h1.h3 {
        font-size: 1.25rem;
    }
    
    .breadcrumb {
        justify-content: center;
        font-size: 0.8rem;
    }
}

/* Cards Mobile */
@media (max-width: 767.98px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
}

/* Tables Mobile */
@media (max-width: 767.98px) {
    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
        border: none;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th {
        font-size: 0.75rem;
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    .table td {
        padding: 0.5rem;
    }
    
    .table .btn-group {
        display: flex;
        flex-wrap: nowrap;
    }
    
    .table .btn-group .btn {
        padding: 0.4rem 0.5rem;
    }
    
    /* Hide less important columns on mobile */
    .table .hide-mobile {
        display: none;
    }
}

/* Mobile Table Alternative - Card View */
@media (max-width: 575.98px) {
    .mobile-cards .table {
        display: none;
    }
    
    .mobile-card-item {
        background: var(--bs-body-bg);
        border: 1px solid var(--bs-border-color);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .mobile-card-item .item-title {
        font-weight: 600;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .mobile-card-item .item-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        font-size: 0.85rem;
        color: var(--bs-secondary);
    }
    
    .mobile-card-item .item-actions {
        margin-top: 0.75rem;
        display: flex;
        gap: 0.5rem;
    }
}

/* Forms Mobile */
@media (max-width: 767.98px) {
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.625rem 0.875rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    .input-group {
        flex-wrap: nowrap;
    }
    
    .input-group .form-control {
        min-width: 0;
    }
    
    .row.g-3 > [class*="col-"] {
        margin-bottom: 0.5rem;
    }
}

/* Filter Form Mobile */
@media (max-width: 767.98px) {
    .card-body form.row {
        gap: 0.5rem !important;
    }
    
    .card-body form.row > [class*="col-md"] {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    
    .card-body form.row .btn {
        width: 100%;
    }
}

/* Stats Cards Mobile */
@media (max-width: 767.98px) {
    .row .col-md-3,
    .row .col-md-4,
    .row .col-lg-3 {
        margin-bottom: 1rem;
    }
    
    .stat-card .card-body {
        padding: 1rem;
    }
    
    .stat-card h2,
    .stat-card .display-6 {
        font-size: 1.5rem;
    }
    
    .stat-card .fs-4 {
        font-size: 1.25rem !important;
    }
}

/* Dashboard Cards Mobile */
@media (max-width: 767.98px) {
    .row > [class*="col-md-4"],
    .row > [class*="col-lg-4"] {
        margin-bottom: 1rem;
    }
    
    .card-body .text-center h2 {
        font-size: 1.75rem;
    }
    
    .card-body .fa-2x {
        font-size: 1.5em;
    }
}

/* Modals Mobile */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Badges Mobile */
@media (max-width: 767.98px) {
    .badge {
        font-size: 0.7rem;
        padding: 0.35em 0.6em;
    }
}

/* Quick Actions Mobile */
@media (max-width: 767.98px) {
    .quick-actions .btn {
        padding: 0.75rem;
    }
    
    .quick-actions .btn i {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
    
    .quick-actions .btn span {
        font-size: 0.85rem;
    }
}

/* Dropdown Menu Mobile */
@media (max-width: 767.98px) {
    .dropdown-menu {
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* Action Buttons Row Mobile */
@media (max-width: 767.98px) {
    .d-flex.justify-content-between:not(.align-items-center) {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .d-flex.justify-content-between:not(.align-items-center) .btn {
        width: 100%;
    }
}

/* Description Lists Mobile */
@media (max-width: 575.98px) {
    dl.row {
        margin-bottom: 0;
    }
    
    dl.row dt {
        font-size: 0.8rem;
        padding-bottom: 0.25rem;
    }
    
    dl.row dd {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--bs-border-color);
    }
    
    dl.row dd:last-of-type {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
}

/* Pagination Mobile */
@media (max-width: 575.98px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .pagination .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .pagination .page-item:not(.active):not(.disabled) .page-link {
        background: transparent;
    }
}

/* Alert Mobile */
@media (max-width: 767.98px) {
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .alert .d-flex {
        flex-direction: column;
        text-align: center;
    }
    
    .alert i {
        margin-bottom: 0.5rem;
    }
}

/* Photo Upload Mobile */
@media (max-width: 767.98px) {
    .drop-zone {
        padding: 1.5rem 1rem;
    }
    
    .drop-zone i {
        font-size: 2rem;
    }
    
    .photo-preview {
        max-width: 80px;
        max-height: 80px;
    }
}

/* Label Print Preview Mobile */
@media (max-width: 767.98px) {
    .label {
        transform: scale(0.9);
        transform-origin: top left;
    }
}

/* Scan Page Mobile */
@media (max-width: 767.98px) {
    #cameraContainer video {
        max-height: 250px;
    }
    
    #qrcode img {
        max-width: 150px !important;
        height: auto !important;
    }
}

/* Footer Mobile */
@media (max-width: 767.98px) {
    footer .row {
        text-align: center;
    }
    
    footer .text-md-end {
        text-align: center !important;
    }
}

/* Spacing Utilities Mobile */
@media (max-width: 767.98px) {
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* Fix horizontal scroll */
@media (max-width: 767.98px) {
    body {
        overflow-x: hidden;
    }
    
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Bottom Nav Bar for Mobile (Optional) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
    padding: 0.5rem;
    z-index: 1050;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

@media (max-width: 767.98px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
    }
    
    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--bs-secondary);
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .mobile-bottom-nav a.active {
        color: var(--bs-primary);
    }
    
    .mobile-bottom-nav a i {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
    
    /* Add padding at bottom to prevent content overlap */
    body {
        padding-bottom: 70px;
    }
}

/* Swipe Actions (touch) */
@media (max-width: 767.98px) {
    .swipe-actions {
        touch-action: pan-y;
    }
}

/* Better touch targets */
@media (pointer: coarse) {
    a, button, .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .table td a,
    .table td .btn {
        min-height: auto;
    }
}

/* Landscape Phone */
@media (max-width: 767.98px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 90vh;
    }
    
    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Small Phones */
@media (max-width: 359.98px) {
    h1.h3 {
        font-size: 1.1rem;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
}

/* Mobile Utility Classes */
@media (max-width: 767.98px) {
    .h4-mobile {
        font-size: 1.25rem !important;
    }
    
    .text-truncate-mobile {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    
    /* Compact buttons on mobile */
    .btn-group-sm .btn {
        padding: 0.25rem 0.4rem;
    }
    
    /* Fix offcanvas for mobile nav */
    .offcanvas-start {
        width: 280px;
    }
    
    /* Mobile modal improvements */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 1rem;
    }
    
    /* Better spacing for action buttons */
    .d-flex.gap-2 {
        gap: 0.5rem !important;
    }
    
    /* Card improvements */
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    /* Button size utilities for mobile */
    .btn-md-regular {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Button size restore for tablets and up */
@media (min-width: 768px) {
    .btn-md-regular {
        padding: 0.375rem 0.75rem;
        font-size: 1rem;
    }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 991.98px) {
    .col-md-4.col-lg-2 {
        flex: 0 0 auto;
        width: 33.333%;
    }
}

/* Print hide mobile nav */
@media print {
    .mobile-bottom-nav,
    .offcanvas {
        display: none !important;
    }
}

/* Safe area for notch devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
