:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --success-color: #06d6a0;
    --danger-color: #ef476f;
    --warning-color: #ffd166;
    --info-color: #118ab2;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 260px;
    --sidebar-collapsed: 200px;
    --transition: all 0.3s ease;
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.15);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.admin-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f8fafc;
    color: #334155;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Login Section */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: fit-content;
}

.admin-card {
    height: fit-content;
    border: none;
    border-radius: 20px;
    overflow: hidden;
    transition: var(--transition);
}

.admin-card:hover {
    transform: translateY(-5px);
}

/* Navbar */
.admin-navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(67, 97, 238, 0.15);
}

.admin-navbar .navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

/* Sidebar */
.admin-sidebar {
    background: white;
    height: 100vh;
    position: fixed;
    width: var(--sidebar-width);
    left: 0;
    top: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem;
}

.admin-sidebar .nav-link {
    color: #64748b;
    padding: 0.75rem 1.5rem;
    border-left: 4px solid transparent;
    transition: var(--transition);
    margin: auto;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-sidebar .nav-link:hover {
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.08);
    border-left-color: var(--primary-color);
}

.admin-sidebar .nav-link.active {
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.12);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.admin-sidebar .nav-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
    padding: 1.5rem;
}

/* Main Content */
#mainContent {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

/* Stats Cards */
.stats-card {
    border: none;
    border-radius: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    color: white;
}

.stats-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md) !important;
}

