/**
 * 📱 Rechnung.best - Mobile-First Responsive Design
 * 
 * Vollständig responsive, mobile-optimierte CSS-Architektur
 * mit Progressive Web App (PWA) Support und Touch-Optimierung.
 * 
 * VERSION: 1.0.0
 * ARCHITEKTUR: Mobile-First (min-width breakpoints)
 * SUPPORT: iOS Safari 12+, Chrome 70+, Firefox 65+, Samsung Internet 8+
 */

/* ===== CSS CUSTOM PROPERTIES (CSS Variables) ===== */
:root {
  /* Branding Colors */
  --primary: #0071e3;
  --primary-dark: #0056b3;
  --primary-light: #66b3ff;
  --secondary: #6b7280;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  /* Text Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f3f4f6;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  
  /* Border & Shadow */
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  
  /* Spacing (8px base grid) */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  
  /* Typography Scale */
  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  
  /* Border Radius */
  --radius-sm: 0.25rem;  /* 4px */
  --radius-md: 0.375rem; /* 6px */
  --radius-lg: 0.5rem;   /* 8px */
  --radius-xl: 0.75rem;  /* 12px */
  
  /* Z-Index Layers */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 9999;
  
  /* Mobile-specific */
  --mobile-nav-height: 60px;
  --mobile-fab-size: 56px;
  --mobile-bottom-nav-height: 72px;
  --touch-target: 44px; /* Apple/Google Touch Target Guidelines */
  
  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-normal: 300ms ease-out;
  --transition-slow: 500ms ease-out;
}

/* ===== RESET & BASE (Mobile-First) ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Prevent zoom on iOS when rotating */
  -webkit-text-size-adjust: 100%;
  /* Smooth scrolling for anchor links */
  scroll-behavior: smooth;
  /* Font size based on system preferences */
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', 'Segoe UI', 
               Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: var(--text-base);
  
  /* Mobile-specific optimizations */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  
  /* Prevent bounce scrolling on iOS */
  overscroll-behavior: none;
  
  /* Ensure full height on mobile */
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* Fix for 100vh on mobile browsers */
.full-height {
  height: 100vh;
  height: -webkit-fill-available;
}

/* ===== MOBILE-FIRST LAYOUT CONTAINER ===== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  position: relative;
  overflow-x: hidden;
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  z-index: var(--z-fixed);
  
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  
  /* Glass effect */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.mobile-header-center {
  flex: 1;
  text-align: center;
}

.mobile-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.mobile-header-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== MOBILE NAVIGATION TOGGLE ===== */
.mobile-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  background: none;
  border: none;
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  
  /* Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-nav-toggle:hover,
.mobile-nav-toggle:focus {
  background-color: var(--bg-tertiary);
}

.mobile-nav-toggle:active {
  transform: scale(0.95);
}

/* Hamburger Icon Animation */
.mobile-nav-icon {
  position: relative;
  width: 24px;
  height: 18px;
}

.mobile-nav-icon span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 1px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: all var(--transition-fast);
}

.mobile-nav-icon span:nth-child(1) { top: 0; }
.mobile-nav-icon span:nth-child(2) { top: 8px; }
.mobile-nav-icon span:nth-child(3) { top: 16px; }

/* Active hamburger animation */
.mobile-nav-toggle.active .mobile-nav-icon span:nth-child(1) {
  top: 8px;
  transform: rotate(135deg);
}

.mobile-nav-toggle.active .mobile-nav-icon span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.mobile-nav-toggle.active .mobile-nav-icon span:nth-child(3) {
  top: 8px;
  transform: rotate(-135deg);
}

/* ===== MOBILE SIDEBAR NAVIGATION ===== */
.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: -webkit-fill-available;
  z-index: var(--z-modal);
  
  /* Initially hidden */
  transform: translateX(-100%);
  visibility: hidden;
  opacity: 0;
  
  transition: transform var(--transition-normal),
              opacity var(--transition-normal),
              visibility var(--transition-normal);
}

