/**
 * mobile.css - Mobile-spezifische Optimierungen
 * DRK Stadtverband Haltern am See e.V.
 * Zusätzliche mobile Optimierungen für Smartphones und Tablets
 */

/* ========================================
   Mobile-spezifische Variablen
   ======================================== */

:root {
    /* Mobile Touch Targets */
    --mobile-touch-min: 48px;
    --mobile-padding: 16px;
    --mobile-margin: 12px;
    
    /* Mobile Typography */
    --mobile-font-small: 14px;
    --mobile-font-base: 16px;
    --mobile-font-large: 18px;
    --mobile-line-height: 1.5;
    
    /* Mobile Spacing */
    --mobile-gap-xs: 4px;
    --mobile-gap-sm: 8px;
    --mobile-gap-md: 12px;
    --mobile-gap-lg: 16px;
    --mobile-gap-xl: 24px;
    
    /* Mobile Borders */
    --mobile-border-radius: 12px;
    --mobile-border-width: 2px;
    
    /* Mobile Shadows */
    --mobile-shadow-card: 0 2px 8px rgba(0,0,0,0.12);
    --mobile-shadow-button: 0 4px 12px rgba(220, 20, 60, 0.3);
    --mobile-shadow-modal: 0 8px 32px rgba(0,0,0,0.24);
}

/* ========================================
   Mobile Viewport Fixes
   ======================================== */

/* Fix für iOS Safari 100vh Problem */
.mobile-viewport-fix {
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Prevent zoom on input focus (iOS Safari) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
select,
textarea {
    font-size: 16px !important;
    transform-origin: left top;
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ========================================
   Mobile Touch Optimierungen
   ======================================== */

/* Vergrößerte Touch-Targets für mobile Geräte */
@media (max-width: 768px) {
    .btn {
        min-height: var(--mobile-touch-min);
        padding: 14px 20px;
        font-size: var(--mobile-font-base);
    }
    
    .btn-small {
        min-height: 40px;
        padding: 10px 16px;
        font-size: var(--mobile-font-small);
    }
    
    .btn-large {
        min-height: 56px;
        padding: 18px 24px;
        font-size: var(--mobile-font-large);
    }
    
    /* Touch-optimierte Navigation */
    .nav-menu a {
        min-height: var(--mobile-touch-min);
        padding: 16px 20px;
        font-size: var(--mobile-font-base);
    }
    
    /* Touch-optimierte Form-Elemente */
    .form-input,
    .form-select,
    .form-textarea {
        min-height: var(--mobile-touch-min);
        padding: 14px 16px;
        font-size: var(--mobile-font-base);
    }
    
    /* Touch-optimierte Touch-Items */
    .touch-item {
        min-height: var(--mobile-touch-min);
        padding: 16px;
    }
    
    /* Touch-optimierte Status-Buttons */
    .status-btn {
        min-height: var(--mobile-touch-min);
        padding: 14px 12px;
        font-size: var(--mobile-font-base);
        font-weight: 600;
    }
}

/* ========================================
   Mobile Navigation Verbesserungen
   ======================================== */

/* Mobile Header Optimierungen */
@media (max-width: 768px) {
    .mobile-header {
        height: 60px;
        padding: 0 var(--mobile-padding);
    }
    
    .menu-toggle {
        width: var(--mobile-touch-min);
        height: var(--mobile-touch-min);
    }
    
    .dark-mode-toggle {
        width: var(--mobile-touch-min);
        height: var(--mobile-touch-min);
    }
    
    .header-title {
        font-size: var(--mobile-font-large);
        font-weight: 700;
    }
    
    /* Sidebar Optimierungen */
    .sidebar {
        width: min(300px, 85vw);
    }
    
    .sidebar-header {
        padding: 24px 20px;
    }
    
    .logo-text {
        font-size: 15px;
        font-weight: 700;
        line-height: 1.3;
    }
    
    .user-info {
        padding: 20px;
    }
    
    .user-name {
        font-size: var(--mobile-font-large);
        font-weight: 700;
    }
    
    .user-role {
        font-size: var(--mobile-font-base);
        margin-top: 4px;
    }
}

/* ========================================
   Mobile Card Optimierungen
   ======================================== */

@media (max-width: 768px) {
    .card {
        border-radius: var(--mobile-border-radius);
        box-shadow: var(--mobile-shadow-card);
        margin-bottom: 20px;
    }
    
    .card-header {
        padding: 20px var(--mobile-padding);
    }
    
    .card-title {
        font-size: 20px;
        font-weight: 700;
    }
    
    .card-body {
        padding: 24px var(--mobile-padding);
    }
    
    .card-footer {
        padding: var(--mobile-padding) var(--mobile-padding);
    }
    
    /* Fahrzeug-Cards Mobile */
    .vehicle-card {
        border-radius: var(--mobile-border-radius);
        box-shadow: var(--mobile-shadow-card);
        margin-bottom: 20px;
    }
    
    .vehicle-header {
        padding: 20px var(--mobile-padding);
    }
    
    .vehicle-title {
        font-size: 20px;
        font-weight: 700;
    }
    
    .vehicle-info {
        padding: 20px var(--mobile-padding);
    }
    
    .last-inspection {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--mobile-gap-sm);
    }
    
    .inspection-date,
    .inspector-name {
        font-size: var(--mobile-font-base);
    }
}

/* ========================================
   Mobile Form Optimierungen
   ======================================== */

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 24px;
    }
    
    .form-label {
        font-size: var(--mobile-font-base);
        font-weight: 600;
        margin-bottom: var(--mobile-gap-md);
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        border-radius: var(--mobile-gap-md);
        border-width: var(--mobile-border-width);
        font-size: var(--mobile-font-base);
        line-height: var(--mobile-line-height);
    }
    
    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        box-shadow: 0 0 0 4px rgba(220, 20, 60, 0.15);
    }
    
    .form-error {
        font-size: var(--mobile-font-base);
        margin-top: var(--mobile-gap-sm);
        font-weight: 500;
    }
    
    .form-help {
        font-size: var(--mobile-font-small);
        margin-top: var(--mobile-gap-sm);
    }
    
    /* Checkbox und Radio Mobile */
    .checkbox-label,
    .radio-label {
        min-height: var(--mobile-touch-min);
        gap: var(--mobile-gap-md);
        font-size: var(--mobile-font-base);
    }
    
    .checkbox-label input[type="checkbox"],
    .radio-label input[type="radio"] {
        width: 20px;
        height: 20px;
    }
}

