/* ============================================================================
   MOBILE OPTIMIZATION CSS - Partzion Dashboard
   Mobile-first responsive design system
   Version: v20251206-19
   Last Updated: 2025-12-06
   ============================================================================ */

/* ============================================================================
   DESKTOP UTILITIES - Hide on desktop, show on mobile
   ============================================================================ */
@media (min-width: 769px) {
  .hide-on-desktop,
  .mobile-bottom-nav,
  .mobile-cart-drawer,
  .mobile-cart-overlay,
  .mobile-sidebar-overlay,
  .mobile-menu-btn {
    display: none !important;
  }
}

/* ============================================================================
   MOBILE VARIABLES & BASE STYLES
   ============================================================================ */
@media (max-width: 768px) {
  :root {
    /* Mobile-optimized spacing */
    --header-height: 56px;
    --mobile-bottom-nav-height: 60px;
    --mobile-touch-target: 44px;
    --mobile-panel-header: 48px;
    
    /* Adjusted spacing for mobile */
    --spacing-xs: 0.375rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.25rem;
    
    /* Font sizes optimized for mobile */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-md: 1.125rem;
    --font-size-lg: 1.25rem;
  }
  
  /* Touch-friendly scrolling */
  * {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Prevent text size adjustment on orientation change */
  html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  body {
    overflow-x: hidden;
    position: relative;
  }
}

/* ============================================================================
   MOBILE NAVIGATION - Hamburger Menu + Bottom Nav
   ============================================================================ */
@media (max-width: 768px) {
  /* Hide desktop sidebar */
  .dashboard-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    background: var(--card-bg);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 1rem;
  }
  
  .dashboard-sidebar.mobile-open {
    left: 0;
  }
  
  /* Mobile overlay for sidebar */
  .mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
  }
  
  .mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* Adjust app wrapper for mobile */
  .app-wrapper {
    grid-template-columns: 1fr;
    min-height: 100vh;
    padding-bottom: var(--mobile-bottom-nav-height);
  }
  
  /* Mobile top header */
  .app-header {
    height: var(--header-height);
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 998;
  }
  
  .app-header-left {
    flex: 0 0 auto;
  }
  
  /* Hamburger menu button */
  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    border-radius: 8px;
    transition: background 0.2s ease;
  }
  
  .mobile-menu-btn:active {
    background: rgba(102, 126, 234, 0.1);
  }
  
  .mobile-menu-btn i {
    font-size: 1.25rem;
  }
  
  /* Hide desktop change machine button on mobile */
  .btn-change-machine {
    display: none;
  }
  
  /* Mobile machine info - compact */
  .current-machine-info {
    display: none; /* Hide in top bar, show in bottom nav */
  }
  
  /* Bottom Navigation Bar */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-bottom-nav-height);
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.5rem 0.25rem;
    z-index: 997;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  }
  
  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    text-decoration: none;
    min-width: 0;
    position: relative;
  }
  
  .mobile-nav-item i {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
  }
  
  .mobile-nav-item span {
    font-size: 0.625rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  
  .mobile-nav-item.active {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
  }
  
  .mobile-nav-item.active i {
    transform: scale(1.1);
  }
  
  .mobile-nav-item:active {
    transform: scale(0.95);
  }
  
  /* Badge on nav items */
  .mobile-nav-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    min-width: 18px;
    height: 18px;
    padding: 0 0.25rem;
    background: var(--danger-color);
    color: white;
    border-radius: 10px;
    font-size: 0.625rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ============================================================================
   MOBILE DASHBOARD PAGE
   ============================================================================ */
@media (max-width: 768px) {
  .dashboard-main {
    padding: calc(var(--header-height) + 0.5rem) 0.5rem 0.5rem;
    margin-left: 0;
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Dashboard content wrapper full width */
  #dashboard-page .content-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
  }
  
  /* Dashboard header mobile - Simplified */
  .dashboard-header {
    display: none; /* Hide complex header on mobile */
  }
  
  /* Mobile welcome card */
  .mobile-welcome-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.25rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  }
  
  .mobile-welcome-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
  }
  
  .mobile-welcome-subtitle {
    font-size: 0.8125rem;
    opacity: 0.9;
  }
  
  /* Quick action buttons */
  .mobile-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .mobile-quick-action {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
  }
  
  .mobile-quick-action:active {
    transform: scale(0.97);
    background: rgba(102, 126, 234, 0.05);
  }
  
  .mobile-quick-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(102, 126, 234, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.25rem;
  }
  
  .mobile-quick-action-label {
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
  }
  
  /* KPI Cards - 2 Column Grid on mobile - Simplified */
  .kpi-cards {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    padding: 0;
    width: 100%;
  }
  
  .kpi-card {
    padding: 0.875rem;
    border-radius: 12px;
    background: white;
    border: 1px solid rgba(148, 163, 184, 0.15);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }
  
  .kpi-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  
  .kpi-icon i {
    font-size: 1.125rem;
  }
  
  .kpi-content {
    flex: 1;
    min-width: 0;
  }
  
  .kpi-content h3 {
    font-size: 1.375rem;
    margin-bottom: 0.125rem;
    font-weight: 700;
    line-height: 1.2;
  }
  
  .kpi-content p {
    font-size: 0.6875rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    line-height: 1.2;
  }
  
  .kpi-change {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
  }
  
  .kpi-change i {
    font-size: 0.5625rem;
  }
  
  /* Hide metric cards on mobile - too much clutter */
  .metric-cards {
    display: none;
  }
  
  /* Hide charts on mobile dashboard - focus on essentials */
  .chart-card {
    display: none;
  }
  
  /* Machines stats - 2 column grid */
  .machines-stats {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    padding: 0;
    width: 100%;
  }
  
  .stat-card {
    padding: 0.75rem;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .stat-icon {
    width: 36px;
    height: 36px;
  }
  
  .stat-icon i {
    font-size: 1rem;
  }
  
  .stat-content h3 {
    font-size: 1.375rem;
    margin-bottom: 0.125rem;
  }
  
  .stat-content p {
    font-size: 0.75rem;
  }
}

