/* Mobile-First Modern POS Design */

/* Cart item styling - Modern Card Design */
.cart-item-mobile {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #f3f4f6;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-item-mobile:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.dark .cart-item-mobile {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border-color: #374151;
}

/* Mobile cart overlay */
.mobile-cart-open {
  overflow: hidden !important;
}

/* Enhanced mobile cart */
#mobile-cart-overlay {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}

#mobile-cart-panel {
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  will-change: transform;
}

#mobile-cart-panel.open {
  transform: translateY(0);
}

/* Swipe indicator for mobile cart */
#mobile-cart-panel::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  opacity: 0.5;
}

/* Bottom nav bar spacing for safe areas */
@media (max-width: 768px) {
  #bottom-nav {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  
  .dark #bottom-nav {
    background: rgba(17, 24, 39, 0.9);
  }
  
  #mobile-cart-btn {
    bottom: calc(80px + max(0px, env(safe-area-inset-bottom)));
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  }
  
  /* Modern Page Headers */
  .page-header {
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(147, 51, 234, 0.05));
    border-radius: 16px;
    margin-bottom: 1.5rem;
  }
  
  /* Swipeable cards */
  .swipe-card {
    touch-action: pan-y;
    user-select: none;
  }
}

/* Improved mobile touch targets */
@media (max-width: 640px) {
  /* All interactive elements minimum 48x48px */
  .form-control, 
  button,
  .btn,
  select,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  a.btn,
  .interactive-element {
    min-height: 48px;
  }
  
  /* Buttons should also have minimum width for better touch */
  button,
  .btn,
  a.btn {
    min-height: 48px;
    padding: 12px 20px;
  }
  
  .qty-btn {
    min-width: 48px;
    min-height: 48px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
  }
  
  /* Icon-only buttons */
  button:has(i.fa):not(:has(span)),
  .btn:has(i.fa):not(:has(span)) {
    min-width: 48px;
    min-height: 48px;
    padding: 12px;
  }
  
  /* Increase spacing between interactive elements */
  button + button,
  .btn + .btn {
    margin-left: 8px;
  }
  
  /* Better spacing for form elements */
  .form-control {
    padding: 12px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  select.form-control {
    padding: 12px 16px;
    background-position: right 12px center;
  }
  
  /* Product grid optimizations */
  .product-grid-mobile {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 8px;
  }
  
  .product-card-mobile {
    background: white;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f3f4f6;
    min-height: 120px;
  }
  
  .product-card-mobile:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  }
  
  .dark .product-card-mobile {
    background: #1f2937;
    border-color: #374151;
  }
  
  /* Enhanced search bar */
  .search-bar-mobile {
    position: sticky;
    top: 64px;
    z-index: 15;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    margin: -12px -16px 16px;
  }
  
  .dark .search-bar-mobile {
    background: rgba(17, 24, 39, 0.95);
  }
  
  /* Modal close buttons */
  .modal button[aria-label*="close"],
  .modal button[aria-label*="Close"] {
    min-width: 48px;
    min-height: 48px;
  }
  
  /* Table action buttons in mobile card view */
  .data-table button,
  .data-table .btn {
    min-width: 48px;
    min-height: 48px;
    padding: 12px 16px;
  }
}

/* Active state for buttons on touch devices */
@media (hover: none) {
  button:active, 
  .btn:active,
  .card-hover:active {
    opacity: 0.8;
    transform: scale(0.97);
    transition: all 0.1s ease;
  }
  
  /* Prevent double-tap zoom */
  button,
  .btn,
  a {
    touch-action: manipulation;
  }
}

