/**
 * AUVANO MOBILE RESPONSIVE STYLES
 * Comprehensive mobile optimization for all pages
 * Version: 2.0 - Dark Luxury Edition
 */

/* ========== TABLES PAGE MOBILE ========== */
@media (max-width: 768px) {
  .floor-area {
    grid-template-columns: 1fr !important;
    gap: var(--space-md) !important;
  }
  
  .floor-canvas {
    min-height: 400px !important;
    order: 2;
  }
  
  .details-panel {
    order: 1;
    max-height: 300px;
  }
  
  .table-tile {
    min-height: 100px !important;
    width: 120px !important;
    padding: 1rem 0.75rem !important;
  }
  
  .table-label {
    font-size: 1rem !important;
  }
  
  .actions {
    grid-template-columns: 1fr !important;
  }
  
  /* Edit Mode Toggle - Mobile Friendly */
  .gold-switch {
    width: 48px;
    height: 26px;
  }
  
  .gold-switch .slider:before {
    height: 18px;
    width: 18px;
  }
  
  .gold-switch input:checked + .slider:before {
    transform: translateX(22px);
  }
}

/* ========== ORDER PAGE MOBILE ========== */
@media (max-width: 768px) {
  .order-layout {
    grid-template-columns: 1fr !important;
    gap: var(--space-md) !important;
    height: auto !important;
  }
  
  .menu-section {
    order: 2;
    height: auto !important;
    max-height: 600px;
  }
  
  .cart-section {
    order: 1;
    height: auto !important;
    min-height: 300px;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  
  .menu-items-grid {
    grid-template-columns: 1fr !important;
  }
  
  .menu-item-card {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: var(--space-md);
  }
  
  .menu-item-image {
    height: 100px;
  }
  
  .cart-totals {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding: var(--space-md);
    margin: 0 calc(-1 * var(--space-md));
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 480px) {
  .menu-item-card {
    grid-template-columns: 1fr;
  }
  
  .menu-item-image {
    width: 100%;
    height: 120px;
  }
}

/* ========== MENU MANAGEMENT PAGE MOBILE ========== */
@media (max-width: 768px) {
  .menu-layout {
    grid-template-columns: 1fr !important;
    gap: var(--space-md) !important;
  }
  
  .category-sidebar {
    height: auto !important;
    max-height: 200px;
    order: 1;
  }
  
  .items-container {
    order: 2;
    height: auto !important;
    max-height: calc(100vh - 400px);
  }
  
  .items-grid {
    grid-template-columns: 1fr !important;
  }
  
  .menu-item-card {
    padding: var(--space-md) !important;
  }
  
  .item-actions {
    flex-direction: column;
    gap: var(--space-sm);
  }
  
  .item-actions button {
    width: 100%;
  }
}

/* ========== KDS (KITCHEN DISPLAY) MOBILE ========== */
@media (max-width: 768px) {
  .kds-grid {
    grid-template-columns: 1fr !important;
  }
  
  .order-ticket {
    max-height: none;
  }
  
  .ticket-header {
    flex-wrap: wrap;
  }
  
  .ticket-actions {
    width: 100%;
    margin-top: var(--space-sm);
  }
}

/* ========== CUSTOMERS PAGE MOBILE ========== */
@media (max-width: 768px) {
  .customer-grid {
    grid-template-columns: 1fr !important;
  }
  
  .customer-card {
    padding: var(--space-md) !important;
  }
  
  .customer-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ========== AI MANAGER PAGE MOBILE ========== */
@media (max-width: 768px) {
  .ai-layout {
    grid-template-columns: 1fr !important;
  }
  
  .ai-panel {
    height: auto !important;
    max-height: 500px;
  }
  
  .suggestion-card {
    padding: var(--space-md) !important;
  }
}

/* ========== SCHEDULE PAGE MOBILE ========== */
@media (max-width: 768px) {
  .schedule-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .schedule-table {
    min-width: 600px;
  }
  
  .shift-card {
    min-width: 120px;
  }
}

/* ========== SHIFTS PAGE MOBILE ========== */
@media (max-width: 768px) {
  .workforce-grid {
    grid-template-columns: 1fr !important;
  }
  
  .employee-grid {
    grid-template-columns: 1fr !important;
  }
  
  .employee-card {
    padding: var(--space-md) !important;
  }
  
  .timeclock-panel {
    padding: var(--space-md) !important;
  }
}

/* ========== APPROVALS PAGE MOBILE ========== */
@media (max-width: 768px) {
  .approval-grid {
    grid-template-columns: 1fr !important;
  }
  
  .approval-card {
    padding: var(--space-md) !important;
  }
  
  .approval-actions {
    flex-direction: column;
    gap: var(--space-sm);
  }
  
  .approval-actions button {
    width: 100%;
  }
}

/* ========== SETTINGS PAGE MOBILE ========== */
@media (max-width: 768px) {
  .settings-layout {
    grid-template-columns: 1fr !important;
  }
  
  .settings-nav {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: var(--space-sm);
    padding-bottom: var(--space-sm);
  }
  
  .settings-nav-item {
    white-space: nowrap;
    min-width: fit-content;
  }
  
  .settings-content {
    padding: var(--space-md) !important;
  }
}

/* ========== LOGIN/SIGNUP PAGES MOBILE ========== */
@media (max-width: 768px) {
  .login-card {
    padding: 2rem 1.5rem !important;
    max-width: 100% !important;
    margin: 1rem !important;
  }
  
  .brand-text {
    font-size: 2rem !important;
  }
  
  .auvano-logo img {
    width: 80px !important;
  }
  
  .links-row {
    flex-direction: column;
    gap: 1rem !important;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 1.5rem 1rem !important;
    margin: 0.5rem !important;
  }
  
  .brand-text {
    font-size: 1.75rem !important;
  }
  
  h1 {
    font-size: 1.25rem !important;
  }
}

/* ========== CUSTOMER PORTAL MOBILE ========== */
@media (max-width: 768px) {
  .customer-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: var(--space-md);
  }
  
  .restaurant-card {
    padding: var(--space-md) !important;
  }
  
  .menu-category-grid {
    grid-template-columns: 1fr !important;
  }
  
  .order-summary {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: var(--space-md);
    border-top: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }
}

/* ========== RESPONSIVE UTILITIES ========== */

/* Hide on Mobile */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Show only on Mobile */
.show-mobile {
  display: none !important;
}

@media (max-width: 768px) {
  .show-mobile {
    display: block !important;
  }
  
  .show-mobile-flex {
    display: flex !important;
  }
  
  .show-mobile-grid {
    display: grid !important;
  }
}

/* Responsive Text Sizes */
@media (max-width: 768px) {
  .text-responsive {
    font-size: 0.9rem !important;
  }
  
  .text-responsive-sm {
    font-size: 0.8rem !important;
  }
  
  .text-responsive-lg {
    font-size: 1.1rem !important;
  }
}

/* Responsive Spacing */
@media (max-width: 768px) {
  .p-responsive {
    padding: var(--space-md) !important;
  }
  
  .p-responsive-sm {
    padding: var(--space-sm) !important;
  }
  
  .m-responsive {
    margin: var(--space-md) !important;
  }
  
  .m-responsive-sm {
    margin: var(--space-sm) !important;
  }
}

/* Touch-Friendly Elements */
@media (max-width: 768px) {
  .touch-target {
    min-height: 44px;
    min-width: 44px;
  }
  
  button,
  .btn,
  a.btn,
  input[type="button"],
  input[type="submit"] {
    min-height: 44px;
  }
  
  /* Larger tap targets for icons/buttons */
  .icon-btn {
    padding: 12px;
  }
}

/* Responsive Grid Utilities */
@media (max-width: 768px) {
  .grid-mobile-1 {
    grid-template-columns: 1fr !important;
  }
  
  .grid-mobile-2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .flex-mobile-col {
    flex-direction: column !important;
  }
  
  .flex-mobile-wrap {
    flex-wrap: wrap !important;
  }
}

/* Responsive Overflow Handling */
@media (max-width: 768px) {
  .overflow-mobile-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .overflow-mobile-hidden {
    overflow: hidden;
  }
}

/* Bottom Action Bar for Mobile */
@media (max-width: 768px) {
  .mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: var(--space-md);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    gap: var(--space-sm);
  }
  
  .mobile-action-bar button {
    flex: 1;
  }
}

/* Sticky Headers on Mobile */
@media (max-width: 768px) {
  .mobile-sticky-header {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  }
}

/* Collapsible Sections on Mobile */
@media (max-width: 768px) {
  .collapsible-mobile {
    max-height: 200px;
    overflow: hidden;
    transition: max-height var(--transition-slow);
  }
  
  .collapsible-mobile.expanded {
    max-height: 2000px;
  }
}

/* Safe Area Insets for Notched Devices */
@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 768px) {
    .top-bar {
      padding-top: max(var(--space-md), env(safe-area-inset-top));
    }
    
    .mobile-action-bar {
      padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
    }
    
    .sidebar {
      padding-top: max(var(--space-md), env(safe-area-inset-top));
    }
  }
}