.stats-card.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stats-card.bg-gradient-success {
    background: linear-gradient(135deg, #06d6a0 0%, #0db39e 100%);
}

.stats-card.bg-gradient-warning {
    background: linear-gradient(135deg, #ffd166 0%, #ffb347 100%);
}

.stats-card.bg-gradient-info {
    background: linear-gradient(135deg, #118ab2 0%, #06b6d4 100%);
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-top: 1px solid #e2e8f0;
    padding: 1rem 0.75rem;
}

.table td {
    border-top: 1px solid #e2e8f0;
    vertical-align: middle;
    padding: 1rem 0.75rem;
}

.table-hover tbody tr:hover {
    background: rgba(67, 97, 238, 0.04);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Badges */
.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 10px;
    display: inline-block;
}

.badge.bg-success {
    background: linear-gradient(135deg, var(--success-color), #0db39e) !important;
    color: white;
}

.badge.bg-warning {
    background: linear-gradient(135deg, var(--warning-color), #ffb347) !important;
    color: #333;
}

.badge.bg-danger {
    background: linear-gradient(135deg, var(--danger-color), #d63384) !important;
    color: white;
}

.badge.bg-info {
    background: linear-gradient(135deg, var(--info-color), #06b6d4) !important;
    color: white;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #d63384);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #0db39e);
    color: white;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--primary-color);
}

/* Form Controls */
.form-control {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
    outline: none;
}

.form-control:disabled {
    background-color: #f8fafc;
    cursor: not-allowed;
}

.input-group-text {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-right: none;
    font-weight: 500;
}

/* Cards */
.card {
    height: fit-content !important;
    border: none;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Modal */
.modal-content {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1.5rem;
}

/* Charts */
.chart-area,
.chart-pie {
    position: relative;
    height: 100%;
    width: 100%;
}

/* Toast */
.toast {
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Status Indicators */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-pending {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.status-completed {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}

.status-cancelled {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

/* Order Item Card */
.order-item-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.order-item-card:hover {
    background: #eef2ff;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    #mainContent {
        margin-left: 0;
    }
    
    .admin-sidebar.show {
        transform: translateX(0);
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .admin-sidebar {
        width: var(--sidebar-collapsed);
        font-size: 12px;
    }
    
    #mainContent {
        margin-left: var(--sidebar-collapsed);
    }
    
    .admin-sidebar .nav-link span:not(.badge),
    .admin-sidebar .text-uppercase {
        display: none;
    }
    
    .admin-sidebar .nav-link {
        text-align: center;
        padding: 0.75rem 0.5rem;
        margin: 0.25rem 0.5rem;
        justify-content: left;
    }
    
    .admin-sidebar .nav-link i {
        margin: 0;
        font-size: 1.2rem;
    }
    
    .sidebar-header,
    .sidebar-footer {
        display: none;
    }
}


/* Mobile Responsive (max-width: 576px) */
@media (max-width: 576px) {
    :root {
        --sidebar-width: 100%;
    }

    body.admin-body {
        font-size: 14px;
    }

    /* Navbar */
    .admin-navbar {
        padding: 0.75rem 0;
    }

    .admin-navbar .navbar-brand {
        font-size: 1rem;
    }

    /* Sidebar */
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        top: auto;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    }

    .sidebar-header {
        display: none;
    }

    .admin-sidebar .nav-link {
        padding: 0.5rem 1rem;
        margin: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }

    .sidebar-footer {
        display: none;
    }

    /* Main Content */
    #mainContent {
        margin-left: 0;
        margin-bottom: 80px;
        min-height: calc(100vh - 80px);
    }

    /* Cards & Stats */
    .stats-card {
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .card {
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Tables */
    .table {
        font-size: 0.85rem;
    }

    .table th {
        padding: 0.75rem 0.5rem;
        font-size: 0.7rem;
    }

    .table td {
        padding: 0.75rem 0.5rem;
    }

    /* Buttons */
    .btn {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Forms */
    .form-control {
        padding: 0.6rem 0.75rem;
        font-size: 16px;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    /* Modal */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 15px;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* Badges */
    .badge {
        padding: 0.3em 0.6em;
        font-size: 0.7em;
    }

    /* Order Item Card */
    .order-item-card {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* Grid Columns */
    .col-md-6,
    .col-lg-4,
    .col-lg-3 {
        width: 100%;
    }

    /* Utilities */
    .text-sm {
        font-size: 0.8rem;
    }

    .px-3 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}


/* Add to your existing CSS */
.delete-animation {
    animation: deleteFadeOut 0.5s ease forwards;
}

@keyframes deleteFadeOut {
    from {
        opacity: 1;
        background-color: transparent;
    }
    to {
        opacity: 0.5;
        background-color: rgba(220, 53, 69, 0.1);
    }
}

/* Styling for delete confirmation warning */
.delete-warning {
    border-left: 4px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

/* Payment method badges */
.bg-cash { background-color: #06d6a0 !important; }
.bg-card { background-color: #118ab2 !important; }
.bg-combined { background-color: #ffd166 !important; }

/* Table styling for payment columns */
.table-hover tbody tr td:nth-child(6),
.table-hover tbody tr td:nth-child(7),
.table-hover tbody tr td:nth-child(8) {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Stats card improvements */
.stats-card {
    transition: all 0.3s ease;
    border: none;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
}

/* Progress bars for percentages */
.payment-progress {
    height: 10px;
    border-radius: 5px;
    background-color: #e9ecef;
    overflow: hidden;
}

.payment-progress-bar {
    height: 100%;
    transition: width 0.6s ease;
}

/* Payment legend */
.payment-legend {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #4361ee;
}

.payment-legend div {
    padding: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.payment-legend div:last-child {
    border-bottom: none;
}

/* Chart controls styling */
.chart-controls {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    border-left: 4px solid #4361ee;
}

.chart-controls .btn-group .btn {
    border-radius: 4px !important;
}

.chart-controls .btn-outline-primary.active {
    background-color: #4361ee;
    border-color: #4361ee;
    color: white;
}

/* Chart container improvements */
.chart-area {
    position: relative;
    height: auto;
    width: 100%;
}

.chart-area canvas {
    max-height: 300px;
}

/* Chart tooltip improvements */
.chartjs-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chartjs-tooltip-key {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 5px;
}

/* Loading state for charts */
.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Responsive chart adjustments */
@media (max-width: 768px) {
    .chart-area {
        height: 250px;
    }
    
    .chart-controls .btn-group {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .chart-controls .btn-group .btn {
        flex: 1;
    }
}


/* Landscape Mobile Responsive (576px - 768px) */
@media (max-width: 768px) and (orientation: landscape) {
    body.admin-body {
        font-size: 13px;
    }

    /* Adjust header for landscape */
    .admin-navbar {
        padding: 0.5rem 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        height: 60px;
    }

    .admin-navbar .navbar-brand {
        font-size: 1rem;
    }

    /* Sidebar for landscape */
    .admin-sidebar {
        width: 250px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
        z-index: 1040;
        top: 60px; /* Account for fixed navbar */
        position: fixed;
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    /* Main content adjustment */
    #mainContent {
        margin-left: 0;
        margin-top: 60px; /* Space for fixed navbar */
        width: 100%;
        padding: 1rem !important;
    }

    /* Compact table styling for landscape */
    .table {
        font-size: 0.8rem;
    }

    .table th, .table td {
        padding: 0.5rem;
    }

    /* Adjust cards for landscape */
    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Stats cards in horizontal layout */
    .stats-card {
        height: auto !important;
        min-height: 120px;
    }

    .stats-card .row {
        flex-wrap: nowrap;
    }

    /* Button adjustments */
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .btn-group .btn {
        padding: 0.3rem 0.6rem;
    }

    /* Form controls */
    .form-control {
        padding: 0.5rem 0.75rem;
        font-size: 14px;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
        max-width: 95%;
    }

    /* Chart adjustments */
    .chart-area {
        height: 200px;
    }

    /* Hide some non-essential elements */
    .sidebar-footer,
    .sidebar-header h5 {
        display: none;
    }

    .admin-sidebar .nav-link span.badge {
        display: none;
    }

    /* Adjust avatar sizes */
    .avatar-sm {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    /* Status badges */
    .status-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Adjust dropdowns */
    .dropdown-menu {
        font-size: 0.85rem;
        max-width: 200px;
    }

    /* Order item cards */
    .order-item-card {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* Toast positioning */
    .toast-container {
        padding: 0.5rem;
        top: 70px;
        max-width: 90%;
    }
}

/* Portrait Mobile (up to 576px) */
@media (max-width: 576px) {
    /* Existing portrait styles remain, but add these adjustments */
    .admin-sidebar {
        width: 85%;
        max-width: 300px;
        top: 0;
        height: 100vh;
    }

    /* Overlay for mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }

    #mainContent {
        margin-bottom: 60px;
        padding: 0.75rem !important;
    }

    /* Table scroll wrapper for mobile */
    .table-responsive {
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }

    /* Stats cards in grid */
    .row .col-md-6,
    .row .col-xl-3 {
        width: 50%;
    }
}

/* Small Landscape (320px - 576px) */
@media (max-width: 576px) and (orientation: landscape) {
    body.admin-body {
        font-size: 12px;
    }

    /* Even more compact navbar */
    .admin-navbar {
        height: 50px;
        padding: 0.25rem 0;
    }

    /* Main content adjustment */
    #mainContent {
        margin-top: 50px;
        padding: 0.5rem !important;
    }

    /* Sidebar width for small landscape */
    .admin-sidebar {
        width: 220px;
        top: 50px;
    }

    /* Table adjustments */
    .table th, .table td {
        padding: 0.3rem;
        font-size: 0.75rem;
    }

    /* Hide table columns on very small screens */
    .table th:nth-child(4),
    .table td:nth-child(4),
    .table th:nth-child(5),
    .table td:nth-child(5) {
        display: none;
    }

    /* Compact cards */
    .card-header {
        padding: 0.5rem 0.75rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    /* Smaller buttons */
    .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Adjust dropdowns */
    .dropdown-menu {
        font-size: 0.8rem;
        min-width: 180px;
    }

    /* Stats cards */
    .stats-card .h4 {
        font-size: 1.25rem;
    }

    /* Chart containers */
    .chart-area {
        height: 150px;
    }
}

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* Minimum touch target size */
        min-width: 44px;
    }

    .nav-link {
        padding: 1rem 1.5rem !important;
    }

    .form-check-input {
        transform: scale(1.3);
        margin-right: 0.5rem;
    }

    .table-hover tbody tr {
        padding: 0.5rem 0;
    }

    /* Increase touch target for table rows */
    .table tbody tr {
        min-height: 44px;
    }

    /* Modal buttons */
    .modal-footer .btn {
        min-height: 44px;
        flex: 1;
        margin: 0.25rem;
    }

    /* Sidebar toggle button */
    #sidebarToggle {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Landscape-specific optimizations */
@media (orientation: landscape) and (max-height: 500px) {
    /* Reduce vertical padding for very short screens */
    .card-body {
        padding: 0.5rem;
    }

    .admin-sidebar .nav-link {
        padding: 0.5rem 1rem;
    }

    .table th, .table td {
        padding: 0.25rem;
    }

    /* Compact form controls */
    .form-control {
        padding: 0.4rem 0.6rem;
    }

    /* Smaller charts */
    .chart-area {
        height: 120px;
    }
}

/* Prevent zoom on input focus for iOS */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Smooth transitions for sidebar */
#sidebar {
    transition: all 0.3s ease;
}

/* Mobile menu backdrop */
.mobile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1039;
    display: none;
}

.mobile-backdrop.show {
    display: block;
}


/* Mobile-first improvements */
@media (max-width: 768px) {
    /* Improve tap targets */
    .btn, .nav-link, .form-check-input {
        cursor: pointer;
    }
    
    /* Prevent text selection on interactive elements */
    .btn, .nav-link, .dropdown-item {
        user-select: none;
        -webkit-user-select: none;
    }
    
    /* Smooth scrolling for mobile */
    html {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better modal for mobile */
    .modal {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .modal-dialog {
        margin: 0;
        height: 100%;
        max-height: 100%;
    }
    
    .modal-content {
        border-radius: 0;
        min-height: 100%;
    }
    
    /* Mobile-optimized forms */
    .form-control, .form-select {
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    /* Improve dropdowns for mobile */
    .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0;
        width: 100% !important;
        transform: none !important;
        margin: 0;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 15px 15px 0 0;
    }
    
    /* Mobile-friendly table scrolling */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }
    
    /* Hide scrollbar on mobile but keep functionality */
    .table-responsive::-webkit-scrollbar {
        display: none;
    }
    
    /* Status badges with icons for mobile */
    .status-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
    }
    
    /* Mobile-specific utility classes */
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
}

/* Landscape-specific table adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .table-responsive {
        max-height: 60vh;
        overflow-y: auto;
    }
    
    /* Sticky table header for landscape */
    .table thead {
        position: sticky;
        top: 0;
        background: #f8f9fa;
        z-index: 1;
    }
    
    /* Better contrast for landscape */
    .table-striped tbody tr:nth-of-type(odd) {
        background-color: rgba(0, 0, 0, 0.03);
    }
}

/* High DPI mobile devices */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn, .card, .form-control {
        border-width: 0.5px;
    }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific CSS */
    .admin-sidebar {
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }
    
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
}

/* Android-specific fixes */
@supports not (-webkit-touch-callout: none) {
    .admin-sidebar {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
    body.admin-body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    #mainContent {
        padding-left: max(1rem, env(safe-area-inset-left)) !important;
        padding-right: max(1rem, env(safe-area-inset-right)) !important;
    }
    
    .admin-navbar {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}


.d-flex {
    flex-wrap: wrap;
}
