/**
 * Bheema's Restaurant Operations - Enhanced CSS
 * Professional UI Enhancement Styles
 */

/* ============================================
   CSS Variables - Design Tokens
   ============================================ */
:root {
    /* Brand Colors - Warm Restaurant Orange Theme */
    --primary-50: #fff7ed;
    --primary-100: #ffedd5;
    --primary-200: #fed7aa;
    --primary-300: #fdba74;
    --primary-400: #fb923c;
    --primary-500: #f97316;
    --primary-600: #ea580c;
    --primary-700: #c2410c;
    --primary-800: #9a3412;
    --primary-900: #7c2d12;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gray-950: #030712;

    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --warning-50: #fefce8;
    --warning-500: #eab308;
    --warning-600: #ca8a04;
    --error-50: #fef2f2;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Sidebar Width */
    --sidebar-width: 16rem;
    --sidebar-collapsed-width: 5rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ============================================
   Base Styles
   ============================================ */
html {
    scroll-behavior: smooth;
    /* Prevent layout shift when scrollbar appears/disappears */
    overflow-y: scroll;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Alternative fix: use scrollbar-gutter to reserve space */
    scrollbar-gutter: stable;
}

/* ============================================
   Sidebar Styles
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-950) 100%);
    z-index: 40;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-logo {
    height: 4rem;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    overflow-y: auto;
    max-height: calc(100vh - 8rem);
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: var(--radius-lg);
    color: var(--gray-400);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
}

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

.sidebar-nav-item.active {
    background: var(--primary-600);
    color: white;
}

.sidebar-nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
}

.sidebar-user {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--gray-50);
    transition: margin-left var(--transition-slow);
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================
   Top Bar Styles
   ============================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.topbar-search {
    position: relative;
    width: 100%;
    max-width: 24rem;
}

.topbar-search input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.topbar-search svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--gray-400);
}

/* ============================================
   Card Styles
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* Gradient Stat Cards */
.stat-card {
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    color: white;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.stat-card.green {
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
}

.stat-card.purple {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
}

.stat-card.orange {
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
}

.stat-card.pink {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
}

.stat-card.teal {
    background: linear-gradient(135deg, #14b8a6 0%, #0f766e 100%);
}

/* ============================================
   Table Styles
   ============================================ */
.enhanced-table {
    width: 100%;
    border-collapse: collapse;
}

.enhanced-table thead {
    background: var(--gray-50);
}

.enhanced-table th {
    padding: 0.875rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
}

.enhanced-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.enhanced-table th.sortable:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.enhanced-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    color: var(--gray-700);
}

.enhanced-table tbody tr {
    transition: background var(--transition-fast);
}

.enhanced-table tbody tr:hover {
    background: var(--gray-50);
}

/* ============================================
   Button Styles
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.3);
}

.btn-primary {
    background: var(--primary-600);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-700);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success-600);
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-danger {
    background: var(--error-600);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ============================================
   Badge Styles
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-success {
    background: var(--success-50);
    color: var(--success-600);
}

.badge-warning {
    background: var(--warning-50);
    color: var(--warning-600);
}

.badge-error {
    background: var(--error-50);
    color: var(--error-600);
}

.badge-info {
    background: var(--info-50);
    color: var(--info-600);
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ============================================
   Form Styles
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input.error {
    border-color: var(--error-500);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Floating Label Input */
.floating-label {
    position: relative;
}

.floating-label input {
    padding: 1.25rem 1rem 0.5rem;
}

.floating-label label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.875rem;
    pointer-events: none;
    transition: all var(--transition-fast);
}

.floating-label input:focus ~ label,
.floating-label input:not(:placeholder-shown) ~ label {
    top: 0.5rem;
    transform: none;
    font-size: 0.75rem;
    color: var(--primary-600);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 24rem;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius-xl);
    background: white;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success-500);
}

.toast.error {
    border-left: 4px solid var(--error-500);
}