/* ============================================================================
   MOBILE SVG VIEWER - Priority Layout
   ============================================================================ */
@media (max-width: 768px) {
  /* SVG viewer container - full screen layout */
  .svg-viewer-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--mobile-bottom-nav-height));
    gap: 0;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: var(--mobile-bottom-nav-height);
    overflow: hidden;
  }
  
  /* Viewer content - SVG takes priority */
  .viewer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    min-height: 0;
    overflow: hidden;
    position: relative;
  }
  
  .content-header {
    height: 48px;
    padding: 0.5rem 0.75rem;
    flex-wrap: nowrap;
    gap: 0.5rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    position: relative;
  }
  
  .machine-name {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
  }
  
  .content-header .d-flex {
    gap: 0.375rem;
    flex-shrink: 0;
  }
  
  .control-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 0.875rem;
    pointer-events: auto;
  }
  
  /* SVG container - main focus area */
  .svg-container {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* SVG stage - fit to view */
  #svg-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* When part list is open, shift SVG up */
  #svg-stage.part-list-open {
    transform: translateY(-25vh);
  }
  
  #svg-stage svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
  }
  
  /* Touch-optimized zoom controls */
  .zoom-controls {
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1000;
    pointer-events: auto;
  }
  
  .zoom-controls .control-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
  }
  
  /* Part list panel - collapsible at bottom - Always visible on mobile */
  #part-list-panel {
    position: fixed;
    bottom: var(--mobile-bottom-nav-height);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    max-height: 50vh;
    height: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 950;
    display: flex;
    flex-direction: column;
    margin: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(calc(100% - var(--mobile-panel-header)));
  }
  
  /* Expanded state */
  #part-list-panel:not(.collapsed) {
    transform: translateY(0);
  }
  
  .part-list-header {
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--border-color);
    min-height: var(--mobile-panel-header);
    transition: background-color 0.2s ease;
  }
  
  .part-list-header:active {
    background: rgba(0, 0, 0, 0.05);
  }
  
  .part-list-header h6 {
    font-size: 0.875rem;
  }
  
  .part-list-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem;
  }
  
  /* Hide viewer sidebar on mobile - use floating panel */
  .viewer-sidebar {
    display: none;
  }
  
  /* Hide desktop cart completely on mobile */
  #viewer-page .viewer-sidebar,
  .unified-panel {
    display: none;
  }
  
  /* Hide desktop cart list area but NOT mobile cart list */
  #cart-list.cart-list-area {
    display: none !important;
  }
  
  /* Mobile Cart FAB - REMOVED: Now using bottom navigation cart button */
  
  /* Mobile cart drawer - Fixed height, minimal design */
  .mobile-cart-drawer {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    background: #f8fafc;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    height: 50vh;
    max-height: 450px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    display: none;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  }
  
  .mobile-cart-drawer.open {
    display: flex;
    transform: translateY(0);
  }
  
  .mobile-cart-drawer-handle {
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    margin: 0.5rem auto 0.375rem;
    flex-shrink: 0;
  }
  
  .mobile-cart-drawer .cart-header {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    background: #ffffff;
  }
  
  .mobile-cart-drawer .cart-header h6 {
    font-size: 0.875rem !important;
    margin: 0 !important;
    color: #1e293b !important;
  }
  
  .mobile-cart-drawer .cart-list-area {
    flex: 1 !important;
    display: block !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0.5rem !important;
    min-height: 0 !important;
    background: #f8fafc !important;
  }
  
  /* Cart overlay */
  .mobile-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
    pointer-events: none;
  }
  
  .mobile-cart-overlay.show {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  
  .mobile-cart-overlay.active {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

/* ============================================================================
   MOBILE MACHINES PAGE - Simplified & User-Friendly
   ============================================================================ */
@media (max-width: 768px) {
  /* Simplified header */
  .machines-header {
    padding: 0.75rem 0.5rem;
    gap: 0.5rem;
  }
  
  .machines-header-left h1 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
  }
  
  .machines-subtitle {
    font-size: 0.75rem;
  }
  
  .machines-header-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .machines-header-right .btn-modern {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
  
  .machines-header-right .btn-modern i {
    font-size: 0.875rem;
  }
  
  /* Section header simplified */
  .section-header-simple {
    padding: 0.75rem 0.5rem 0.5rem;
  }
  
  .section-title {
    font-size: 1rem;
    margin-bottom: 0.25rem;
  }
  
  .section-subtitle {
    font-size: 0.75rem;
  }
  
  /* Machine selection panels - Accordion style for mobile */
  .ms-panels-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0.5rem 0.5rem;
  }
  
  .ms-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  
  .ms-panel-header {
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    gap: 0.5rem;
  }
  
  .ms-panel-header::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
    flex-shrink: 0;
  }
  
  .ms-panel.expanded .ms-panel-header::after {
    transform: rotate(180deg);
  }
  
  .ms-panel.has-selection .ms-panel-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(102, 126, 234, 0.04) 100%);
  }
  
  .ms-panel.has-selection .ms-panel-title {
    color: var(--primary-color);
  }
  
  .ms-panel-header:active {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  }
  
  /* Selection indicator in header */
  .ms-panel-selection {
    font-size: 0.8125rem;
    color: var(--primary-color);
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .ms-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
  }
  
  .ms-panel-title i {
    font-size: 0.875rem;
    color: var(--primary-color);
  }
  
  .ms-panel-count {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
  }
  
  .ms-panel-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
  }
  
  .ms-panel.expanded .ms-panel-body {
    max-height: 450px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Smooth scroll behavior */
  .ms-panel-body {
    scroll-behavior: smooth;
  }
  
  .ms-panel-body::-webkit-scrollbar {
    width: 4px;
  }
  
  .ms-panel-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
  }
  
  /* Panel items - Touch-friendly */
  .ms-panel-item {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    min-height: 52px;
    background: white;
    gap: 0.75rem;
  }
  
  .ms-panel-item:last-child {
    border-bottom: none;
  }
  
  .ms-panel-item:active {
    background: rgba(102, 126, 234, 0.08);
    transform: scale(0.99);
  }
  
  .ms-panel-item.active {
    background: rgba(102, 126, 234, 0.15);
    border-left: 4px solid var(--primary-color);
  }
  
  .ms-panel-item.active .ms-item-title {
    color: var(--primary-color);
    font-weight: 600;
  }
  
  /* Item content structure */
  .ms-item-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
  }
  
  .ms-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  
  .ms-item-icon i {
    font-size: 0.875rem;
    color: var(--primary-color);
  }
  
  .ms-item-text {
    flex: 1;
    min-width: 0;
  }
  
  .ms-item-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 0.125rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .ms-item-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
  }
  
  .ms-item-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
  }
  
  .ms-panel-item.active .ms-item-arrow {
    color: var(--primary-color);
  }
  
  /* Legacy support */
  .ms-item {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
  }
  
  .ms-item:last-child {
    border-bottom: none;
  }
  
  .ms-item:active {
    background: rgba(102, 126, 234, 0.05);
  }
  
  .ms-item.selected {
    background: rgba(102, 126, 234, 0.1);
    border-left: 3px solid var(--primary-color);
    font-weight: 600;
  }
  
  .ms-item-name {
    font-size: 0.9375rem;
    color: var(--text-primary);
    flex: 1;
  }
  
  .ms-item-count {
    background: rgba(102, 126, 234, 0.15);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
  }
  
  .ms-item-icon {
    margin-left: 0.5rem;
    color: var(--primary-color);
    font-size: 0.875rem;
  }
  
  /* Empty state for panels - More friendly */
  .ms-panel-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
  }
  
  .ms-panel-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
    color: var(--primary-color);
  }
  
  .ms-panel-empty p {
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.5;
  }
  
  /* Loading state for panels */
  .ms-panel-loading {
    padding: 2rem 1rem;
    text-align: center;
  }
  
  .ms-panel-loading i {
    font-size: 1.5rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
  }
  
  .ms-panel-loading p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
  }
  
  @keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }
  
  /* Machine cards in results */
  .machines-container {
    padding: 0.5rem;
  }
  
  .machines-container.grid-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  /* Machine card - Compact mobile design */
  .machine-card,
  .machine-mgmt-card {
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  
  .machine-thumb,
  .machine-thumb-mgmt {
    width: 100%;
    height: 160px;
    object-fit: cover;
  }
  
  .machine-info,
  .machine-mgmt-info {
    padding: 0.875rem;
  }
  
  .machine-name,
  .machine-mgmt-name {
    font-size: 1rem;
    margin-bottom: 0.375rem;
  }
  
  .machine-model,
  .machine-mgmt-model {
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
  }
  
  .machine-actions,
  .machine-mgmt-actions {
    padding: 0.75rem;
    background: rgba(248, 250, 252, 0.8);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .machine-actions .btn,
  .machine-mgmt-actions .btn {
    flex: 1;
    min-width: calc(50% - 0.25rem);
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
  }
  
  /* Section separators */
  .mobile-section-divider {
    height: 8px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(248, 250, 252, 1) 100%);
    margin: 1rem 0;
  }
  
  /* Better scrolling for long lists */
  .ms-panels-container {
    padding-bottom: 1rem;
  }
  
  /* Search box in machines page */
  .search-box {
    width: 100%;
    margin-bottom: 0.75rem;
  }
  
  .search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 0.9375rem;
    border-radius: 12px;
  }
  
  .search-box i {
    left: 1rem;
    font-size: 0.9375rem;
  }
  
  /* Filter and sort buttons */
  .machines-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }
  
  .machines-filters::-webkit-scrollbar {
    display: none;
  }
  
  .filter-chip {
    padding: 0.5rem 0.875rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8125rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .filter-chip:active {
    transform: scale(0.97);
  }
  
  .filter-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
  }
  
  .filter-chip i {
    margin-right: 0.375rem;
    font-size: 0.75rem;
  }
}

