/* ==================== MOBILE RESPONSIVE STYLES ==================== */
/* Optimierung für mobile Geräte und Tablets */

/* Mobile-First Approach */
@media (max-width: 768px) {
    
    /* ===== GENERAL MOBILE STYLES ===== */
    body {
        font-size: 14px;
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    /* Prevent horizontal scrolling */
    * {
        max-width: 100vw;
    }
    
    /* Hide scrollbars on mobile for cleaner look */
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    
    /* ===== NAVIGATION & HEADER ===== */
    nav {
        position: sticky;
        top: 0;
        z-index: 50;
        width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .dashboard-header {
        flex-direction: column !important;
        padding: 1rem !important;
    }
    
    .dashboard-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        min-width: 120px;
        font-size: 0.875rem;
        padding: 0.5rem 1rem !important;
    }
    
    /* ===== MODALS ===== */
    .modal-container > div {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    
    /* Modal Header - Compact */
    .modal-header {
        padding: 1rem !important;
    }
    
    .modal-header h2 {
        font-size: 1.25rem !important;
    }
    
    .modal-header p {
        font-size: 0.75rem !important;
    }
    
    /* Modal Content - Scrollable */
    .modal-content {
        padding: 1rem !important;
        max-height: calc(100vh - 80px) !important;
        overflow-y: auto !important;
    }
    
    /* ===== FORMS ===== */
    /* Grid Forms - Stack on Mobile */
    .grid-cols-3,
    .grid-cols-4,
    .grid-cols-6 {
        grid-template-columns: 1fr !important;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    .col-span-2,
    .col-span-3,
    .col-span-4,
    .col-span-6 {
        grid-column: span 1 !important;
    }
    
    /* Form Inputs - Larger Touch Targets */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="email"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
        min-height: 44px; /* iOS minimum touch target */
    }
    
    /* Buttons - Larger Touch Targets */
    button {
        min-height: 44px;
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* ===== TABLES ===== */
    /* Horizontal Scroll for Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
        font-size: 0.875rem;
    }
    
    table th,
    table td {
        padding: 0.5rem !important;
        white-space: nowrap;
    }
    
    /* Hide less important columns on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* ===== CARDS ===== */
    .card-grid {
        grid-template-columns: 1fr !important;
    }
    
    .card {
        padding: 1rem !important;
    }
    
    /* ===== DASHBOARD WIDGETS ===== */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .stat-card {
        padding: 1rem !important;
    }
    
    .stat-value {
        font-size: 1.5rem !important;
    }
    
    /* ===== INVOICE/QUOTE FORMS ===== */
    /* Add Item Form - Stack Vertically */
    .add-item-form {
        grid-template-columns: 1fr !important;
    }
    
    /* Totals Section - Full Width */
    .totals-container {
        width: 100% !important;
    }
    
    /* ===== ACTION BUTTONS ===== */
    .action-buttons {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .action-buttons button {
        width: 100% !important;
    }
    
    /* ===== SPACING ADJUSTMENTS ===== */
    .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .py-6 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    .mb-6 {
        margin-bottom: 1rem !important;
    }
    
    /* ===== ICONS ===== */
    .icon-large {
        font-size: 1.5rem !important;
    }
    
    /* ===== FLOATING ACTION BUTTON (FAB) ===== */
    .fab-container {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 100;
    }
    
    .fab-button {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
    
    /* ===== SEARCH BARS ===== */
    .search-bar {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    /* ===== QUICK ACCESS BUTTONS ===== */
    .quick-access-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }
    
    .quick-access-button {
        padding: 1rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    /* ===== TEXT SIZES ===== */
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    /* ===== UTILITY CLASSES ===== */
    .mobile-hide {
        display: none !important;
    }
    
    .mobile-show {
        display: block !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
}

/* ===== TABLET (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-cols-6 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .modal-container > div {
        max-width: 90% !important;
    }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-container > div {
        max-height: 90vh !important;
    }
    
    .modal-content {
        max-height: calc(90vh - 80px) !important;
    }
}

/* ===== TOUCH OPTIMIZATIONS ===== */
/* Larger tap targets for touch devices */
@media (hover: none) and (pointer: coarse) {
    button,
    a,
    .clickable {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Remove hover effects on touch devices */
    .hover\:scale-105:hover,
    .hover\:bg-gray-50:hover {
        transform: none !important;
        background-color: inherit !important;
    }
}

/* ===== SAFE AREA INSETS (for iPhone X+) ===== */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}
