/**
 * Arcade Maintenance Log - Mobile Optimized CSS
 * Target: Devices with max-width: 1023px
 * 
 * Key Improvements:
 * 1. Tables → Cards transformation
 * 2. Touch-friendly targets (44x44px minimum)
 * 3. Proper typography (16px minimum for inputs)
 * 4. Collapsible sections
 * 5. Bottom navigation optimization
 * 6. Full-screen modals
 * 7. Form optimization
 * 8. Performance-focused selectors
 */

/* ============================================
   MOBILE BREAKPOINT - All rules below 1023px
   ============================================ */
@media (max-width: 1023px) {
  
  /* ==========================================
     1. BASE MOBILE LAYOUT
     ========================================== */
  
  html {
    /* Prevent font-size boosting on mobile */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Smooth scrolling */
    scroll-behavior: smooth;
  }
  
  body {
    /* Prevent overscroll bounce */
    overscroll-behavior-y: contain;
    /* Ensure proper padding for fixed elements */
    padding-top: 0px;
    padding-bottom: 80px;
    /* Improve text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  /* Hide desktop FAB on mobile */
  .fab-button,
  [data-fab="true"],
  .floating-action-button {
    display: none !important;
  }
  
  /* Make desktop sidebar/3-column layout single column */
  .desktop-columns,
  .three-column-layout,
  .main-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    padding: 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Hide desktop-only sidebar */
  .sidebar,
  .desktop-sidebar,
  [data-desktop-only="true"] {
    display: none !important;
  }
  
  /* ==========================================
     2. TABLE TO CARD TRANSFORMATION
     ========================================== */
  
  /* Hide table headers on mobile */
  table thead,
  table th,
  .table-header {
    display: none !important;
  }
  
  /* Transform table structure */
  table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: none !important;
    background: transparent !important;
  }
  
  table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 0 !important;
  }
  
  table tr {
    display: block !important;
    /* Card styling */
    background: var(--card, #ffffff);
    border: 1px solid var(--border, #e5e7eb) !important;
    border-radius: 0.75rem !important;
    padding: 1rem !important;
    margin: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    position: relative !important;
  }
  
  /* Dark mode card styling */
  .dark table tr {
    background: var(--card, #1f2937);
    border-color: var(--border, #374151) !important;
  }
  
  table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    padding: 0.5rem 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.05)) !important;
    width: 100% !important;
    min-height: 44px !important;
  }
  
  table td:last-child {
    border-bottom: none !important;
  }
  
  /* Add label prefix for each cell */
  table td::before {
    content: attr(data-label) !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    color: var(--foreground, #374151) !important;
    margin-right: 0.75rem !important;
    flex-shrink: 0 !important;
    min-width: 80px !important;
  }
  
  /* Alternative: Use aria-label or title as fallback */
  table td[data-label=""]::before,
  table td:not([data-label])::before {
    content: attr(aria-label) !important;
  }
  
  /* Cell content styling */
  table td .cell-content,
  table td > span:not(.sr-only),
  table td > div {
    text-align: right !important;
    flex: 1 !important;
    font-size: 0.9375rem !important;
    word-break: break-word !important;
  }
  
  /* Action buttons in cards */
  table td .actions,
  table td .action-buttons {
    display: flex !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
  }
  
  /* Status badges in cards */
  table td .status-badge,
  table td .badge {
    display: inline-flex !important;
    align-items: center !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 9999px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    min-height: 28px !important;
  }
  
  /* ==========================================
     3. TOUCH-FRIENDLY TARGETS (44x44px min)
     ========================================== */
  
  /* Buttons */
  button,
  .btn,
  [role="button"],
  input[type="submit"],
  input[type="reset"],
  input[type="button"] {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0.75rem 1rem !important;
    font-size: 1rem !important;
    /* Prevent double-tap zoom */
    touch-action: manipulation;
  }
  
  /* Icon-only buttons */
  button.icon-only,
  button[aria-label]:not(:empty),
  .btn-icon,
  .icon-btn {
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Links */
  a,
  [role="link"] {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 0.5rem 0.25rem !important;
  }
  
  /* Navigation links */
  nav a,
  .nav-link,
  .menu-item {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }
  
  /* Form inputs */
  input,
  select,
  textarea {
    min-height: 44px !important;
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    padding: 0.75rem 1rem !important;
  }
  
  /* Checkboxes and radios */
  input[type="checkbox"],
  input[type="radio"] {
    min-width: 24px !important;
    min-height: 24px !important;
    width: 24px !important;
    height: 24px !important;
  }
  
  /* Custom checkbox/radio containers */
  .checkbox-wrapper,
  .radio-wrapper,
  label:has(input[type="checkbox"]),
  label:has(input[type="radio"]) {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.5rem 0 !important;
  }
  
  /* Dropdown items */
  .dropdown-item,
  .menu-item,
  [role="menuitem"],
  [role="option"] {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    display: flex !important;
    align-items: center !important;
  }
  
  /* ==========================================
     4. TYPOGRAPHY IMPROVEMENTS
     ========================================== */
  
  /* Base font size */
  body {
    font-size: 16px !important;
    line-height: 1.5 !important;
  }
  
  /* Headings - slightly smaller on mobile */
  h1 { font-size: 1.75rem !important; }
  h2 { font-size: 1rem !important; }
  h3 { font-size: 1.25rem !important; }
  h4 { font-size: 1.125rem !important; }
  h5 { font-size: 1rem !important; }
  h6 { font-size: 0.9375rem !important; }
  
  /* Prevent text truncation */
  .truncate,
  .text-truncate {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }
  
  /* Improve readability */
  p, li, dd, dt {
    line-height: 1.6 !important;
    max-width: 100% !important;
  }
  
  /* ==========================================
     5. COLLAPSIBLE SECTIONS
     ========================================== */
  
  /* Section containers */
  .section,
  .collapsible-section,
  .card-section {
    border: 1px solid var(--border, #e5e7eb) !important;
    border-radius: 0.75rem !important;
    margin-bottom: 0.75rem !important;
    overflow: hidden !important;
  }
  
  /* Section headers - clickable */
  .section-header,
  .section-title,
  .collapsible-trigger {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 48px !important;
    padding: 0.75rem 1rem !important;
    background: var(--muted, #f3f4f6) !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    transition: background-color 0.2s ease !important;
  }
  
  .dark .section-header,
  .dark .section-title,
  .dark .collapsible-trigger {
    background: var(--muted, #374151) !important;
  }
  
  /* Active/pressed state */
  .section-header:active,
  .section-title:active,
  .collapsible-trigger:active {
    background: var(--accent, #e5e7eb) !important;
  }
  
  .dark .section-header:active,
  .dark .section-title:active,
  .dark .collapsible-trigger:active {
    background: var(--accent, #4b5563) !important;
  }
  
  /* Expand/collapse indicator */
  .section-header::after,
  .section-title::after,
  .collapsible-trigger::after {
    content: "" !important;
    display: inline-block !important;
    width: 12px !important;
    height: 12px !important;
    border-right: 2px solid currentColor !important;
    border-bottom: 2px solid currentColor !important;
    transform: rotate(-45deg) !important;
    transition: transform 0.2s ease !important;
    flex-shrink: 0 !important;
  }
  
  /* Expanded state indicator */
  .section.expanded .section-header::after,
  .section.expanded .section-title::after,
  [data-state="open"] .collapsible-trigger::after {
    transform: rotate(45deg) !important;
  }
  
  /* Collapsible content */
  .section-content,
  .collapsible-content {
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.3s ease-out !important;
    padding: 0 1rem !important;
  }
  
  /* Expanded content */
  .section.expanded .section-content,
  [data-state="open"] .collapsible-content {
    max-height: 2000px !important; /* Arbitrary large value */
    padding: 1rem !important;
  }
  
  /* Default collapsed on mobile */
  .section:not(.expanded) .section-content,
  .collapsible-section:not(.expanded) .section-content,
  [data-default-collapsed="true"] .collapsible-content {
    max-height: 0 !important;
  }
  
  /* ==========================================
     6. BOTTOM NAVIGATION / ACTION BAR
     ========================================== */
  
  /* Fixed bottom bar */
  .bottom-action-bar,
  .mobile-action-bar,
  .bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--card, #ffffff) !important;
    border-top: 1px solid var(--border, #e5e7eb) !important;
    padding: 0.5rem 0.75rem !important;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    gap: 0.5rem !important;
    z-index: 50 !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
    min-height: 60px !important;
  }
  
  .dark .bottom-action-bar,
  .dark .mobile-action-bar,
  .dark .bottom-nav {
    background: var(--card, #1f2937) !important;
    border-top-color: var(--border, #374151) !important;
  }
  
  /* Bottom bar buttons */
  .bottom-action-bar button,
  .bottom-action-bar .btn,
  .mobile-action-bar button,
  .bottom-nav button {
    flex: 1 !important;
    min-height: 48px !important;
    min-width: 0 !important;
    border-radius: 0.5rem !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
  }
  
  /* Primary action button */
  .bottom-action-bar .btn-primary,
  .mobile-action-bar .btn-primary {
    background: var(--primary, #3b82f6) !important;
    color: var(--primary-foreground, #ffffff) !important;
    min-height: 52px !important;
  }
  
  /* Icon buttons in bottom bar */
  .bottom-action-bar .btn-icon-only,
  .mobile-action-bar .btn-icon-only {
    flex: 0 0 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border-radius: 50% !important;
  }
  
  /* ==========================================
     7. MODAL IMPROVEMENTS (Full-screen friendly)
     ========================================== */
  
  /* Modal overlay */
  .modal-overlay,
  [role="dialog"],
  [data-dialog],
  .dialog-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 100 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: flex-end !important; /* Start from bottom */
    justify-content: center !important;
    padding: 0 !important;
  }
  
  /* Centered modals (alternative) */
  .modal-overlay.centered,
  [role="dialog"].centered {
    align-items: center !important;
    padding: 1rem !important;
  }
  
  /* Modal content container */
  .modal-content,
  .dialog-content,
  [role="dialog"] > div {
    background: var(--card, #ffffff) !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 1rem 1rem 0 0 !important; /* Rounded top only */
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    animation: slideUp 0.3s ease-out !important;
  }
  
  .dark .modal-content,
  .dark .dialog-content {
    background: var(--card, #1f2937) !important;
  }
  
  /* Centered modal styling */
  .modal-overlay.centered .modal-content,
  [role="dialog"].centered .dialog-content {
    border-radius: 1rem !important;
    max-width: calc(100% - 2rem) !important;
    max-height: calc(100vh - 2rem) !important;
  }
  
  /* Modal animation */
  @keyframes slideUp {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  /* Modal header */
  .modal-header,
  .dialog-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 1rem !important;
    border-bottom: 1px solid var(--border, #e5e7eb) !important;
    min-height: 56px !important;
    position: sticky !important;
    top: 0 !important;
    background: inherit !important;
    z-index: 1 !important;
  }
  
  .dark .modal-header,
  .dark .dialog-header {
    border-bottom-color: var(--border, #374151) !important;
  }
  
  /* Modal title */
  .modal-title,
  .dialog-title {
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
  }
  
  /* Close button */
  .modal-close,
  .dialog-close {
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  
  /* Modal body */
  .modal-body,
  .dialog-body {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 1rem !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Modal footer */
  .modal-footer,
  .dialog-footer {
    display: flex !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
    border-top: 1px solid var(--border, #e5e7eb) !important;
    position: sticky !important;
    bottom: 0 !important;
    background: inherit !important;
  }
  
  .dark .modal-footer,
  .dark .dialog-footer {
    border-top-color: var(--border, #374151) !important;
  }
  
  /* Footer buttons - full width stack */
  .modal-footer .btn,
  .dialog-footer button {
    flex: 1 !important;
    min-height: 48px !important;
  }
  
  /* Stacked footer buttons for multiple actions */
  .modal-footer.stacked,
  .dialog-footer.stacked {
    flex-direction: column !important;
  }
  
  /* ==========================================
     8. FORM OPTIMIZATION
     ========================================== */
  
  /* Form container */
  form,
  .form-container {
    padding: 0.25rem !important;
  }
  
  /* Form groups */
  .form-group,
  .form-field {
    margin-bottom: 1rem !important;
  }
  
  /* Labels */
  label,
  .form-label {
    display: block !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    margin-bottom: 0.5rem !important;
    color: var(--foreground, #1f2937) !important;
  }
  
  /* Input fields */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  select,
  textarea {
    width: 100% !important;
    font-size: 16px !important; /* Critical: prevents iOS zoom */
    min-height: 48px !important;
    padding: 0.75rem 1rem !important;
    border: 1px solid var(--input, #d1d5db) !important;
    border-radius: 0.5rem !important;
    background: var(--background, #ffffff) !important;
    color: var(--foreground, #1f2937) !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }
  
  .dark input,
  .dark select,
  .dark textarea {
    background: var(--background, #111827) !important;
    border-color: var(--input, #374151) !important;
    color: var(--foreground, #f9fafb) !important;
  }
  
  /* Textarea specific */
  textarea {
    min-height: 120px !important;
    resize: vertical !important;
    line-height: 1.5 !important;
  }
  
  /* Select dropdown styling */
  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    background-size: 16px !important;
    padding-right: 2.5rem !important;
  }
  
  /* Placeholder styling */
  input::placeholder,
  textarea::placeholder {
    color: var(--muted-foreground, #9ca3af) !important;
    opacity: 1 !important;
  }
  
  /* Focus states */
  input:focus,
  select:focus,
  textarea:focus {
    outline: none !important;
    border-color: var(--primary, #3b82f6) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
  }
  
  /* Error states */
  input:invalid,
  input.error,
  select.error,
  textarea.error,
  .form-field.error input,
  .form-field.has-error input {
    border-color: var(--destructive, #ef4444) !important;
  }
  
  .form-error,
  .error-message {
    color: var(--destructive, #ef4444) !important;
    font-size: 0.875rem !important;
    margin-top: 0.25rem !important;
    display: block !important;
  }
  
  /* Form grid - stack on mobile */
  .form-grid,
  .form-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }
  
  /* ==========================================
     9. STICKY HEADER
     ========================================== */
  
  .sticky-header,
  header.sticky,
  .header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 40 !important;
    background: var(--card, #ffffff) !important;
    border-bottom: 1px solid var(--border, #e5e7eb) !important;
    padding: 0.5rem 0.75rem !important;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px)) !important;
    min-height: 56px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  
  .dark .sticky-header,
  .dark header.sticky,
  .dark .header {
    background: var(--card, #1f2937) !important;
    border-bottom-color: var(--border, #374151) !important;
  }
  
  /* Header title */
  .header-title {
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 60% !important;
  }
  
  /* Header actions */
  .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
  }
  
  /* Dropdown menu in header */
  .header-dropdown,
  .header-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0.5rem !important;
    min-width: 200px !important;
    background: var(--card, #ffffff) !important;
    border: 1px solid var(--border, #e5e7eb) !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
    z-index: 50 !important;
  }
  
  .dark .header-dropdown,
  .dark .header-menu {
    background: var(--card, #1f2937) !important;
    border-color: var(--border, #374151) !important;
  }
  
  /* ==========================================
     10. UTILITY CLASSES
     ========================================== */
  
  /* Hide on mobile */
  .hide-mobile,
  .desktop-only {
    display: none !important;
  }
  
  /* Show on mobile */
  .mobile-only {
    display: block !important;
  }
  
  /* Full width on mobile */
  .mobile-full-width {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Stack horizontally */
  .mobile-stack {
    flex-direction: column !important;
  }
  
  /* No horizontal scroll */
  .no-scroll-x {
    overflow-x: hidden !important;
  }
  
  /* Safe area padding */
  .safe-area-top {
    padding-top: env(safe-area-inset-top, 0px) !important;
  }
  
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }
  
  /* ==========================================
     11. SPECIFIC COMPONENT STYLES
     ========================================== */
  
  /* Down Games Section */
  .down-games-section,
  .games-down-list {
    padding: 0.75rem !important;
  }
  
  .game-card {
    background: var(--card, #ffffff) !important;
    border: 1px solid var(--border, #e5e7eb) !important;
    border-radius: 0.75rem !important;
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  .dark .game-card {
    background: var(--card, #1f2937) !important;
    border-color: var(--border, #374151) !important;
  }
  
  .game-card-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    margin-bottom: 0.5rem !important;
  }
  
  .game-name {
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
  }
  
  .game-status {
    display: inline-flex !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 9999px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
  }
  
  .game-status.down {
    background: #fee2e2 !important;
    color: #dc2626 !important;
  }
  
  .game-status.partial {
    background: #fef3c7 !important;
    color: #d97706 !important;
  }
  
  .dark .game-status.down {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
  }
  
  .dark .game-status.partial {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
  }
  
  /* Tech Log Section */
  .tech-log-section,
  .maintenance-log {
    padding: 0.75rem !important;
  }
  
  .log-entry {
    background: var(--card, #ffffff) !important;
    border: 1px solid var(--border, #e5e7eb) !important;
    border-radius: 0.75rem !important;
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  .dark .log-entry {
    background: var(--card, #1f2937) !important;
    border-color: var(--border, #374151) !important;
  }
  
  .log-entry-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.875rem !important;
    color: var(--muted-foreground, #6b7280) !important;
  }
  
  .log-entry-content {
    font-size: 0.9375rem !important;
    line-height: 1.5 !important;
  }
  
  /* Parts Section */
  .parts-section,
  .parts-list {
    padding: 0.75rem !important;
  }
  
  .part-card {
    background: var(--card, #ffffff) !important;
    border: 1px solid var(--border, #e5e7eb) !important;
    border-radius: 0.75rem !important;
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  
  .dark .part-card {
    background: var(--card, #1f2937) !important;
    border-color: var(--border, #374151) !important;
  }
  
  .part-name {
    font-weight: 600 !important;
    font-size: 1rem !important;
  }
  
  .part-details {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    gap: 0.25rem 0.75rem !important;
    font-size: 0.875rem !important;
  }
  
  .part-label {
    color: var(--muted-foreground, #6b7280) !important;
  }
  
  .part-quantity {
    font-weight: 500 !important;
  }
  
  /* ==========================================
     12. PERFORMANCE OPTIMIZATIONS
     ========================================== */
  
  /* Reduce animations for better performance */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
  
  /* GPU acceleration for animations */
  .modal-content,
  .bottom-action-bar,
  .modal-overlay {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  
  /* Optimize scrolling */
  .scroll-container,
  [data-scroll],
  .modal-body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* Contain layout for better performance */
  .card,
  .section,
  .form-group,
  .log-entry,
  .game-card,
  .part-card {
    contain: layout style;
  }
  
  /* ==========================================
     13. DARK MODE SPECIFIC MOBILE STYLES
     ========================================== */
  
  .dark {
    /* Reduce contrast on mobile for OLED */
    --background: oklch(0.12 0 0);
    --card: oklch(0.17 0 0);
  }
  
  /* Dim brightness in dark mode */
  .dark img,
  .dark video {
    filter: brightness(0.9);
  }
  
  /* Better dark mode borders */
  .dark input,
  .dark select,
  .dark textarea {
    border-color: rgba(255, 255, 255, 0.1) !important;
  }
  
  .dark input:focus,
  .dark select:focus,
  .dark textarea:focus {
    border-color: var(--primary, #60a5fa) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2) !important;
  }
}

/* ============================================
   EXTRA SMALL SCREENS (max-width: 375px)
   ============================================ */
@media (max-width: 375px) {
  body {
    padding-top: 56px !important;
    padding-bottom: 70px !important;
  }
  
  /* Smaller headers */
  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.25rem !important; }
  h3 { font-size: 1.125rem !important; }
  
  /* More compact cards */
  table tr,
  .game-card,
  .log-entry,
  .part-card {
    padding: 0.75rem !important;
  }
  
  /* Smaller bottom bar */
  .bottom-action-bar {
    padding: 0.375rem 0.5rem !important;
    min-height: 56px !important;
  }
  
  .bottom-action-bar button {
    min-height: 44px !important;
    font-size: 0.8125rem !important;
  }
}

/* ============================================
   LANDSCAPE MODE ADJUSTMENTS
   ============================================ */
@media (max-width: 1023px) and (orientation: landscape) {
  body {
    padding-top: 0px !important;
    padding-bottom: 60px !important;
  }
  
  .sticky-header {
    min-height: 48px !important;
  }
  
  .bottom-action-bar {
    min-height: 52px !important;
  }
  
  /* Reduce vertical spacing in landscape */
  table tbody {
    gap: 0.5rem !important;
  }
  
  .section-content,
  .modal-body {
    padding: 0.75rem !important;
  }
}

/* ============================================
   PRINT STYLES (for reports)
   ============================================ */
@media print {
  .bottom-action-bar,
  .sticky-header,
  .fab-button,
  button,
  .btn {
    display: none !important;
  }
  
  body {
    padding: 0 !important;
  }
  
  .section-content {
    max-height: none !important;
  }
}