/* ============================================================================
   MOBILE TABLES
   ============================================================================ */
@media (max-width: 768px) {
  .table-responsive {
    border: none;
    border-radius: 0;
  }
  
  /* Part List Table - Mobile Card Layout */
  .part-list-table {
    display: block;
    width: 100%;
  }
  
  /* Hide table header on mobile */
  .part-list-table thead {
    display: none !important;
  }
  
  .part-list-table tbody {
    display: block;
  }
  
  /* Convert rows to 2-row grid: text left, buttons right */
  .part-list-table tbody tr {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto !important;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.375rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    gap: 0.25rem 0.5rem !important;
    align-items: center !important;
  }
  
  /* All cells reset */
  .part-list-table tbody td {
    padding: 0 !important;
    border: none !important;
  }
  
  /* Hide description and label on mobile */
  .part-list-table .mobile-hide,
  .part-list-table .part-desc,
  .part-list-table .part-label {
    display: none !important;
  }
  
  /* Left column: Part code (row 1) */
  .part-list-table .part-code {
    grid-column: 1 !important;
    grid-row: 1 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #667eea !important;
    line-height: 1.2 !important;
    text-align: left !important;
  }
  
  /* Left column: Part name (row 2) */
  .part-list-table .part-name {
    grid-column: 1 !important;
    grid-row: 2 !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    line-height: 1.3 !important;
    text-align: left !important;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    line-clamp: 1;
    min-width: 0 !important;
  }
  
  /* Quantity column with stepper */
  .part-list-table .part-quantity {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding: 0 !important;
  }
  
  .part-list-table .qty-minus-btn,
  .part-list-table .qty-plus-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
  }
  
  .part-list-table .qty-minus-btn:active,
  .part-list-table .qty-plus-btn:active {
    background: #e2e8f0 !important;
    transform: scale(0.95) !important;
  }
  
  .part-list-table .part-quantity input[type="number"] {
    width: 44px !important;
    height: 28px !important;
    padding: 0 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    text-align: center !important;
    background: white !important;
  }
  
  /* Right column: Actions (second row only) */
  .part-list-table .part-actions {
    grid-column: 2 !important;
    grid-row: 2 !important;
    display: flex !important;
    gap: 0.375rem !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding: 0 !important;
    background: transparent !important;
  }
  
  /* Top row: Show button + Qty input (inline) */
  .part-list-table .btn-show-part {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: white !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    flex-shrink: 0 !important;
    order: 1 !important;
  }
  
  .part-list-table .btn-show-part i {
    font-size: 0.75rem !important;
    color: #667eea !important;
  }
  
  .part-list-table .part-actions input[type="number"] {
    width: 42px !important;
    height: 28px !important;
    padding: 0 !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    text-align: center !important;
    background: white !important;
    display: inline-flex !important;
    margin-left: 0.25rem !important;
    flex-shrink: 0 !important;
    order: 2 !important;
  }
  
  /* Add to cart button */
  .part-list-table .btn-add-cart {
    height: 28px !important;
    padding: 0 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
    background: #10b981 !important;
    border: 1px solid #10b981 !important;
    border-radius: 4px !important;
    color: white !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease !important;
  }
  
  .part-list-table .btn-add-cart:active {
    background: #059669 !important;
    transform: scale(0.97) !important;
  }
  
  .part-list-table .btn-add-cart i {
    font-size: 0.6875rem !important;
    color: white !important;
  }
  
  .part-list-table .btn-add-cart .btn-text {
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    color: white !important;
    letter-spacing: 0.01em;
  }
  
  /* Part list row hover/active states */
  .part-list-table tbody tr {
    transition: background-color 0.2s ease;
  }
  
  .part-list-table tbody tr:active {
    background-color: rgba(102, 126, 234, 0.05);
  }
  
  .part-list-table tbody tr.highlighted {
    background-color: rgba(102, 126, 234, 0.1) !important;
    border-left: 3px solid var(--primary-color);
  }
  
  /* Convert tables to cards on mobile */
  .professional-table {
    display: block;
  }
  
  .professional-table thead {
    display: none;
  }
  
  .professional-table tbody {
    display: block;
  }
  
  .professional-table tr {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
  }
  
  .professional-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
  }
  
  .professional-table td:last-child {
    border-bottom: none;
  }
  
  .professional-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  /* Action buttons in tables */
  .professional-table td .btn-group {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
  }
  
  .professional-table td .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }
}