/* ========================================
   Mobile Layout Optimierungen
   ======================================== */

@media (max-width: 768px) {
    .container,
    .container-fluid {
        padding: var(--mobile-padding);
    }
    
    .page-header {
        margin-bottom: 24px;
        padding-bottom: var(--mobile-padding);
    }
    
    .page-header h1 {
        font-size: 28px;
        font-weight: 700;
        margin-bottom: var(--mobile-gap-sm);
    }
    
    .page-header p {
        font-size: var(--mobile-font-base);
    }
    
    /* Grids Mobile */
    .row {
        margin: -var(--mobile-gap-sm);
    }
    
    .col {
        padding: var(--mobile-gap-sm);
    }
    
    .col-12,
    .col-6,
    .col-4,
    .col-3 {
        width: 100%;
        padding: var(--mobile-gap-sm);
    }
    
    /* Dashboard Grid Mobile */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Management Grids Mobile */
    .vehicles-management-grid,
    .containers-grid,
    .compartments-grid,
    .products-grid,
    .users-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ========================================
   Mobile Inspection Interface
   ======================================== */

@media (max-width: 768px) {
    .inspection-container {
        padding-top: 0;
    }
    
    .inspection-progress {
        padding: var(--mobile-padding);
        top: 60px;
    }
    
    .progress-bar {
        height: 10px;
        border-radius: 5px;
        margin-bottom: var(--mobile-gap-md);
    }
    
    .progress-text {
        font-size: var(--mobile-font-base);
        font-weight: 600;
    }
    
    .compartment-card {
        border-radius: 0;
        margin-bottom: 0;
        box-shadow: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .compartment-header {
        padding: 20px var(--mobile-padding);
        top: 60px;
        gap: var(--mobile-gap-md);
    }
    
    .compartment-name {
        font-size: var(--mobile-font-large);
        font-weight: 700;
    }
    
    .product-item {
        padding: 24px var(--mobile-padding);
        border-left-width: 4px;
    }
    
    .product-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--mobile-gap-md);
        margin-bottom: var(--mobile-gap-lg);
    }
    
    .product-details h4 {
        font-size: var(--mobile-font-large);
        font-weight: 600;
        margin-bottom: var(--mobile-gap-sm);
    }
    
    .product-meta {
        font-size: var(--mobile-font-base);
        line-height: var(--mobile-line-height);
    }
    
    /* Product Actions Mobile - Vertical Layout */
    .product-actions {
        grid-template-columns: 1fr;
        gap: var(--mobile-gap-md);
        margin-top: 20px;
    }
    
    .status-btn {
        border-radius: var(--mobile-gap-md);
        border-width: var(--mobile-border-width);
        font-weight: 600;
        transition: all 0.2s ease;
    }
    
    .status-btn:active {
        transform: scale(0.98);
    }
    
    .date-input-group {
        margin-top: 20px;
        padding: 20px;
        border-radius: var(--mobile-gap-md);
    }
    
    .date-input {
        padding: 16px;
        border-radius: var(--mobile-gap-md);
        border-width: var(--mobile-border-width);
        font-size: var(--mobile-font-base);
    }
    
    /* Navigation Controls Mobile */
    .navigation-controls {
        padding: 20px var(--mobile-padding);
        gap: var(--mobile-gap-md);
    }
    
    .nav-btn {
        padding: 18px;
        border-radius: var(--mobile-gap-md);
        font-size: var(--mobile-font-base);
        font-weight: 700;
        min-height: 56px;
        gap: var(--mobile-gap-sm);
    }
    
    .nav-btn:active {
        transform: scale(0.98);
    }
}