.toast.warning {
    border-left: 4px solid var(--warning-500);
}

.toast.info {
    border-left: 4px solid var(--info-500);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast.hiding {
    animation: slideOut 0.2s ease forwards;
}

/* ============================================
   Modal Styles
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.modal-backdrop.active {
    opacity: 1;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    z-index: 51;
    max-width: 32rem;
    width: calc(100% - 2rem);
    max-height: calc(100vh - 4rem);
    overflow: hidden;
    opacity: 0;
    transition: all var(--transition-base);
}

.modal.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--gray-400);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 16rem);
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ============================================
   Avatar Styles
   ============================================ */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-transform: uppercase;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.avatar-md {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

.avatar-xl {
    width: 4rem;
    height: 4rem;
    font-size: 1.25rem;
}

/* ============================================
   Quick Actions Grid
   ============================================ */
.quick-actions {
    display: grid;
    gap: 1rem;
}

.quick-action {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-xl);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.quick-action:hover {
    border-color: var(--primary-500);
    background: rgba(249, 115, 22, 0.05);
    transform: translateY(-2px);
}

.quick-action-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    margin-right: 1rem;
}

.quick-action-text {
    font-weight: 500;
    color: var(--gray-700);
}

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

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

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .stat-card {
        padding: 1rem;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding: 1rem;
    }

    .enhanced-table th,
    .enhanced-table td {
        padding: 0.75rem 1rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

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

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Custom scrollbar */
.scrollbar-custom::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-custom::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar-custom::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.scrollbar-custom::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================
   Global Enhancements for Existing Templates
   ============================================ */

/* Enhanced cards with Tailwind classes */
.bg-white.shadow,
.bg-white.shadow-sm,
.bg-white.shadow-md,
.bg-white.shadow-lg,
.bg-white.rounded-lg,
.bg-white.rounded-xl {
    border: 1px solid var(--gray-100);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.bg-white.shadow:hover,
.bg-white.shadow-sm:hover,
.bg-white.shadow-md:hover {
    box-shadow: var(--shadow-lg);
}

/* Enhanced tables with Tailwind classes */
table.min-w-full th,
.min-w-full th {
    background: var(--gray-50) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: var(--gray-500) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 0.875rem 1rem !important;
}

table.min-w-full td,
.min-w-full td {
    padding: 1rem !important;
    font-size: 0.875rem !important;
    border-bottom: 1px solid var(--gray-100) !important;
}

table.min-w-full tbody tr:hover,
.min-w-full tbody tr:hover {
    background: var(--gray-50) !important;
}

/* Page headers enhancement */
h1.text-3xl,
h1.text-2xl {
    font-weight: 700 !important;
    color: var(--gray-900) !important;
    letter-spacing: -0.025em;
}

h2.text-xl,
h2.text-lg {
    font-weight: 600 !important;
    color: var(--gray-800) !important;
}

/* Enhanced stat cards */
.grid.grid-cols-1 > div.bg-white,
.grid.sm\\:grid-cols-2 > div.bg-white,
.grid.lg\\:grid-cols-4 > div.bg-white {
    border-radius: var(--radius-xl) !important;
    transition: transform var(--transition-base), box-shadow var(--transition-base) !important;
}

.grid.grid-cols-1 > div.bg-white:hover,
.grid.sm\\:grid-cols-2 > div.bg-white:hover,
.grid.lg\\:grid-cols-4 > div.bg-white:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
}

/* Enhanced buttons */
.bg-green-600:hover,
.bg-green-700:hover,
.from-green-600:hover {
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25) !important;
}

.bg-blue-600:hover,
.bg-indigo-600:hover {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25) !important;
}

.bg-red-600:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25) !important;
}

