/**
 * Mobile Fixes CSS
 * Spezielle Fixes für mobile Geräte und kleine Bildschirme
 */

/* ========================================
   ALLGEMEINE MOBILE FIXES
   ======================================== */

/* Verhindert Zoom beim Fokussieren von Inputs auf iOS */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Verbessert Tap-Highlighting */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Smoothes Scrolling */
html {
    scroll-behavior: smooth;
}

/* Verhindert Text-Auswahl beim Doppel-Tap */
.card,
.btn,
.nav-link {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ========================================
   CONTAINER UND LAYOUT FIXES
   ======================================== */

/* Stellt sicher, dass alle Container responsive sind */
.container,
.container-fluid,
.container-sm,
.container-md,
.container-lg,
.container-xl,
.container-xxl {
    max-width: 100% !important;
    overflow-x: hidden;
}

/* Bootstrap Row Fixes für mobile Geräte */
.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ========================================
   TYPOGRAFIE ANPASSUNGEN
   ======================================== */

@media (max-width: 768px) {
    /* Verhindert zu lange Wörter, die das Layout sprengen */
    body,
    p,
    div,
    span,
    a,
    li {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }
    
    /* Optimierte Schriftgrößen */
    h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.5rem !important;
        line-height: 1.3;
    }
    
    h4 {
        font-size: 1.25rem !important;
        line-height: 1.4;
    }
    
    h5,
    h6 {
        font-size: 1.1rem !important;
        line-height: 1.4;
    }
}

@media (max-width: 576px) {
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    h4,
    h5,
    h6 {
        font-size: 1rem !important;
    }
}

/* ========================================
   BUTTON UND FORM FIXES
   ======================================== */

/* Touch-freundliche Buttons */
.btn {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
}

@media (max-width: 576px) {
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        width: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.5rem;
    }
}

/* Form Inputs */
input,
textarea,
select {
    max-width: 100%;
}

/* ========================================
   CARD UND IMAGE FIXES
   ======================================== */

/* Responsive Cards */
.card {
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 0.75rem;
    }
}

/* Image Fixes */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.card-img,
.card-img-top,
.card-img-bottom {
    width: 100%;
    height: auto;
}

/* ========================================
   NAVBAR MOBILE FIXES
   ======================================== */

@media (max-width: 991px) {
    .navbar-collapse {
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
    
    .navbar-nav {
        padding: 0.5rem 0;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        padding: 0.75rem 1rem !important;
    }
}

/* ========================================
   TABLE RESPONSIVE FIXES
   ======================================== */

@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th,
    td {
        padding: 0.5rem !important;
        white-space: nowrap;
    }
}

/* ========================================
   MODAL FIXES
   ======================================== */

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* ========================================
   SPACING UTILITIES MOBILE
   ======================================== */

@media (max-width: 768px) {
    .py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    .my-5 {
        margin-top: 3rem !important;
        margin-bottom: 3rem !important;
    }
}

@media (max-width: 576px) {
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .my-5 {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }
    
    .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .my-4 {
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
}

/* ========================================
   LANDSCAPE MODE FIXES (Mobile Horizontal)
   ======================================== */

@media screen and (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 0.25rem 0;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 0.25rem 0.75rem !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
}