/* Mobile-Friendly Table Cards */
@media (max-width: 768px) {
  /* Hide table headers and restructure as cards on mobile */
  .data-table thead {
    display: none;
  }
  
  .data-table tbody {
    display: block;
  }
  
  .data-table tbody tr {
    display: block;
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f3f4f6;
  }
  
  .dark .data-table tbody tr {
    background: #1f2937;
    border-color: #374151;
  }
  
  .data-table tbody tr:hover {
    transform: none;
  }
  
  .data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    text-align: right;
  }
  
  .dark .data-table tbody td {
    border-bottom-color: #374151;
  }
  
  .data-table tbody td:last-child {
    border-bottom: none;
  }
  
  /* Add labels before data on mobile */
  .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    text-align: left;
    margin-right: 12px;
    flex: 1;
  }

  /* Friendly display for full-width status rows (e.g., colspan) */
  .data-table tbody td[colspan] {
    display: block;
    text-align: center;
    border-bottom: none;
    padding: 12px 0;
  }
  .data-table tbody td[colspan]::before {
    content: none;
  }
  
  .dark .data-table tbody td::before {
    color: #9ca3af;
  }
  
  /* Special handling for action buttons */
  .data-table tbody td:has(button),
  .data-table tbody td:has(.btn) {
    justify-content: center;
    border-bottom: none;
    padding-top: 12px;
  }
  
  .data-table tbody td:has(button)::before,
  .data-table tbody td:has(.btn)::before {
    display: none;
  }
  
  /* Responsive table wrapper - allow scrolling as fallback */
  .responsive-table {
    width: 100%;
    margin: 0;
    padding: 0;
  }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
  .product-grid-tablet {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  
  .data-table th,
  .data-table td {
    padding: 1rem 0.75rem;
  }
}

/* Desktop and Tablet enhancements (without changing mobile) */
@media (min-width: 769px) {
  /* Make tables behave as regular tables again on >=769px */
  .data-table thead { display: table-header-group; }
  .data-table tbody { display: table-row-group; }
  .data-table tbody tr { display: table-row; background: transparent; box-shadow: none; border: none; padding: 0; margin: 0; }
  .data-table tbody td { display: table-cell; text-align: left; border-bottom: 1px solid rgba(243,244,246,1); padding: 0.75rem 1rem; }
  .dark .data-table tbody td { border-bottom-color: #374151; }
  .data-table tbody td::before { content: none; }
  .data-table tbody td[colspan] { display: table-cell; text-align: center; }

  /* Billing layout refinements on wider screens */
  .billing-container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  /* Ensure order sidebar uses sticky layout rather than fixed when page scroll is needed */
  #order-sidebar {
    position: sticky;
    top: 1rem;
    height: auto;
    max-height: calc(100vh - 2rem);
  }

  /* Hide mobile bottom bar beyond mobile */
  .mobile-bottom-bar { display: none !important; }
}

/* Large desktop fine-tuning */
@media (min-width: 1280px) {
  #billing-product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
  }
}

/* Generic horizontal tab bar improvements (applies to pages using flex tab bars) */
.tab-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.tab-container::-webkit-scrollbar {
  height: 6px;
}
.tab-container::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.4);
  border-radius: 9999px;
}
.tab-button {
  white-space: nowrap;
  border-radius: 10px 10px 0 0;
  padding: 10px 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.tab-button.active {
  background: linear-gradient(to right, #6366f1, #8b5cf6);
  color: white;
}


/* Pull to refresh indicator */
.pull-to-refresh {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.3s ease;
}

.pull-to-refresh.visible {
  top: 70px;
}

/* Smooth scroll snap for carousels */
.scroll-snap-x {
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.scroll-snap-x::-webkit-scrollbar {
  display: none;
}

.scroll-snap-item {
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Swipe indicators for mobile */
.swipe-indicator {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}

.swipe-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

.swipe-indicator-dot.active {
  background: white;
  width: 24px;
  border-radius: 4px;
}

/* Mobile modal improvements */
@media (max-width: 768px) {
  /* Full-screen modals on mobile */
  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Better modal headers */
  .modal-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px;
  }
  
  .dark .modal-header {
    background: #1f2937;
    border-bottom-color: #374151;
  }
  
  /* Improved modal footers */
  .modal-footer {
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 10;
    border-top: 1px solid #e5e7eb;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  
  .dark .modal-footer {
    background: #1f2937;
    border-top-color: #374151;
  }
}

/* Enhanced bottom navigation */
@media (max-width: 768px) {
  #bottom-nav {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  
  .dark #bottom-nav {
    background: rgba(17, 24, 39, 0.95);
  }
  
  /* Active tab indicator */
  .nav-item.active {
    position: relative;
  }
  
  .nav-item.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: linear-gradient(to right, #6366f1, #8b5cf6);
    border-radius: 0 0 3px 3px;
  }
}

/* Floating action button improvements */
@media (max-width: 768px) {
  .fab {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .fab:active {
    transform: scale(0.9);
  }
}

/* Status bar safe area for iOS */
@supports (padding: max(0px)) {
  body {
    padding-top: max(0px, env(safe-area-inset-top));
  }
  
  #app-header {
    padding-top: max(16px, env(safe-area-inset-top));
  }
  
  /* Ensure content doesn't go under notch */
  .page-content {
    padding-top: max(16px, env(safe-area-inset-top));
  }
}

/* Haptic feedback simulation */
@keyframes haptic-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.95); }
}