/* Enhanced form inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    border-width: 1.5px !important;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast) !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-500) !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1) !important;
    outline: none !important;
}

/* Status badges */
.rounded-full.bg-green-100,
.rounded-full.bg-green-50 {
    animation: none;
    transition: transform var(--transition-fast);
}

.rounded-full.bg-green-100:hover,
.rounded-full.bg-green-50:hover {
    transform: scale(1.05);
}

/* Enhanced links */
a.text-green-600:hover,
a.text-blue-600:hover,
a.text-indigo-600:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Page container padding fix */
.max-w-7xl.mx-auto.px-4 {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

@media (min-width: 1024px) {
    .max-w-7xl.mx-auto.px-4 {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* Remove double backgrounds */
.min-h-screen.bg-gray-100 {
    min-height: auto !important;
    background: transparent !important;
}

/* Enhanced action icons */
.text-gray-400:hover,
.text-gray-500:hover {
    color: var(--gray-700) !important;
}

/* Smooth page transitions */
.p-4.lg\\:p-6 > div {
    animation: fadeIn 0.2s ease;
}

/* Better mobile responsiveness */
@media (max-width: 640px) {
    .grid.grid-cols-1.gap-5 {
        gap: 1rem !important;
    }

    table.min-w-full th,
    table.min-w-full td {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
}

/* ============================================
   MOBILE RESPONSIVE ENHANCEMENTS
   ============================================ */

/* Mobile: < 480px (Small phones) */
@media (max-width: 480px) {
    /* Reduce overall padding */
    .max-w-7xl.mx-auto.px-4,
    .max-w-7xl.mx-auto.px-4.sm\\:px-6 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .py-8 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Header - More compact */
    nav.bg-gradient-to-r {
        padding: 0.5rem 0 !important;
    }

    nav .h-20 {
        height: auto !important;
        min-height: 3.5rem !important;
        flex-wrap: wrap !important;
        padding: 0.5rem 0 !important;
    }

    nav .text-2xl {
        font-size: 1.125rem !important;
    }

    nav .space-x-6 {
        gap: 0.5rem !important;
    }

    /* Hide welcome text on small screens */
    nav .hidden.md\\:block {
        display: none !important;
    }

    /* Compact user info */
    nav .text-right p.text-sm {
        font-size: 0.75rem !important;
    }

    nav .text-right .text-xs {
        font-size: 0.625rem !important;
    }

    /* Smaller logout button */
    nav a.bg-red-600 {
        padding: 0.375rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    nav a.bg-red-600 svg {
        width: 0.875rem !important;
        height: 0.875rem !important;
        margin-right: 0.25rem !important;
    }

    /* Stat Cards - 2x2 Grid */
    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* Compact stat card content */
    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 > div .p-6 {
        padding: 0.875rem !important;
    }

    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 > div .text-4xl {
        font-size: 1.5rem !important;
    }

    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 > div .text-sm.font-medium {
        font-size: 0.625rem !important;
    }

    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 > div .mt-1.text-sm {
        font-size: 0.625rem !important;
        margin-top: 0.25rem !important;
    }

    /* Smaller icons in stat cards */
    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 > div .p-3 {
        padding: 0.5rem !important;
    }

    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 > div .h-7.w-7 {
        width: 1.25rem !important;
        height: 1.25rem !important;
    }

    /* Quick Actions - Compact */
    .bg-white.rounded-2xl.shadow-sm.border.p-6 {
        padding: 1rem !important;
    }

    .bg-white.rounded-2xl.shadow-sm.border.p-6 .mb-6 {
        margin-bottom: 0.75rem !important;
    }

    .bg-white.rounded-2xl.shadow-sm.border.p-6 h3 {
        font-size: 0.875rem !important;
    }

    .bg-white.rounded-2xl.shadow-sm.border.p-6 span.text-sm {
        font-size: 0.625rem !important;
    }

    /* Quick action grid - 3 columns on mobile */
    .grid.grid-cols-2.gap-3.sm\\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Compact quick action items */
    .grid.grid-cols-2.gap-3 a.group,
    .grid.grid-cols-2.gap-3 div.flex.flex-col {
        padding: 0.5rem !important;
    }

    .grid.grid-cols-2.gap-3 a.group .p-2\\.5,
    .grid.grid-cols-2.gap-3 div.flex.flex-col .p-2\\.5 {
        padding: 0.375rem !important;
        margin-bottom: 0.25rem !important;
    }

    .grid.grid-cols-2.gap-3 a.group .h-5.w-5,
    .grid.grid-cols-2.gap-3 div.flex.flex-col .h-5.w-5 {
        width: 1rem !important;
        height: 1rem !important;
    }

    .grid.grid-cols-2.gap-3 span.text-sm {
        font-size: 0.625rem !important;
        text-align: center;
        line-height: 1.2 !important;
    }

    /* System status notice - Compact */
    .bg-green-50.border-l-4.p-4 {
        padding: 0.75rem !important;
    }

    .bg-green-50 .text-sm {
        font-size: 0.75rem !important;
    }

    /* Weekly sales table - Horizontal scroll */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    .overflow-x-auto table {
        font-size: 0.625rem !important;
    }

    .overflow-x-auto th,
    .overflow-x-auto td {
        padding: 0.5rem 0.375rem !important;
        white-space: nowrap;
    }
}

/* Mobile: 481px - 640px (Large phones) */
@media (min-width: 481px) and (max-width: 640px) {
    /* Stat cards 2x2 */
    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 > div .p-6 {
        padding: 1rem !important;
    }

    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2 > div .text-4xl {
        font-size: 1.75rem !important;
    }

    /* Quick actions 3 columns */
    .grid.grid-cols-2.gap-3.sm\\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Tablet: 641px - 768px */
@media (min-width: 641px) and (max-width: 768px) {
    .grid.grid-cols-1.gap-5.sm\\:grid-cols-2.lg\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   Staff Location Dashboard Mobile Fixes
   ============================================ */
@media (max-width: 480px) {
    /* Staff location header */
    .flex.justify-between.h-20 {
        flex-direction: column !important;
        height: auto !important;
        padding: 0.75rem !important;
        gap: 0.5rem !important;
    }

    /* Logo and user section side by side */
    .flex.items-center.space-x-6 {
        width: 100% !important;
        justify-content: space-between !important;
    }

    /* Brand name smaller */
    h1.text-2xl .brand-name {
        font-size: 1.25rem !important;
    }

    h1.text-2xl span.font-semibold:not(.brand-name) {
        font-size: 1rem !important;
    }

    /* User menu compact */
    .flex.items-center.space-x-4 {
        gap: 0.5rem !important;
    }
}

/* ============================================
   Bottom Navigation Bar (Optional)
   ============================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 0.5rem;
    z-index: 50;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mobile-bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.625rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    min-width: 60px;
}

.mobile-bottom-nav a:hover,
.mobile-bottom-nav a.active {
    color: var(--primary-600);
    background: var(--primary-50);
}

.mobile-bottom-nav a svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-bottom: 0.125rem;
}

@media (max-width: 640px) {
    .mobile-bottom-nav {
        display: block;
    }

    /* Add padding to main content to prevent bottom nav overlap */
    body {
        padding-bottom: 4rem;
    }
}

/* ============================================
   Hamburger Menu (Mobile)
   ============================================ */
.mobile-menu-toggle {
    display: none;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
}

@media (max-width: 640px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   Touch-Friendly Enhancements
   ============================================ */
@media (max-width: 768px) {
    /* Ensure minimum touch target size (44x44px) */
    a, button, .clickable {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger tap targets for links in tables */
    table a {
        display: inline-block;
        padding: 0.5rem;
        margin: -0.5rem;
    }

    /* Better spacing for form elements */
    input, select, textarea, button {
        min-height: 44px;
    }
}