.mobile-sidebar.active {
  transform: translateX(0);
  visibility: visible;
  opacity: 1;
}

.mobile-sidebar-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.mobile-sidebar-content {
  position: relative;
  width: min(85vw, 320px);
  height: 100%;
  background: var(--bg-primary);
  box-shadow: var(--shadow-lg);
  
  display: flex;
  flex-direction: column;
}

.mobile-sidebar-header {
  padding: var(--space-6) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.mobile-sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.mobile-sidebar-logo img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
}

.mobile-sidebar-logo-text {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.mobile-sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}

.mobile-sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-weight: 600;
  font-size: var(--text-sm);
}

.mobile-sidebar-user-info h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.mobile-sidebar-user-info p {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* ===== MOBILE NAVIGATION MENU ===== */
.mobile-nav-menu {
  flex: 1;
  padding: var(--space-4) 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-section {
  margin-bottom: var(--space-6);
}

.mobile-nav-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-4);
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 500;
  
  /* Touch optimization */
  min-height: var(--touch-target);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  
  transition: background-color var(--transition-fast);
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
  background-color: var(--bg-secondary);
}

.mobile-nav-item:active {
  background-color: var(--bg-tertiary);
}

.mobile-nav-item.active {
  background-color: var(--primary);
  color: var(--text-inverse);
}

.mobile-nav-item.active .mobile-nav-icon {
  color: var(--text-inverse);
}

.mobile-nav-item-icon {
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.mobile-nav-item-text {
  flex: 1;
}

.mobile-nav-item-badge {
  background: var(--danger);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
  flex: 1;
  margin-top: var(--mobile-nav-height);
  padding: var(--space-4);
  margin-bottom: var(--mobile-bottom-nav-height);
  
  /* Ensure proper scrolling */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== MOBILE BOTTOM NAVIGATION ===== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-bottom-nav-height);
  background: var(--bg-primary);
  border-top: 1px solid var(--border-light);
  z-index: var(--z-fixed);
  
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: var(--space-2) 0;
  
  /* Glass effect */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  
  /* Safe area for iPhone X+ */
  padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
}

.mobile-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 500;
  min-width: var(--touch-target);
  
  /* Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  
  transition: color var(--transition-fast);
}

.mobile-bottom-nav-item:hover,
.mobile-bottom-nav-item:focus {
  color: var(--primary);
}

.mobile-bottom-nav-item.active {
  color: var(--primary);
}

.mobile-bottom-nav-item-icon {
  width: 24px;
  height: 24px;
}

.mobile-bottom-nav-item-text {
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* ===== FLOATING ACTION BUTTON (FAB) ===== */
.mobile-fab {
  position: fixed;
  bottom: calc(var(--mobile-bottom-nav-height) + var(--space-4));
  right: var(--space-4);
  width: var(--mobile-fab-size);
  height: var(--mobile-fab-size);
  
  background: var(--primary);
  color: var(--text-inverse);
  border: none;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  cursor: pointer;
  z-index: var(--z-fixed);
  
  /* Touch optimization */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast);
}

.mobile-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 20px -5px rgba(0, 113, 227, 0.4);
}

.mobile-fab:active {
  transform: scale(0.95);
}

.mobile-fab-icon {
  width: 24px;
  height: 24px;
}

/* ===== RESPONSIVE GRID SYSTEM ===== */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 calc(-1 * var(--space-2));
}

.col {
  flex: 1;
  padding: 0 var(--space-2);
  margin-bottom: var(--space-4);
}

/* Grid columns for mobile */
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }

/* ===== MOBILE-OPTIMIZED CARDS ===== */
.mobile-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: var(--space-4);
  overflow: hidden;
  
  /* Touch feedback */
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast);
}

.mobile-card:active {
  transform: scale(0.98);
}