.haptic-feedback:active {
  animation: haptic-pulse 0.2s ease;
}

/* Skeleton loading improvements */
@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200px 100%;
}

/* Modern loader */
.modern-loader {
  width: 48px;
  height: 48px;
  border: 5px solid #f3f4f6;
  border-bottom-color: #6366f1;
  border-radius: 50%;
  display: inline-block;
  animation: rotation 1s linear infinite;
}

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

.dark .modern-loader {
  border-color: #374151;
  border-bottom-color: #6366f1;
}

/* Notification badge */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border-radius: 10px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  border: 2px solid white;
  animation: badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark .notification-badge {
  border-color: #1f2937;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Empty state illustrations */
.empty-state {
  padding: 48px 24px;
  text-align: center;
}

.empty-state i {
  font-size: 64px;
  color: #d1d5db;
  margin-bottom: 16px;
  opacity: 0.5;
}

.dark .empty-state i {
  color: #4b5563;
}

/* Success/Error animations */
@keyframes success-scale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.success-animation {
  animation: success-scale 0.5s ease;
}

/* Improved focus states for accessibility */
@media (max-width: 768px) {
  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
  }
}

/* ============================================
   TABLET & iPAD RESPONSIVE STYLES
   Covers: iPad Mini (768px), iPad (820px), 
   iPad Air (820px), iPad Pro 11" (834px),
   iPad Pro 12.9" (1024px), Android tablets
   ============================================ */

