/* Responsive Admin Styles */

/* Tabellen responsive machen */
@media (max-width: 1024px) {
    /* Tabellen horizontal scrollbar */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Buttons nebeneinander auf Tablets */
    .flex.items-center.justify-between {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .flex.items-center.gap-3 {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    /* Header auf Mobile */
    .flex.items-center.justify-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .flex.items-center.justify-between h1 {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
    }
    
    /* Buttons full-width auf Mobile */
    .flex.items-center.justify-between > div {
        width: 100%;
    }
    
    .flex.items-center.justify-between > div .btn,
    .flex.items-center.justify-between > div button,
    .flex.items-center.justify-between > div a.btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Tabellen: kleinere Schrift und Padding */
    table {
        font-size: 0.875rem;
    }
    
    table th,
    table td {
        padding: 0.5rem !important;
    }
    
    /* Tabellen-Aktionen vertikal stapeln */
    .flex.items-center.gap-2 {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .flex.items-center.gap-2 button {
        width: 100%;
    }
    
    /* Modals auf Mobile */
    .fixed.inset-0.z-50 > div {
        margin: 1rem !important;
        max-width: 100% !important;
    }
    
    /* Forms auf Mobile */
    .grid.grid-cols-2,
    .grid.grid-cols-1.md\\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    /* KPI Cards */
    .grid.grid-cols-2,
    .grid.grid-cols-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    /* Sehr kleine Mobile Geräte */
    .px-4 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Tabellen: noch kompakter */
    table {
        font-size: 0.75rem;
    }
    
    table th,
    table td {
        padding: 0.375rem !important;
    }
    
    /* Icons in Tabellen: kleiner */
    table .w-8.h-8 {
        width: 2rem;
        height: 2rem;
    }
    
    /* Form Inputs */
    .form-control {
        font-size: 16px !important; /* Verhindert Zoom auf iOS */
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Tabellen: Horizontal Scroll für sehr breite Tabellen */
.card .overflow-x-auto,
.card-body .overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tabellen-Container */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-container table {
    min-width: 600px;
}

/* Mobile Sidebar Fix */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
}

/* Fix für zu breite Content-Bereiche */
@media (max-width: 1024px) {
    .max-w-7xl {
        max-width: 100%;
    }
}

/* Grid Responsive Overrides */
@media (max-width: 640px) {
    .grid.grid-cols-3,
    .grid.sm\\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
}

/* Button Groups auf Mobile */
@media (max-width: 640px) {
    .flex.gap-3 button,
    .flex.gap-3 a {
        width: 100%;
    }
}

/* Card Padding auf Mobile reduzieren */
@media (max-width: 640px) {
    .card,
    .card-body {
        padding: 1rem !important;
    }
    
    .px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
}

/* Fix für Tabellen-Overflow in Cards */
.card > div:has(table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Ensure scrollable tables don't break layout */
.overflow-x-auto {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Prevent text from breaking layout */
.truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    td {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