.mobile-card-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.mobile-card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.mobile-card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.mobile-card-content {
  padding: var(--space-4);
}

.mobile-card-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

/* ===== MOBILE BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-target);
  
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  
  /* Touch optimization */
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  
  transition: all var(--transition-fast);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

.btn-success {
  background: var(--success);
  color: var(--text-inverse);
  border-color: var(--success);
}

.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
  border-color: var(--danger);
}

/* Button sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  min-height: 52px;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* ===== MOBILE FORMS ===== */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-control {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-target);
  
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  
  /* Touch optimization */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Small tablets: 576px and up */
@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
  
  .mobile-sidebar-content {
    width: min(75vw, 360px);
  }
  
  /* Show more nav items on tablets */
  .mobile-bottom-nav {
    justify-content: space-evenly;
  }
}

/* Medium tablets: 768px and up */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
  
  .main-content {
    padding: var(--space-6);
  }
  
  /* Tablet-specific grid */
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  
  /* Hide mobile elements on tablets */
  .mobile-fab {
    bottom: var(--space-6);
    right: var(--space-6);
  }
}

/* Large tablets/Small desktops: 992px and up */
@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
  
  /* Desktop-like layout starts here */
  .mobile-header {
    position: relative;
    height: auto;
    padding: var(--space-4) var(--space-6);
  }
  
  .main-content {
    margin-top: 0;
    margin-bottom: 0;
    padding: var(--space-8);
  }
  
  /* Hide mobile navigation on desktop */
  .mobile-bottom-nav {
    display: none;
  }
  
  .mobile-fab {
    display: none;
  }
  
  /* Desktop grid */
  .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
  .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
  .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
  .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Extra large desktops: 1200px and up */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
  
  /* Desktop sidebar layout */
  .app-container {
    flex-direction: row;
  }
  
  .mobile-sidebar {
    position: relative;
    transform: none;
    visibility: visible;
    opacity: 1;
    width: 280px;
    height: 100vh;
    z-index: auto;
  }
  
  .mobile-sidebar-content {
    width: 100%;
    box-shadow: none;
    border-right: 1px solid var(--border-light);
  }
  
  .mobile-sidebar-backdrop {
    display: none;
  }
  
  .main-content {
    flex: 1;
    margin-left: 0;
  }
  
  /* Hide mobile header elements */
  .mobile-nav-toggle {
    display: none;
  }
}

/* ===== MOBILE-SPECIFIC UTILITIES ===== */

/* Safe area support for iPhone X+ */
@supports (padding: max(0px)) {
  .mobile-header {
    padding-top: max(var(--space-4), env(safe-area-inset-top));
  }
  
  .mobile-sidebar-content {
    padding-top: env(safe-area-inset-top);
  }
  
  .mobile-bottom-nav {
    padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
  }
}

/* Hide scrollbars on mobile */
@media (max-width: 767px) {
  .mobile-nav-menu::-webkit-scrollbar,
  .main-content::-webkit-scrollbar {
    display: none;
  }
  
  .mobile-nav-menu,
  .main-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-light: #000000;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  }
}

/* Reduced motion support */
@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;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --bg-primary: #18181b;
    --bg-secondary: #27272a;
    --bg-tertiary: #3f3f46;
    --border-light: #3f3f46;
    --border-medium: #52525b;
  }
}

/* Print styles */
@media print {
  .mobile-header,
  .mobile-sidebar,
  .mobile-bottom-nav,
  .mobile-fab {
    display: none !important;
  }
  
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* Focus styles */
.mobile-nav-toggle:focus,
.mobile-nav-item:focus,
.mobile-bottom-nav-item:focus,
.btn:focus,
.form-control:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip navigation link */
.skip-nav {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: var(--text-inverse);
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: var(--z-tooltip);
}

.skip-nav:focus {
  top: 6px;
}

/* ===== MOBILE APP SPECIFIC COMPONENTS ===== */

/* Loading Spinner */
.mobile-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-loader-content {
  background: var(--bg-primary);
  padding: var(--space-8);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 280px;
}

.mobile-loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-4);
}

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