/* ============================================================================
   MOBILE FORMS & MODALS
   ============================================================================ */
@media (max-width: 768px) {
  /* Modal adjustments */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  .modal-fullscreen-mobile {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
  }
  
  .modal-fullscreen-mobile .modal-content {
    height: 100%;
    border-radius: 0;
  }
  
  .modal-header {
    padding: 0.75rem 1rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-footer {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .modal-footer .btn {
    flex: 1;
    min-width: calc(50% - 0.25rem);
  }
  
  /* Form elements touch-friendly */
  .form-control,
  .form-select {
    min-height: var(--mobile-touch-target);
    font-size: 1rem; /* Prevent zoom on iOS */
    padding: 0.625rem 0.875rem;
  }
  
  .btn {
    min-height: var(--mobile-touch-target);
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
  }
  
  .btn-sm {
    min-height: 36px;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
  }
  
  /* Input groups */
  .input-group-login {
    margin-bottom: 1rem;
  }
  
  .input-group-login input {
    min-height: var(--mobile-touch-target);
    font-size: 1rem;
  }
}

/* ============================================================================
   MOBILE LOGIN PAGE
   ============================================================================ */
@media (max-width: 768px) {
  .login-overlay {
    padding: 1rem;
  }
  
  .login-box {
    width: 100%;
    max-width: 100%;
    padding: 1.5rem;
    border-radius: var(--border-radius-sm);
  }
  
  .login-logo img {
    height: 40px;
  }
  
  .login-title {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
  }
  
  .btn-login {
    min-height: var(--mobile-touch-target);
    font-size: 1rem;
  }
}

/* ============================================================================
   MOBILE ORDERS PAGE
   ============================================================================ */
@media (max-width: 768px) {
  /* Order cards */
  .order-card {
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
  }
  
  .order-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .order-id {
    font-size: 0.875rem;
  }
  
  .order-date {
    font-size: 0.75rem;
  }
  
  .order-body {
    padding: 0.75rem 0;
  }
  
  .order-items {
    gap: 0.5rem;
  }
  
  .order-item {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
  
  .order-footer {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  
  .order-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .order-actions button {
    flex: 1;
    min-width: calc(50% - 0.25rem);
  }
}

/* ============================================================================
   MOBILE CART ITEM STYLES
   ============================================================================ */
@media (max-width: 768px) {
  /* Mobile cart list area */
  #mobile-cart-list {
    padding: 0.5rem !important;
    overflow-y: auto !important;
    background: #f8fafc !important;
  }
  
  /* Mobile cart items - Optimal Okunabilir */
  #mobile-cart-drawer .cart-item,
  #mobile-cart-list .cart-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.6rem !important;
    padding: 0.7rem !important;
    margin-bottom: 0.45rem !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    transition: all 0.2s ease !important;
    position: relative !important;
  }
  
  #mobile-cart-drawer .cart-item::before,
  #mobile-cart-list .cart-item::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 2px !important;
    background: #667eea !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
  }
  
  #mobile-cart-drawer .cart-item:active,
  #mobile-cart-list .cart-item:active {
    background: #f8fafc !important;
  }
  
  #mobile-cart-drawer .cart-item:active::before,
  #mobile-cart-list .cart-item:active::before {
    opacity: 1 !important;
  }
  
  /* İçerik */
  #mobile-cart-drawer .cart-item-content,
  #mobile-cart-list .cart-item-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.4rem !important;
    min-width: 0 !important;
    flex: 1 !important;
  }
  
  #mobile-cart-drawer .cart-item-name,
  #mobile-cart-list .cart-item-name {
    display: block !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #1e293b !important;
    margin: 0 !important;
    padding: 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Detaylar */
  #mobile-cart-drawer .cart-item-details,
  #mobile-cart-list .cart-item-details {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.3rem !important;
    font-size: 0.7rem !important;
    color: #64748b !important;
    line-height: 1.3 !important;
  }
  
  #mobile-cart-drawer .cart-detail-badge,
  #mobile-cart-list .cart-detail-badge {
    display: inline-block !important;
    padding: 0.1rem 0.3rem !important;
    background: #f1f5f9 !important;
    border-radius: 3px !important;
    font-size: 0.55rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 200px !important;
  }
  
  #mobile-cart-drawer .cart-detail-badge.primary,
  #mobile-cart-list .cart-detail-badge.primary {
    background: rgba(102, 126, 234, 0.1) !important;
    color: #667eea !important;
    font-weight: 600 !important;
  }
  
  #mobile-cart-drawer .cart-item-machine-badge,
  #mobile-cart-list .cart-item-machine-badge {
    display: inline-block !important;
    font-size: 0.5rem !important;
    font-weight: 600 !important;
    color: #dc2626 !important;
    background: transparent !important;
    padding: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 120px !important;
  }
  
  /* Sağ Taraf Aksiyonlar */
  #mobile-cart-drawer .cart-item-actions,
  #mobile-cart-list .cart-item-actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 0.4rem !important;
    flex-shrink: 0 !important;
  }
  
  #mobile-cart-drawer .cart-qty-control,
  #mobile-cart-list .cart-qty-control {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    padding: 0.15rem 0.25rem !important;
  }
  
  #mobile-cart-drawer .cart-qty-btn,
  #mobile-cart-list .cart-qty-btn {
    width: 18px !important;
    height: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 3px !important;
    color: #64748b !important;
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    padding: 0 !important;
    font-family: Arial, sans-serif !important;
  }
  
  #mobile-cart-drawer .cart-qty-btn:active,
  #mobile-cart-list .cart-qty-btn:active {
    background: #667eea !important;
    border-color: #667eea !important;
    color: #ffffff !important;
    transform: scale(0.95) !important;
  }
  
  #mobile-cart-drawer .cart-qty-value,
  #mobile-cart-list .cart-qty-value {
    min-width: 18px !important;
    text-align: center !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #1e293b !important;
  }
  
  #mobile-cart-drawer .cart-item-delete,
  #mobile-cart-list .cart-item-delete {
    width: 22px !important;
    height: 22px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    border: 1px solid #fecaca !important;
    border-radius: 4px !important;
    color: #dc2626 !important;
    font-size: 1.1rem !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    padding: 0 !important;
    font-family: Arial, sans-serif !important;
  }
  
  #mobile-cart-drawer .cart-item-delete:active,
  #mobile-cart-list .cart-item-delete:active {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    transform: scale(0.95) !important;
  }
  
  #mobile-cart-drawer .cart-detail-badge,
  #mobile-cart-list .cart-detail-badge {
    display: inline-block !important;
    padding: 0.18rem 0.4rem !important;
    background: #f1f5f9 !important;
    border-radius: 3px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 200px !important;
  }
  
  #mobile-cart-drawer .cart-detail-badge.primary,
  #mobile-cart-list .cart-detail-badge.primary {
    background: rgba(102, 126, 234, 0.1) !important;
    color: #667eea !important;
    font-weight: 600 !important;
  }
  

  
  #mobile-cart-drawer .btn-remove-from-cart:active,
  #mobile-cart-list .btn-remove-from-cart:active {
    background: #ef4444 !important;
    color: white !important;
    border-color: #ef4444 !important;
  }
  
  /* Empty state mobile */
  .empty-state-compact {
    padding: 2rem 1rem !important;
    text-align: center !important;
  }
  
  .empty-state-compact .icon {
    font-size: 2.5rem !important;
    color: #cbd5e1 !important;
    margin-bottom: 0.5rem !important;
  }
  
  .empty-state-compact .text {
    font-size: 0.9375rem !important;
    color: #64748b !important;
  }
}

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

  /* ----------------------------------------------------------------------
     Cart Drawer Refresh (mobile)
     ---------------------------------------------------------------------- */
  .mobile-cart-overlay {
    background: rgba(8, 15, 30, 0.62);
    backdrop-filter: blur(6px);
  }

  .mobile-cart-drawer {
    background: linear-gradient(145deg, #0b132b 0%, #111a34 45%, #152040 100%);
    color: #e2e8f0;
    box-shadow: 0 -16px 38px rgba(0, 0, 0, 0.35);
    border-top: 1px solid rgba(226, 232, 240, 0.08);
  }

  .mobile-cart-drawer .cart-header {
    background: linear-gradient(135deg, rgba(77, 124, 254, 0.16), rgba(255, 107, 107, 0.12));
    border: 1px solid rgba(226, 232, 240, 0.16);
    border-radius: 12px;
    margin: 0 0.5rem 0.35rem;
    color: #f8fafc;
  }

  .mobile-cart-drawer .cart-list-area {
    background: transparent;
    max-height: 55vh;
    overscroll-behavior: contain;
    padding: 0.35rem 0.55rem 0.75rem !important;
  }

  #mobile-cart-drawer .cart-item,
  #mobile-cart-list .cart-item {
    border-color: rgba(226, 232, 240, 0.25) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(4px);
  }

  #mobile-cart-drawer .cart-item-name,
  #mobile-cart-list .cart-item-name {
    color: #1e293b !important;
  }

  #mobile-cart-drawer .cart-item-details,
  #mobile-cart-list .cart-item-details {
    color: #64748b !important;
  }

  #mobile-cart-drawer .cart-info-item,
  #mobile-cart-list .cart-info-item {
    color: #cbd5e1 !important;
  }

  #mobile-cart-drawer .qty-controls,
  #mobile-cart-list .qty-controls {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(226, 232, 240, 0.28) !important;
  }

  #mobile-cart-drawer .qty-btn,
  #mobile-cart-list .qty-btn {
    background: transparent !important;
    color: #e2e8f0 !important;
  }

  #mobile-cart-drawer .qty-btn:hover,
  #mobile-cart-list .qty-btn:hover {
    background: linear-gradient(135deg, #4d7cfe, #6ea8ff) !important;
    color: #fff !important;
  }

  #mobile-cart-drawer .qty-input,
  #mobile-cart-list .qty-input {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #f8fafc !important;
    border-color: rgba(226, 232, 240, 0.25) !important;
  }

  #mobile-cart-drawer .btn-show-in-svg,
  #mobile-cart-list .btn-show-in-svg {
    background: rgba(77, 124, 254, 0.18) !important;
    border-color: rgba(77, 124, 254, 0.55) !important;
    color: #dbeafe !important;
  }

  #mobile-cart-drawer .btn-remove-from-cart,
  #mobile-cart-list .btn-remove-from-cart {
    background: rgba(255, 107, 107, 0.14) !important;
    border-color: rgba(255, 107, 107, 0.55) !important;
    color: #fee2e2 !important;
  }

  #mobile-cart-drawer .btn-remove-from-cart:active,
  #mobile-cart-list .btn-remove-from-cart:active {
    background: linear-gradient(135deg, #ff6b6b, #ff8f70) !important;
    color: #fff !important;
  }

  .empty-state-compact {
    color: #cbd5e1 !important;
  }

  .empty-state-compact .icon {
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.22), rgba(255,255,255,0.04));
    color: #e2e8f0 !important;
  }
  
  /* Show only on mobile */
  .show-mobile {
    display: block !important;
  }
  
  .show-mobile-flex {
    display: flex !important;
  }
  
  .show-mobile-inline {
    display: inline !important;
  }
  
  /* Mobile padding utilities */
  .mobile-p-0 { padding: 0 !important; }
  .mobile-p-1 { padding: 0.5rem !important; }
  .mobile-p-2 { padding: 0.75rem !important; }
  .mobile-p-3 { padding: 1rem !important; }
  
  .mobile-px-0 { padding-left: 0 !important; padding-right: 0 !important; }
  .mobile-px-1 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
  .mobile-px-2 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
  
  .mobile-py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
  .mobile-py-1 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
  .mobile-py-2 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
  
  /* Mobile margin utilities */
  .mobile-m-0 { margin: 0 !important; }
  .mobile-m-1 { margin: 0.5rem !important; }
  .mobile-m-2 { margin: 0.75rem !important; }
  
  .mobile-mb-0 { margin-bottom: 0 !important; }
  .mobile-mb-1 { margin-bottom: 0.5rem !important; }
  .mobile-mb-2 { margin-bottom: 0.75rem !important; }
  .mobile-mb-3 { margin-bottom: 1rem !important; }
  
  /* Mobile text utilities */
  .mobile-text-center { text-align: center !important; }
  .mobile-text-left { text-align: left !important; }
  .mobile-text-right { text-align: right !important; }
  
  /* Mobile flex utilities */
  .mobile-flex-column { flex-direction: column !important; }
  .mobile-flex-wrap { flex-wrap: wrap !important; }
  .mobile-justify-center { justify-content: center !important; }
  .mobile-align-stretch { align-items: stretch !important; }
}

/* ============================================================================
   LANDSCAPE MODE OPTIMIZATIONS
   ============================================================================ */
@media (max-width: 768px) and (orientation: landscape) {
  :root {
    --header-height: 48px;
    --mobile-bottom-nav-height: 52px;
    --mobile-fab-size: 48px;
  }
  
  .svg-viewer-container {
    height: calc(100vh - var(--header-height) - var(--mobile-bottom-nav-height));
  }
  
  .part-list-panel {
    max-height: 60vh;
  }
  
  .mobile-cart-drawer {
    max-height: 70vh;
  }
}

/* ============================================================================
   VERY SMALL SCREENS (<375px)
   ============================================================================ */
@media (max-width: 374px) {
  :root {
    --font-size-xs: 0.6875rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
  }
  
  .mobile-bottom-nav {
    padding: 0.375rem 0;
  }
  
  .mobile-nav-item span {
    font-size: 0.5625rem;
  }
  
  .mobile-nav-item i {
    font-size: 1.125rem;
  }
  
  .control-btn {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
  
  .zoom-controls .control-btn {
    width: 40px;
    height: 40px;
  }
}
