/* Mobile Touch-Optimierungen für Templer Mark */
/* Diese Datei implementiert Touch-freundliche Interaktionen und Mobile-Optimierungen */

/* Touch-Action Optimierungen */
.nav-link, .btn, .btn-custom, .card, .dropdown-toggle, 
.form-control, .form-select, .list-group-item {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
}

/* Touch-Feedback für Buttons */
.btn:active, .btn-custom:active, .nav-link:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Touch-Feedback für Links */
.nav-link:active, .dropdown-item:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Touch-Feedback für Karten */
.card:active {
    transform: scale(0.99);
    transition: transform 0.1s ease;
}

/* Touch-Feedback für Formularelemente */
.form-control:active, .form-select:active {
    transform: scale(1.02);
    transition: transform 0.1s ease;
}

/* Mobile-spezifische Anpassungen */
@media (max-width: 768px) {
    /* Touch-Zoom auf iOS verhindern */
    input[type="text"], input[type="email"], input[type="password"], 
    input[type="search"], textarea, select {
        font-size: 16px !important;
    }
    
    /* Touch-Bereiche vergrößern */
    .btn, .btn-custom {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .nav-link {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .dropdown-item {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Touch-freundliche Checkboxen und Radio-Buttons */
    input[type="checkbox"], input[type="radio"] {
        min-width: 24px;
        min-height: 24px;
    }
    
    /* Touch-freundliche Tabellen */
    .table-responsive {
        border-radius: 8px;
        overflow: hidden;
    }
    
    .table th, .table td {
        padding: 12px 8px;
        min-width: 80px;
    }
    
    /* Touch-freundliche Listen */
    .list-group-item {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Touch-freundliche Modals */
    .modal-header, .modal-footer {
        padding: 16px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    /* Touch-freundliche Dropdowns */
    .dropdown-menu {
        min-width: 200px;
        padding: 8px 0;
    }
    
    /* Touch-freundliche Pagination */
    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Touch-freundliche Breadcrumbs */
    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 12px;
    }
    
    /* Touch-freundliche Alerts */
    .alert {
        padding: 16px 20px;
        margin-bottom: 16px;
    }
    
    /* Touch-freundliche Badges */
    .badge {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
}

/* Kleine Mobile-Geräte (Smartphones) */
@media (max-width: 576px) {
    /* Noch größere Touch-Bereiche */
    .btn, .btn-custom {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 16px;
    }
    
    .nav-link {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    /* Touch-freundliche Formulare */
    .form-control, .form-select {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
    }
    
    /* Touch-freundliche Tabellen */
    .table th, .table td {
        padding: 16px 12px;
        min-width: 100px;
    }
    
    /* Touch-freundliche Listen */
    .list-group-item {
        min-height: 48px;
        padding: 16px 20px;
    }
    
    /* Touch-freundliche Modals */
    .modal-header, .modal-footer {
        padding: 20px 24px;
    }
    
    .modal-body {
        padding: 24px;
    }
}

/* Touch-Gesten für Mobile-Navigation */
@media (max-width: 768px) {
    /* Swipe-Gesten für Sidebar */
    .sidebar {
        transition: transform 0.3s ease;
    }
    
    .sidebar.swipe-left {
        transform: translateX(-100%);
    }
    
    .sidebar.swipe-right {
        transform: translateX(0);
    }
    
    /* Touch-Gesten für Karussells */
    .carousel {
        touch-action: pan-y pinch-zoom;
    }
    
    /* Touch-Gesten für Scroll-Container */
    .scroll-container {
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
    }
}

/* Touch-Feedback-Animationen */
.touch-feedback {
    transition: all 0.1s ease;
}

.touch-feedback:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Touch-Loading-States */
.touch-loading {
    position: relative;
    pointer-events: none;
}

.touch-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: touch-spin 1s linear infinite;
}

@keyframes touch-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Touch-Hover-Effekte (nur für Touch-Geräte) */
@media (hover: none) and (pointer: coarse) {
    .btn:hover, .btn-custom:hover,
    .nav-link:hover, .dropdown-item:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
}

/* Touch-Fokus-Verbesserungen */
.nav-link:focus, .btn:focus, .btn-custom:focus,
.form-control:focus, .form-select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Touch-Scroll-Verbesserungen */
@media (max-width: 768px) {
    /* Smooth Scrolling für Touch-Geräte */
    html {
        scroll-behavior: smooth;
    }
    
    /* Touch-Scroll-Indikatoren */
    .scroll-indicator {
        position: fixed;
        right: 20px;
        bottom: 20px;
        width: 40px;
        height: 40px;
        background: rgba(102, 126, 234, 0.8);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .scroll-indicator.show {
        opacity: 1;
    }
    
    .scroll-indicator:hover {
        background: rgba(102, 126, 234, 1);
    }
}

/* Touch-Gesten für spezifische Komponenten */
@media (max-width: 768px) {
    /* Touch-Gesten für Bildergalerien */
    .image-gallery {
        touch-action: pan-x pan-y;
    }
    
    .image-gallery img {
        pointer-events: none;
    }
    
    /* Touch-Gesten für Karten */
    .card {
        touch-action: manipulation;
    }
    
    /* Touch-Gesten für Formulare */
    .form {
        touch-action: manipulation;
    }
    
    /* Touch-Gesten für Navigation */
    .navbar {
        touch-action: manipulation;
    }
}

/* Touch-Performance-Optimierungen */
@media (max-width: 768px) {
    /* Hardware-Beschleunigung für Touch-Animationen */
    .btn, .btn-custom, .nav-link, .card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Touch-Event-Optimierungen */
    * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Text-Inputs erlauben Textauswahl */
    input, textarea {
        -webkit-user-select: text;
        -khtml-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
}

/* Touch-Accessibility-Verbesserungen */
@media (max-width: 768px) {
    /* Touch-Fokus-Indikatoren */
    .touch-focus {
        position: relative;
    }
    
    .touch-focus::after {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        border: 2px solid #667eea;
        border-radius: 4px;
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    
    .touch-focus:focus::after {
        opacity: 1;
    }
    
    /* Touch-Feedback für Screen-Reader */
    .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* Touch-Debug-Modus (nur für Entwicklung) */
.touch-debug {
    outline: 2px solid red;
}

.touch-debug::before {
    content: 'TOUCH';
    position: absolute;
    top: -20px;
    left: 0;
    background: red;
    color: white;
    padding: 2px 4px;
    font-size: 10px;
    border-radius: 2px;
}