/* Tablet Portrait Mode (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  
  /* Root adjustments for tablets */
  :root {
    --header-height: 72px;
    --bottom-nav-height: 72px;
  }

  /* Main Layout */
  #main-content {
    padding: 24px;
  }

  #page-container {
    max-width: 100%;
    padding: 0;
  }

  /* Header adjustments */
  header {
    padding: 0 24px;
  }

  #page-title {
    font-size: 1.5rem;
  }

  /* Sidebar navigation for tablets - show as slide-out */
  #sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

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

  /* Bottom navigation - enhanced for tablets */
  #bottom-nav {
    display: flex !important;
    padding: 12px 32px;
    gap: 8px;
  }

  #bottom-nav .nav-btn {
    flex: 1;
    max-width: 120px;
    padding: 10px 16px;
    border-radius: 16px;
  }

  #bottom-nav .nav-btn span {
    display: inline;
    font-size: 12px;
    margin-left: 8px;
  }

  /* Product Grid - 3 columns for tablet */
  .product-grid,
  .product-grid-mobile,
  #products-container,
  [class*="grid-cols-2"] {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px;
  }

  /* Product cards - larger for tablet touch */
  .product-card,
  .product-card-mobile {
    padding: 16px;
    border-radius: 20px;
    min-height: 140px;
  }

  .product-card h3,
  .product-card-mobile h3 {
    font-size: 1rem;
  }

  .product-card .price,
  .product-card-mobile .price {
    font-size: 1.125rem;
  }

  /* KPI Cards - 2x2 grid on tablets */
  .grid-cols-2.lg\\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px;
  }

  /* Dashboard cards */
  .bg-white.p-5.rounded-2xl,
  .dark\\:bg-gray-800.p-5.rounded-2xl {
    padding: 24px;
    border-radius: 24px;
  }

  /* Form inputs - larger touch targets */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="date"],
  select,
  textarea {
    min-height: 52px;
    font-size: 16px;
    padding: 14px 18px;
    border-radius: 14px;
  }

  /* Buttons - tablet optimized */
  button,
  .btn,
  a.btn {
    min-height: 52px;
    padding: 14px 24px;
    font-size: 15px;
    border-radius: 14px;
  }

  /* Quantity buttons */
  .qty-btn {
    min-width: 52px;
    min-height: 52px;
    font-size: 20px;
  }

  /* Modal dialogs - centered and sized for tablets */
  .modal-content,
  [class*="modal"] > div {
    max-width: 600px;
    margin: auto;
    border-radius: 24px;
    padding: 28px;
  }

  /* Tables - keep table format but improve spacing */
  .data-table thead {
    display: table-header-group;
  }

  .data-table tbody {
    display: table-row-group;
  }

  .data-table tbody tr {
    display: table-row;
    background: transparent;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0;
    box-shadow: none;
  }

  .data-table th,
  .data-table td {
    padding: 16px 20px;
    font-size: 14px;
  }

  /* Cart sidebar for tablets in landscape */
  #order-sidebar {
    width: 360px;
  }

  /* Billing page - split view */
  .billing-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
  }

  /* Report charts - larger */
  #daily-sales-chart,
  #hourly-sales-chart,
  #dashboard-sales-chart {
    min-height: 280px;
  }

  /* Category tabs - horizontal scroll */
  .category-tabs,
  .tabs-container {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-tabs::-webkit-scrollbar,
  .tabs-container::-webkit-scrollbar {
    display: none;
  }

  .category-tab,
  .tab-btn {
    flex-shrink: 0;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    white-space: nowrap;
  }

  /* Quick action buttons */
  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .quick-action-btn {
    padding: 20px;
    border-radius: 20px;
  }

  .quick-action-btn i {
    font-size: 2rem;
  }
}

/* Tablet Landscape Mode (1024px - 1366px) */
@media (min-width: 1024px) and (max-width: 1366px) {
  
  /* Show sidebar on large tablets */
  #sidebar {
    transform: translateX(0);
    width: 260px;
  }

  #main-content {
    margin-left: 260px;
    padding: 28px;
  }

  /* Hide bottom nav on large tablets */
  #bottom-nav {
    display: none !important;
  }

  /* Product Grid - 4 columns */
  .product-grid,
  .product-grid-mobile,
  #products-container {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px;
  }

  /* KPI Cards - 4 columns */
  .grid-cols-2.lg\\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  /* Cart sidebar visible */
  #order-sidebar {
    display: block !important;
    width: 400px;
    border-left: 1px solid #e5e7eb;
  }

  .dark #order-sidebar {
    border-left-color: #374151;
  }

  /* Main content with cart sidebar */
  #main-content.has-cart {
    margin-right: 400px;
  }

  /* Billing split layout */
  .billing-container {
    display: grid;
    grid-template-columns: 1fr 400px;
  }

  /* Reports layout */
  .reports-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

/* iPad Pro 12.9" and larger tablets */
@media (min-width: 1024px) and (max-width: 1400px) and (min-height: 1200px) {
  
  /* Extra large touch targets for big tablets */
  button,
  .btn {
    min-height: 56px;
    font-size: 16px;
  }

  .product-card,
  .product-card-mobile {
    padding: 20px;
    min-height: 160px;
  }

  /* Larger fonts for readability */
  body {
    font-size: 16px;
  }

  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.875rem; }
  h3 { font-size: 1.5rem; }

  /* KPI cards - more padding */
  .bg-white.p-5.rounded-2xl {
    padding: 28px;
  }
}