/* ========================================
   Mobile Modal Optimierungen
   ======================================== */

@media (max-width: 768px) {
    .modal {
        padding: 20px;
        align-items: flex-end;
    }
    
    .modal-content {
        border-radius: var(--mobile-border-radius) var(--mobile-border-radius) 0 0;
        padding: 32px 24px 24px;
        max-width: none;
        width: 100%;
        max-height: 85vh;
        box-shadow: var(--mobile-shadow-modal);
        animation: slideUpMobile 0.3s ease;
    }
    
    .modal-content h3 {
        font-size: 24px;
        font-weight: 700;
        margin-bottom: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: var(--mobile-gap-md);
        margin-top: 24px;
    }
    
    .modal-actions .btn {
        width: 100%;
        min-height: 52px;
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* ========================================
   Mobile Toast Optimierungen
   ======================================== */

@media (max-width: 768px) {
    .toast-container {
        top: 80px;
        left: var(--mobile-padding);
        right: var(--mobile-padding);
        max-width: none;
    }
    
    .toast {
        padding: 20px;
        border-radius: var(--mobile-gap-md);
        font-size: var(--mobile-font-base);
        line-height: var(--mobile-line-height);
        margin-bottom: var(--mobile-gap-md);
    }
}

/* ========================================
   Mobile Management Interface
   ======================================== */

@media (max-width: 768px) {
    .management-tabs {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 2px;
    }
    
    .management-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-btn {
        flex-shrink: 0;
        padding: 16px 20px;
        font-size: var(--mobile-font-base);
        font-weight: 600;
        min-width: 120px;
    }
    
    .management-section {
        margin-bottom: 32px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--mobile-gap-lg);
        margin-bottom: 24px;
    }
    
    .section-header h2 {
        font-size: 24px;
        font-weight: 700;
    }
    
    .management-card {
        border-radius: var(--mobile-border-radius);
        box-shadow: var(--mobile-shadow-card);
    }
    
    .management-card .card-header {
        padding: 20px;
    }
    
    .management-card .card-body {
        padding: 20px;
    }
    
    .card-actions {
        padding: 16px 20px;
        flex-direction: column;
        gap: var(--mobile-gap-md);
    }
    
    .card-actions .btn {
        width: 100%;
    }
}

/* ========================================
   Mobile User Management
   ======================================== */

@media (max-width: 768px) {
/* GPU-Beschleunigung für Animationen */
@media (max-width: 768px) {
    .mobile-header,
    .sidebar,
    .modal-content,
    .vehicle-card,
    .management-card,
    .user-card,
    .btn,
    .status-btn,
    .nav-btn {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Optimierte Übergänge für Touch */
    .btn,
    .status-btn,
    .nav-btn,
    .touch-item {
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Scroll-Performance */
    .inspection-content,
    .main-content,
    .modal-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* ========================================
   Mobile Specific States
   ======================================== */

@media (max-width: 768px) {
    /* Active States für Touch */
    .btn:active,
    .status-btn:active,
    .nav-btn:active,
    .touch-item:active,
    .vehicle-card:active,
    .management-card:active,
    .quick-link:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    /* Focus States für Mobile Keyboards */
    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        transform: scale(1.02);
        box-shadow: 0 0 0 4px rgba(220, 20, 60, 0.2);
    }
    
    /* Hover entfernen auf Touch-Geräten */
    @media (hover: none) {
        .btn:hover,
        .status-btn:hover,
        .nav-btn:hover,
        .touch-item:hover,
        .vehicle-card:hover,
        .management-card:hover,
        .user-card:hover,
        .quick-link:hover,
        .nav-menu a:hover {
            transform: none;
            background: initial;
            box-shadow: initial;
        }
    }
}

/* ========================================
   Mobile Landscape Optimierungen
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .mobile-header {
        height: 50px;
    }
    
    .main-content {
        padding-top: 50px;
    }
    
    .inspection-progress {
        padding: 12px var(--mobile-padding);
        top: 50px;
    }
    
    .compartment-header {
        padding: 12px var(--mobile-padding);
        top: 50px;
    }
    
    .page-header {
        margin-bottom: var(--mobile-gap-lg);
        padding-bottom: var(--mobile-gap-md);
    }
    
    .page-header h1 {
        font-size: 24px;
        margin-bottom: var(--mobile-gap-xs);
    }
    
    .page-header p {
        font-size: var(--mobile-font-small);
    }
    
    .navigation-controls {
        padding: 12px var(--mobile-padding);
    }
    
    .nav-btn {
        padding: 12px 16px;
        min-height: 44px;
    }
    
    .product-item {
        padding: 16px var(--mobile-padding);
    }
    
    .product-actions {
        grid-template-columns: 1fr 1fr 1fr;
        gap: var(--mobile-gap-sm);
    }
    
    .status-btn {
        padding: 12px 8px;
        font-size: var(--mobile-font-small);
        min-height: 40px;
    }
    
    /* Modal für Landscape */
    .modal-content {
        max-height: 80vh;
        padding: 24px 20px;
    }
    
    .modal-content h3 {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .modal-actions {
        margin-top: 20px;
        flex-direction: row;
    }
    
    /* Cards für Landscape */
    .vehicle-card,
    .management-card,
    .user-card {
        margin-bottom: 16px;
    }
    
    .card-header,
    .vehicle-header,
    .user-header {
        padding: 16px;
    }
    
    .card-body,
    .vehicle-info,
    .user-details {
        padding: 16px;
    }
    
    /* Login für Landscape */
    .login-container {
        padding: 16px;
    }
    
    .login-card {
        padding: 24px 20px;
        max-width: 400px;
    }
    
    .login-header {
        margin-bottom: 24px;
    }
    
    .login-logo {
        width: 56px;
        height: 56px;
        margin-bottom: 16px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
}

/* ========================================
   Mobile Dark Mode Vorbereitung
   ======================================== */

@media (max-width: 768px) {
    /* Mobile Dark Mode Variables */
    body.dark-mode {
        --mobile-shadow-card: 0 2px 8px rgba(0,0,0,0.3);
        --mobile-shadow-button: 0 4px 12px rgba(220, 20, 60, 0.4);
        --mobile-shadow-modal: 0 8px 32px rgba(0,0,0,0.5);
    }
    
    /* Dark Mode Touch States */
    body.dark-mode .btn:active,
    body.dark-mode .status-btn:active,
    body.dark-mode .nav-btn:active,
    body.dark-mode .touch-item:active {
        opacity: 0.8;
    }
    
    body.dark-mode .form-input:focus,
    body.dark-mode .form-select:focus,
    body.dark-mode .form-textarea:focus {
        box-shadow: 0 0 0 4px rgba(220, 20, 60, 0.3);
    }
}

/* ========================================
   Mobile Accessibility Verbesserungen
   ======================================== */

@media (max-width: 768px) {
    /* Größere Focus-Indikatoren für Mobile */
    button:focus,
    input:focus,
    select:focus,
    textarea:focus,
    a:focus,
    .btn:focus,
    .status-btn:focus,
    .nav-btn:focus,
    .touch-item:focus {
        outline: 3px solid var(--primary-red);
        outline-offset: 3px;
    }
    
    /* Verbesserte Kontraste für kleine Bildschirme */
    .form-help,
    .product-meta,
    .inspection-date,
    .version-info {
        color: var(--primary-black);
        opacity: 0.8;
    }
    
    /* Größere Tap-Targets für wichtige Aktionen */
    .emergency-btn,
    .primary-action,
    .danger-action {
        min-height: 56px;
        font-size: var(--mobile-font-large);
        font-weight: 700;
    }
    
    /* Screen Reader Optimierungen */
    .mobile-only-sr {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    
    .mobile-only-sr:focus {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
        white-space: normal;
        background: var(--primary-white);
        color: var(--primary-black);
        padding: 8px;
        border: 2px solid var(--primary-red);
        border-radius: 4px;
    }
}

/* ========================================
   Mobile PWA Optimierungen
   ======================================== */

@media (max-width: 768px) {
    /* PWA Safe Areas (iPhone X+ Notch) */
    @supports (padding: max(0px)) {
        .mobile-header {
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
            padding-top: env(safe-area-inset-top);
        }
        
        .sidebar {
            padding-top: env(safe-area-inset-top);
        }
        
        .navigation-controls {
            padding-bottom: max(16px, env(safe-area-inset-bottom));
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }
        
        .floating-action {
            bottom: max(24px, calc(24px + env(safe-area-inset-bottom)));
            right: max(16px, calc(16px + env(safe-area-inset-right)));
        }
        
        .toast-container {
            left: max(16px, env(safe-area-inset-left));
            right: max(16px, env(safe-area-inset-right));
        }
    }
    
    /* PWA Status Bar */
    .pwa-status-bar {
        height: env(safe-area-inset-top);
        background: var(--primary-red);
    }
    
    /* PWA Bottom Safe Area */
    .pwa-bottom-safe {
        height: env(safe-area-inset-bottom);
        background: var(--primary-white);
    }
}

/* ========================================
   Mobile Network Optimierungen
   ======================================== */

@media (max-width: 768px) {
    /* Reduzierte Animationen für langsame Verbindungen */
    @media (prefers-reduced-data: reduce) {
        .fade-in,
        .slide-up,
        .slide-down,
        .bounce-in {
            animation: none;
        }
        
        .btn,
        .status-btn,
        .nav-btn,
        .touch-item,
        .vehicle-card,
        .management-card,
        .user-card {
            transition: none;
        }
        
        .spinner {
            animation: none;
            border: 3px solid var(--primary-red);
        }
        
        .skeleton {
            animation: none;
            background: var(--light-gray);
        }
    }
    
    /* Optimierte Schatten für schwache Hardware */
    @media (max-resolution: 150dpi) {
        .card,
        .vehicle-card,
        .management-card,
        .user-card,
        .modal-content,
        .login-card {
            box-shadow: 0 1px 3px rgba(0,0,0,0.2);
        }
        
        .mobile-header {
            box-shadow: 0 1px 3px rgba(0,0,0,0.2);
        }
        
        .btn:hover,
        .btn:focus {
            box-shadow: 0 2px 6px rgba(220, 20, 60, 0.3);
        }
    }
}

/* ========================================
   Mobile Print Anpassungen
   ======================================== */

@media print and (max-width: 768px) {
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .mobile-header,
    .sidebar,
    .navigation-controls,
    .floating-action,
    .btn,
    .status-btn,
    .nav-btn {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .page-header h1 {
        font-size: 18pt;
        font-weight: bold;
    }
    
    .card,
    .vehicle-card,
    .management-card,
    .user-card {
        box-shadow: none;
        border: 1px solid #000;
        break-inside: avoid;
        margin-bottom: 8pt;
    }
    
    .card-header,
    .vehicle-header,
    .user-header {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .product-actions,
    .card-actions,
    .user-actions {
        display: none;
    }
    
    .container,
    .container-fluid {
        padding: 0;
    }
}

/* ========================================
   Mobile Browser Spezifische Fixes
   ======================================== */

/* iOS Safari spezifische Fixes */
@supports (-webkit-touch-callout: none) and (max-width: 768px) {
    /* Fix für iOS Safari 100vh Problem */
    .mobile-viewport-fix,
    .inspection-container,
    .sidebar {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
    
    /* Fix für iOS Safari Input Zoom */
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px !important;
    }
    
    /* Fix für iOS Safari Tap Highlight */
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Fix für iOS Safari Scrolling */
    .inspection-content,
    .modal-content,
    .sidebar {
        -webkit-overflow-scrolling: touch;
    }
}

/* Android Browser spezifische Fixes */
@media (max-width: 768px) {
    /* Android Browser Input Fix */
    @media screen and (-webkit-min-device-pixel-ratio: 0) and (min-device-width: 320px) and (max-device-width: 768px) {
        .form-input,
        .form-select,
        .form-textarea {
            font-size: 16px;
            background-clip: padding-box;
        }
    }
    
    /* Android Browser Transform Fix */
    .android-fix {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Samsung Internet spezifische Fixes */
@media (max-width: 768px) {
    /* Samsung Internet Scrollbar Fix */
    .inspection-content::-webkit-scrollbar,
    .modal-content::-webkit-scrollbar {
        display: none;
    }
    
    .inspection-content,
    .modal-content {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
}

/* ========================================
   Mobile Debug Hilfsmittel (Development)
   ======================================== */

/* Nur für Development - in Produktion entfernen */
@media (max-width: 768px) {
    .mobile-debug {
        position: fixed;
        top: 70px;
        right: 10px;
        background: rgba(255, 0, 0, 0.8);
        color: white;
        padding: 4px 8px;
        font-size: 10px;
        border-radius: 4px;
        z-index: 9999;
        pointer-events: none;
    }
    
    .mobile-debug::before {
        content: 'Mobile: ' attr(data-viewport-width) 'x' attr(data-viewport-height);
    }
    
    /* Touch-Target Visualisierung für Development */
    .debug-touch-targets .btn,
    .debug-touch-targets .status-btn,
    .debug-touch-targets .nav-btn,
    .debug-touch-targets .touch-item {
        outline: 1px dashed rgba(255, 0, 0, 0.5);
        outline-offset: 2px;
    }
    
    .debug-touch-targets .btn::after,
    .debug-touch-targets .status-btn::after {
        content: attr(data-touch-size);
        position: absolute;
        top: -20px;
        left: 0;
        font-size: 10px;
        color: red;
        background: rgba(255, 255, 255, 0.8);
        padding: 2px 4px;
        border-radius: 2px;
    }
}

/* ========================================
   Mobile Fallbacks
   ======================================== */

/* Fallback für Browser ohne CSS Grid Support */
@supports not (display: grid) {
    @media (max-width: 768px) {
        .dashboard-grid,
        .vehicles-management-grid,
        .containers-grid,
        .compartments-grid,
        .products-grid,
        .users-grid,
        .stats-grid {
            display: block;
        }
        
        .dashboard-grid > *,
        .vehicles-management-grid > *,
        .containers-grid > *,
        .compartments-grid > *,
        .products-grid > *,
        .users-grid > *,
        .stats-grid > * {
            width: 100%;
            margin-bottom: 20px;
        }
        
        .product-actions {
            display: block;
        }
        
        .product-actions .status-btn {
            width: 100%;
            margin-bottom: 12px;
        }
        
        .quick-links {
            display: block;
        }
        
        .quick-link {
            width: 100%;
            margin-bottom: 12px;
        }
    }
}

/* Fallback für Browser ohne CSS Custom Properties */
@supports not (--custom: property) {
    @media (max-width: 768px) {
        .btn {
            min-height: 48px;
            padding: 14px 20px;
            font-size: 16px;
        }
        
        .form-input,
        .form-select,
        .form-textarea {
            min-height: 48px;
            padding: 14px 16px;
            font-size: 16px;
        }
        
        .nav-menu a {
            min-height: 48px;
            padding: 16px 20px;
            font-size: 16px;
        }
        
        .touch-item {
            min-height: 48px;
            padding: 16px;
        }
        
        .status-btn {
            min-height: 48px;
            padding: 14px 12px;
            font-size: 16px;
        }
    }
}

/* ========================================
   Ende Mobile CSS
   ======================================== */d {
        border-radius: var(--mobile-border-radius);
        box-shadow: var(--mobile-shadow-card);
    }
    
    .user-header {
        padding: 24px 20px;
        gap: var(--mobile-gap-lg);
    }
    
    .user-avatar {
        width: 64px;
        height: 64px;
        font-size: 24px;
        font-weight: 700;
    }
    
    .user-info h3 {
        font-size: 20px;
        font-weight: 700;
    }
    
    .username {
        font-size: var(--mobile-font-base);
        margin-bottom: var(--mobile-gap-md);
    }
    
    .user-details {
        padding: 24px 20px;
    }
    
    .detail-item {
        gap: var(--mobile-gap-md);
        margin-bottom: var(--mobile-gap-lg);
        font-size: var(--mobile-font-base);
    }
    
    .detail-item svg {
        width: 20px;
        height: 20px;
    }
    
    .user-actions {
        padding: 20px;
        flex-direction: column;
        gap: var(--mobile-gap-md);
    }
}

/* ========================================
   Mobile Settings Interface
   ======================================== */

@media (max-width: 768px) {
    .settings-tabs {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0;
    }
    
    .settings-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .settings-tabs .tab-btn {
        flex: 1;
        min-width: 0;
        padding: 16px 8px;
        font-size: var(--mobile-font-small);
        text-align: center;
        white-space: nowrap;
    }
    
    .settings-tabs .tab-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--mobile-gap-lg);
    }
    
    .stat-card {
        padding: 24px 20px;
        border-radius: var(--mobile-border-radius);
        gap: var(--mobile-gap-lg);
    }
    
    .stat-icon {
        width: 56px;
        height: 56px;
    }
    
    .stat-content h3 {
        font-size: 28px;
        font-weight: 800;
    }
    
    .stat-content p {
        font-size: var(--mobile-font-base);
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: var(--mobile-gap-md);
    }
    
    .info-item {
        padding: 16px;
        border-radius: var(--mobile-gap-md);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--mobile-gap-sm);
    }
    
    .security-item {
        padding: 20px;
        border-radius: var(--mobile-gap-md);
        gap: var(--mobile-gap-lg);
    }
    
    .security-icon {
        width: 48px;
        height: 48px;
    }
    
    .security-content h4 {
        font-size: var(--mobile-font-large);
        font-weight: 600;
    }
    
    .security-content p {
        font-size: var(--mobile-font-base);
    }
}

/* ========================================
   Mobile Error Pages
   ======================================== */

@media (max-width: 768px) {
    .error-page {
        padding: 32px var(--mobile-padding);
    }
    
    .error-content {
        margin-bottom: 32px;
    }
    
    .error-icon {
        width: 96px;
        height: 96px;
    }
    
    .error-details h1 {
        font-size: 56px;
        font-weight: 800;
    }
    
    .error-details h2 {
        font-size: 28px;
        font-weight: 700;
    }
    
    .error-details p {
        font-size: var(--mobile-font-base);
        line-height: var(--mobile-line-height);
        margin-bottom: 32px;
    }
    
    .error-actions {
        flex-direction: column;
        gap: var(--mobile-gap-md);
        align-items: center;
    }
    
    .error-actions .btn {
        width: 100%;
        max-width: 280px;
        min-height: 52px;
    }
    
    .help-card {
        padding: 24px 20px;
        border-radius: var(--mobile-border-radius);
    }
    
    .help-card h3 {
        font-size: 20px;
        font-weight: 700;
    }
    
    .quick-links {
        grid-template-columns: 1fr;
        gap: var(--mobile-gap-md);
    }
    
    .quick-link {
        padding: 16px;
        border-radius: var(--mobile-gap-md);
        font-size: var(--mobile-font-base);
        min-height: var(--mobile-touch-min);
    }
    
    .contact-item {
        gap: var(--mobile-gap-md);
        font-size: var(--mobile-font-base);
    }
    
    .contact-item svg {
        width: 20px;
        height: 20px;
    }
}

/* ========================================
   Mobile Login Page
   ======================================== */

@media (max-width: 768px) {
    .login-container {
        padding: 20px var(--mobile-padding);
    }
    
    .login-card {
        padding: 40px 24px;
        border-radius: var(--mobile-border-radius);
        box-shadow: var(--mobile-shadow-modal);
        max-width: none;
        width: 100%;
    }
    
    .login-header {
        margin-bottom: 32px;
    }
    
    .login-logo {
        width: 72px;
        height: 72px;
        margin-bottom: 24px;
    }
    
    .login-header h1 {
        font-size: 28px;
        font-weight: 700;
        margin-bottom: var(--mobile-gap-md);
    }
    
    .login-header p {
        font-size: var(--mobile-font-base);
    }
    
    .login-form {
        margin-bottom: 24px;
    }
    
    .login-footer {
        padding-top: 24px;
    }
    
    .version-info {
        font-size: var(--mobile-font-small);
    }
}

/* ========================================
   Mobile Table Optimierungen
   ======================================== */

@media (max-width: 768px) {
    .table-responsive {
        border-radius: var(--mobile-gap-md);
        box-shadow: var(--mobile-shadow-card);
    }
    
    .data-table {
        font-size: var(--mobile-font-small);
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 8px;
        vertical-align: top;
    }
    
    .data-table th {
        font-size: var(--mobile-font-small);
        font-weight: 700;
    }
    
    /* Mobile Card-Style Table */
    .mobile-table-cards .data-table,
    .mobile-table-cards .data-table thead,
    .mobile-table-cards .data-table tbody,
    .mobile-table-cards .data-table th,
    .mobile-table-cards .data-table td,
    .mobile-table-cards .data-table tr {
        display: block;
    }
    
    .mobile-table-cards .data-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .mobile-table-cards .data-table tr {
        background: var(--primary-white);
        border-radius: var(--mobile-gap-md);
        margin-bottom: var(--mobile-gap-md);
        padding: var(--mobile-gap-lg);
        box-shadow: var(--mobile-shadow-card);
        border: none;
    }
    
    .mobile-table-cards .data-table td {
        border: none;
        position: relative;
        padding: var(--mobile-gap-sm) 0;
        margin-bottom: var(--mobile-gap-sm);
    }
    
    .mobile-table-cards .data-table td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--dark-gray);
        font-size: var(--mobile-font-small);
    }
}

/* ========================================
   Mobile Breadcrumb
   ======================================== */

@media (max-width: 768px) {
    .breadcrumb {
        font-size: var(--mobile-font-small);
        margin-bottom: var(--mobile-gap-lg);
        flex-wrap: wrap;
        gap: var(--mobile-gap-xs);
    }
}

/* ========================================
   Mobile Floating Action Button
   ======================================== */

@media (max-width: 768px) {
    .floating-action {
        bottom: 24px;
        right: var(--mobile-padding);
    }
    
    .fab {
        width: 64px;
        height: 64px;
        box-shadow: var(--mobile-shadow-button);
    }
    
    .fab:active {
        transform: scale(0.95);
    }
    
    .fab svg {
        width: 28px;
        height: 28px;
    }
}

/* ========================================
   Mobile Loading States
   ======================================== */

@media (max-width: 768px) {
    .loading-indicator {
        padding: 24px;
        border-radius: var(--mobile-border-radius);
        min-width: 200px;
    }
    
    .spinner {
        width: 40px;
        height: 40px;
        border-width: 4px;
    }
    
    .skeleton {
        border-radius: var(--mobile-gap-md);
    }
    
    .skeleton-text {
        height: 16px;
        border-radius: var(--mobile-gap-sm);
        margin-bottom: var(--mobile-gap-md);
    }
    
    .skeleton-avatar {
        width: 48px;
        height: 48px;
    }
    
    .skeleton-button {
        height: var(--mobile-touch-min);
        border-radius: var(--mobile-gap-md);
    }
}

/* ========================================
   Mobile Photo Containers
   ======================================== */

@media (max-width: 768px) {
    .photo-container {
        border-radius: var(--mobile-gap-md);
        margin: var(--mobile-gap-lg) 0;
    }
    
    .photo-placeholder {
        border-radius: var(--mobile-gap-md);
        padding: 32px 20px;
        font-size: var(--mobile-font-base);
        min-height: 120px;
    }
    
    .container-photo,
    .compartment-photo {
        height: 180px;
        border-radius: var(--mobile-gap-md);
        overflow: hidden;
    }
    
    .upload-btn {
        padding: 16px 20px;
        border-radius: var(--mobile-gap-md);
        font-size: var(--mobile-font-base);
        min-height: var(--mobile-touch-min);
        gap: var(--mobile-gap-sm);
    }
}

/* ========================================
   Mobile Badge Optimierungen
   ======================================== */

@media (max-width: 768px) {
    .badge {
        padding: 6px 12px;
        border-radius: 16px;
        font-size: 13px;
        font-weight: 600;
    }
    
    .vehicle-type-badge,
    .container-type-badge {
        padding: 6px 12px;
        border-radius: 16px;
        font-size: 13px;
        font-weight: 600;
    }
    
    .role-badge {
        padding: 6px 12px;
        border-radius: 16px;
        font-size: 13px;
        font-weight: 600;
    }
}

/* ========================================
   Mobile Performance Optimierungen
   ======================================== */

/* GPU-Beschleunigung für Animationen */
@media (max-width: 768px) {
    .mobile-header,
    .sidebar,
    .modal-content,
    .vehicle-card,
    .management-card,
    .user-car