/* Toast Notifications */
.mobile-toast {
  position: fixed;
  top: calc(var(--mobile-nav-height) + var(--space-4));
  left: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-inverse);
  
  animation: slideInDown 0.3s ease-out;
}

.mobile-toast-success {
  background: var(--success);
}

.mobile-toast-error {
  background: var(--danger);
}

@keyframes slideInDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Camera Interface */
.camera-interface {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: var(--z-modal);
  
  display: flex;
  flex-direction: column;
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  z-index: var(--z-modal);
}

.camera-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
}

#cameraVideo {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-6);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  text-align: center;
}

.camera-tip {
  font-size: var(--text-sm);
  opacity: 0.8;
}

/* OCR Result Modal */
.ocr-result-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.ocr-result-content {
  background: var(--bg-primary);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 100%;
}

.ocr-result-content h4 {
  margin: 0 0 var(--space-4) 0;
  color: var(--success);
  font-size: var(--text-xl);
}

.ocr-details p {
  margin: var(--space-2) 0;
  font-size: var(--text-sm);
}

.ocr-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.ocr-actions .btn {
  flex: 1;
}

/* FAB Action Menu */
.fab-action-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-modal);
}

.fab-action-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
}

.fab-actions {
  position: absolute;
  bottom: calc(var(--mobile-bottom-nav-height) + var(--mobile-fab-size) + var(--space-8));
  right: var(--space-4);
  
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: flex-end;
}

.fab-action-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  
  transform: scale(0.8);
  opacity: 0;
  animation: fabActionSlideIn 0.2s ease-out forwards;
}

.fab-action-item:nth-child(1) { animation-delay: 0.1s; }
.fab-action-item:nth-child(2) { animation-delay: 0.2s; }
.fab-action-item:nth-child(3) { animation-delay: 0.3s; }
.fab-action-item:nth-child(4) { animation-delay: 0.4s; }

@keyframes fabActionSlideIn {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.fab-action-item:hover {
  background: var(--bg-secondary);
}

.fab-action-item i {
  width: 20px;
  text-align: center;
  color: var(--primary);
}

/* Offline Indicator */
.offline-indicator {
  position: fixed;
  top: calc(var(--mobile-nav-height) + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  
  background: var(--warning);
  color: var(--text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  font-weight: 600;
  
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* PWA Install Button */
.pwa-install-btn {
  position: fixed;
  bottom: calc(var(--mobile-bottom-nav-height) + var(--space-4));
  left: var(--space-4);
  z-index: var(--z-fixed);
  
  background: var(--primary);
  color: var(--text-inverse);
  border: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-md);
  
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

/* Data Display Components */
.stat-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.stat-card-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.stat-card-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Action Lists */
.action-list {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.action-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: var(--text-primary);
  transition: background-color var(--transition-fast);
}

.action-list-item:last-child {
  border-bottom: none;
}

.action-list-item:hover,
.action-list-item:active {
  background: var(--bg-secondary);
}

.action-list-icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
  flex-shrink: 0;
}

.action-list-content {
  flex: 1;
}

.action-list-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 2px;
}

.action-list-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.action-list-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: right;
}

/* Quick Stats Grid */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.section-action {
  font-size: var(--text-sm);
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.section-action:hover {
  text-decoration: underline;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* GPU acceleration for smooth animations */
.mobile-sidebar,
.mobile-nav-toggle,
.mobile-fab,
.btn,
.mobile-loader,
.camera-interface,
.fab-action-menu {
  will-change: transform;
}

/* Contain layout shifts */
.mobile-card,
.stat-card,
.action-list {
  contain: layout style paint;
}

/* Optimize font loading */
.mobile-header-title,
.mobile-nav-item-text,
.stat-card-value {
  font-display: swap;
}