/* iPad Mini specific (744px - 768px width) */
@media (min-width: 744px) and (max-width: 768px) {
  
  /* Slightly smaller grid for iPad Mini */
  .product-grid,
  .product-grid-mobile {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px;
  }

  /* Compact bottom nav */
  #bottom-nav {
    padding: 10px 20px;
  }

  #bottom-nav .nav-btn {
    padding: 8px 12px;
  }
}

/* Tablet-specific touch optimizations */
@media (min-width: 768px) and (max-width: 1366px) and (hover: none) {
  
  /* Remove hover effects, use active states */
  .product-card:hover,
  .modern-card:hover,
  button:hover {
    transform: none;
    box-shadow: inherit;
  }

  .product-card:active,
  .modern-card:active,
  button:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  /* Larger ripple effect areas */
  .ripple-effect {
    overflow: hidden;
    position: relative;
  }

  /* Improve scrolling */
  .scrollable,
  .overflow-y-auto,
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Disable text selection on interactive elements */
  button,
  .btn,
  .nav-btn,
  .product-card,
  .category-tab {
    user-select: none;
    -webkit-user-select: none;
  }
}

/* iPad Split View / Slide Over support */
@media (min-width: 320px) and (max-width: 500px) and (min-height: 700px) {
  
  /* Compact mode for split view */
  .product-grid {
    grid-template-columns: repeat(1, 1fr) !important;
  }

  #bottom-nav {
    padding: 8px 12px;
  }

  .nav-btn span {
    display: none;
  }
}

/* Landscape orientation for tablets */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) {
  
  /* Reduce vertical padding in landscape */
  header {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  :root {
    --header-height: 56px;
  }

  /* Compact KPI cards in landscape */
  .bg-white.p-5.rounded-2xl {
    padding: 16px 20px;
  }

  /* Side-by-side layout for forms */
  .form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Charts - shorter height */
  #daily-sales-chart,
  #hourly-sales-chart {
    min-height: 200px;
    max-height: 250px;
  }
}

/* Portrait orientation for tablets */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  
  /* Taller cards in portrait */
  .product-card,
  .product-card-mobile {
    min-height: 160px;
  }

  /* More vertical space for content */
  #main-content {
    padding-top: 16px;
    padding-bottom: 100px;
  }

  /* Bottom nav with labels */
  #bottom-nav .nav-btn {
    flex-direction: column;
    gap: 4px;
  }

  #bottom-nav .nav-btn span {
    display: block;
    font-size: 10px;
  }

  #bottom-nav .nav-btn i {
    font-size: 20px;
  }
}

/* High DPI tablet displays */
@media (min-width: 768px) and (max-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) {
  
  /* Sharper borders */
  .border {
    border-width: 0.5px;
  }

  /* Optimized shadows for retina */
  .shadow-sm {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .shadow {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .shadow-lg {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  }
}

/* Tablet-specific component styles */
@media (min-width: 768px) and (max-width: 1366px) {
  
  /* Search bar */
  .search-bar-mobile,
  .search-bar {
    max-width: 400px;
    margin: 0 auto 20px;
  }

  /* Category pills - horizontal layout */
  .category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 16px;
  }

  .category-pill {
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
  }

  /* Cart items */
  .cart-item-mobile {
    padding: 18px;
    margin-bottom: 14px;
    border-radius: 18px;
  }

  /* Modal footer buttons */
  .modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
  }

  .modal-footer button {
    flex: 1;
    min-height: 52px;
  }

  /* Date pickers */
  input[type="date"] {
    min-width: 160px;
  }

  /* Tab navigation */
  .tab-navigation {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 16px;
    margin-bottom: 20px;
  }

  .dark .tab-navigation {
    background: #1f2937;
  }

  .tab-navigation button {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
  }

  .tab-navigation button.active {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .dark .tab-navigation button.active {
    background: #374151;
  }

  /* Reports page */
  .reports-summary-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Settings page */
  .settings-group {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
  }

  .dark .settings-group {
    background: #1f2937;
  }

  /* Inventory/Products table actions */
  .table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .table-actions button {
    min-width: 100px;
  }
}