/* ═══════════════════════════════════════════════════════════════════════════
   📱 DEINCHECK MOBILE APP EXPERIENCE - Apple-like Premium Mobile Styles
   ═══════════════════════════════════════════════════════════════════════════
   Version: 1.0.0 | 17.12.2025
   Optimiert für: iPhone, Android, alle Smartphones
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   🎯 GLOBAL MOBILE RESETS & BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Prevent text zoom on input focus (iOS) */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Smooth scrolling & momentum */
html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Safe area for notch devices */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Touch feedback for all interactive elements */
@media (hover: none) and (pointer: coarse) {
    button, a, .clickable, [onclick] {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
        touch-action: manipulation;
    }
    
    button:active, a:active, .clickable:active, [onclick]:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   📱 MOBILE BREAKPOINTS - App-like Experience
   ═══════════════════════════════════════════════════════════════════════════ */

/* === TABLETS (iPad, etc.) === */
@media screen and (max-width: 1024px) {
    .sidebar {
        width: 260px !important;
    }
    
    .main-content {
        margin-left: 260px !important;
    }
    
    .stats-grid, .stat-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

/* === MOBILE PHONES === */
@media screen and (max-width: 968px) {
    /* === SIDEBAR TRANSFORMS === */
    .sidebar {
        position: fixed !important;
        transform: translateX(-100%) !important;
        width: 85% !important;
        max-width: 320px !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height für iOS */
        z-index: 9999 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none !important;
        overflow-y: auto !important; /* SCROLL FIXEN */
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important; /* Smooth scroll iOS */
        overscroll-behavior: contain !important;
    }
    
    .sidebar.mobile-open,
    .sidebar.open,
    .sidebar.active {
        transform: translateX(0) !important;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Sidebar Navigation scrollbar */
    .sidebar-nav, .sidebar .tabs {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        flex: 1 1 auto !important;
        max-height: calc(100vh - 80px) !important;
        max-height: calc(100dvh - 80px) !important;
        padding-bottom: 120px !important; /* Platz für letzten Item */
    }
    
    /* Sidebar selbst scrollbar machen */
    .sidebar {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .sidebar-header {
        flex-shrink: 0 !important;
    }
    
    /* Alle Sidebar-Items */
    .sidebar .tab, .sidebar .nav-item {
        flex-shrink: 0 !important;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* === MAIN CONTENT FULL WIDTH === */
    .main-content, .content, .dashboard-content {
        margin-left: 0 !important;
        padding: 12px !important;
        width: 100% !important;
    }
    
    /* === MOBILE HEADER === */
    .mobile-header {
        display: flex !important;
        position: sticky;
        top: 0;
        z-index: 100;
        background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
        padding: 12px 16px;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-menu-btn {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        border-radius: 12px;
        color: white;
        font-size: 20px;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .mobile-menu-btn:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.3);
    }
    
    /* === STAT CARDS - Compact === */
    .stats-grid, .stat-cards, .quick-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .stat-card, .stat-box, .quick-stat {
        padding: 14px !important;
        border-radius: 14px !important;
    }
    
    .stat-card h3, .stat-value, .stat-number {
        font-size: 20px !important;
    }
    
    .stat-card p, .stat-label {
        font-size: 11px !important;
    }
    
    .stat-card .stat-icon, .stat-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
    
    /* === TABLES - Horizontal Scroll === */
    .table-container, .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }
    
    table {
        min-width: 600px;
        font-size: 13px !important;
    }
    
    th, td {
        padding: 10px 8px !important;
        white-space: nowrap;
    }
    
    /* === CARDS - Compact === */
    .data-card, .card, .panel {
        padding: 14px !important;
        border-radius: 14px !important;
        margin-bottom: 12px !important;
    }
    
    .data-card-header, .card-header {
        padding: 12px !important;
        flex-direction: column;
        gap: 10px;
    }
    
    .data-card-title {
        font-size: 15px !important;
    }
    
    /* === BUTTONS - Touch Friendly === */
    button, .btn, .action-btn {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }
    
    .btn-group, .button-group {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    
    /* === FORMS - Mobile Optimized === */
    input, select, textarea {
        height: 44px !important;
        padding: 10px 12px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
    }
    
    /* DATUM FELDER - KOMPAKT */
    input[type="date"] {
        height: 40px !important;
        padding: 8px 10px !important;
        font-size: 14px !important;
    }
    
    textarea {
        height: auto !important;
        min-height: 80px;
    }
    
    label {
        font-size: 12px !important;
        margin-bottom: 4px !important;
    }
    
    .form-group, .input-group {
        margin-bottom: 10px !important;
    }
    
    /* === FILTER SECTION - Kompakt === */
    .filter-section, .filters {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .filter-section > *, .filters > * {
        width: 100% !important;
    }
    
    /* === ALLE FILTER GRIDS - Kompakt 2-spaltig === */
    [style*="grid-template-columns: repeat(5"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(3"],
    [style*="display: grid"][style*="gap: 16px"],
    [style*="display: grid"][style*="gap: 20px"],
    [style*="display: grid"][style*="gap: 1rem"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    
    /* Filter Container Padding reduzieren */
    [style*="padding: 1.5rem"],
    [style*="padding: 24px"],
    [style*="padding: 2rem"] {
        padding: 12px !important;
    }
    
    /* === BUTTON ROW - Wrap === */
    [style*="display: flex"][style*="gap: 12px"] {
        flex-wrap: wrap !important;
    }
    
    /* === GREEN SUM BOX COMPACT === */
    [style*="background: linear-gradient(135deg, #10b981"] {
        padding: 14px 16px !important;
        flex-direction: column !important;
        text-align: center !important;
    }
    
    [style*="font-size: 32px"], [style*="font-size: 2rem"] {
        font-size: 22px !important;
    }
    
    /* === KUNDEN KARTEN - Mobile Layout === */
    #kunden-vertraege-liste > div {
        border-radius: 14px !important;
        margin-bottom: 10px !important;
    }
    
    /* Kunden-Karte Header - Stack on Mobile */
    #kunden-vertraege-liste > div > div[onclick] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 14px !important;
    }
    
    /* Avatar + Name Row */
    #kunden-vertraege-liste > div > div[onclick] > div:first-child {
        width: 100% !important;
    }
    
    /* Stats Row - Horizontal */
    #kunden-vertraege-liste > div > div[onclick] > div:nth-child(2) {
        display: flex !important;
        width: 100% !important;
        justify-content: space-around !important;
        padding-top: 10px !important;
        border-top: 1px solid rgba(255,255,255,0.2) !important;
    }
    
    /* Stats Numbers Smaller */
    #kunden-vertraege-liste [style*="font-size: 28px"] {
        font-size: 22px !important;
    }
    
    /* Chevron Icon */
    #kunden-vertraege-liste i.fa-chevron-down {
        position: absolute !important;
        top: 14px !important;
        right: 14px !important;
    }
    
    /* Details Section - Compact */
    #kunden-vertraege-liste [id^="kunde-"]:not([id*="-icon"]):not([id*="-details"]) {
        padding: 12px !important;
    }
    
    /* Kunden Details Grid */
    [id$="-details"] > div {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    
    [id$="-details"] > div > div {
        padding: 8px 10px !important;
    }
    
    [id$="-details"] [style*="font-size: 14px"] {
        font-size: 12px !important;
    }
    
    /* Verträge Tabelle in Kunden-Karte */
    #kunden-vertraege-liste table {
        font-size: 11px !important;
    }
    
    #kunden-vertraege-liste th,
    #kunden-vertraege-liste td {
        padding: 8px 4px !important;
    }
    
    /* Hide less important columns on mobile */
    #kunden-vertraege-liste th:nth-child(2),
    #kunden-vertraege-liste td:nth-child(2) {
        display: none !important;
    }
    
    /* === MODALS - Full Screen on Mobile === */
    .modal-content, .modal-dialog {
        width: 95% !important;
        max-width: none !important;
        margin: 10px auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        border-radius: 20px !important;
    }
    
    .modal-header {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        padding: 16px !important;
        border-radius: 20px 20px 0 0;
    }
    
    .modal-body {
        padding: 16px !important;
    }
    
    .modal-footer {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 16px !important;
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer button {
        width: 100%;
    }
    
    /* === CHARTS - Responsive === */
    canvas {
        max-height: 250px !important;
    }
    
    .chart-container {
        height: 250px !important;
    }
    
    /* === NAVIGATION TABS - Scrollable === */
    .nav-tabs, .tabs, .tab-list {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        padding-bottom: 8px;
    }
    
    .nav-tabs::-webkit-scrollbar,
    .tabs::-webkit-scrollbar {
        display: none;
    }
    
    .nav-tab, .tab, .tab-item {
        flex-shrink: 0 !important;
        padding: 10px 16px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }
    
    /* === BADGES - Smaller === */
    .badge, .status-badge, .tag {
        padding: 4px 8px !important;
        font-size: 10px !important;
        border-radius: 6px !important;
    }
    
    /* === HEADINGS - Scaled === */
    h1 { font-size: 24px !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 17px !important; }
    h4 { font-size: 15px !important; }
    
    /* === HIDE ON MOBILE === */
    .hide-mobile, .desktop-only {
        display: none !important;
    }
    
    /* === SHOW ON MOBILE === */
    .show-mobile, .mobile-only {
        display: block !important;
    }
    
    /* === PARTNER/ADMIN CARDS - Stacked === */
    .partner-card, .admin-card, .customer-card {
        flex-direction: column !important;
        padding: 14px !important;
    }
    
    .partner-card .avatar, .admin-card .avatar {
        width: 50px !important;
        height: 50px !important;
    }
    
    /* === KUNDEN-KARTEN (Meine Verträge) === */
    .kunden-vertraege-liste > div {
        border-radius: 14px !important;
    }
    
    .kunden-vertraege-liste > div > div:first-child {
        padding: 14px !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .kunden-vertraege-liste .kunde-info {
        flex-direction: row !important;
        width: 100%;
    }
    
    .kunden-vertraege-liste .kunde-stats {
        display: flex !important;
        gap: 20px !important;
        width: 100%;
        justify-content: space-around !important;
    }
    
    /* === KUNDEN DETAILS BOX === */
    [id$="-details"] {
        padding: 12px !important;
    }
    
    [id$="-details"] > div {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    
    [id$="-details"] > div > div {
        padding: 10px !important;
    }
    
    /* === BOTTOM FIXED ACTIONS === */
    .bottom-actions, .fixed-bottom {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 100;
        display: flex;
        gap: 10px;
    }
    
    /* === LOADING STATES === */
    .loading-spinner {
        width: 30px !important;
        height: 30px !important;
    }
    
    /* === TOASTS/NOTIFICATIONS === */
    .toast, .notification {
        left: 10px !important;
        right: 10px !important;
        max-width: none !important;
        bottom: calc(80px + env(safe-area-inset-bottom)) !important;
    }
}

/* === SMALL PHONES (iPhone SE, etc.) === */
@media screen and (max-width: 375px) {
    .stats-grid, .stat-cards {
        grid-template-columns: 1fr !important;
    }
    
    .stat-card h3 {
        font-size: 18px !important;
    }
    
    h1 { font-size: 20px !important; }
    h2 { font-size: 18px !important; }
    h3 { font-size: 15px !important; }
    
    .modal-content {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
    
    [id$="-details"] > div {
        grid-template-columns: 1fr !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎨 TOUCH ANIMATIONS & EFFECTS
   ═══════════════════════════════════════════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {
    /* Ripple effect placeholder */
    .ripple {
        position: relative;
        overflow: hidden;
    }
    
    .ripple::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.3s, height 0.3s;
    }
    
    .ripple:active::after {
        width: 200%;
        height: 200%;
    }
    
    /* Smooth transitions for mobile */
    * {
        transition-duration: 0.2s;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   📊 SPECIFIC COMPONENT OVERRIDES
   ═══════════════════════════════════════════════════════════════════════════ */

/* === PROVISIONS FILTER GRID === */
@media screen and (max-width: 768px) {
    .provisions-filter-grid,
    [style*="grid-template-columns: repeat(5"] {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .provisions-filter-grid > div:last-child,
    [style*="grid-template-columns: repeat(5"] > div:last-child {
        grid-column: span 2;
    }
}

/* === GREEN SUM BOX === */
@media screen and (max-width: 768px) {
    [style*="background: linear-gradient(135deg, #10b981"] {
        padding: 16px !important;
        border-radius: 14px !important;
    }
    
    [style*="background: linear-gradient(135deg, #10b981"] [style*="font-size: 32px"],
    [style*="background: linear-gradient(135deg, #10b981"] [style*="font-size: 2rem"] {
        font-size: 24px !important;
    }
}

/* === CHART GRID === */
@media screen and (max-width: 768px) {
    [style*="grid-template-columns: repeat(auto-fit, minmax(350px"],
    [style*="grid-template-columns: repeat(auto-fit, minmax(250px"],
    [style*="grid-template-columns: repeat(auto-fit, minmax(200px"],
    [style*="grid-template-columns: repeat(auto-fit, minmax(150px"] {
        grid-template-columns: 1fr !important;
    }
}

/* === DATUM FELDER KOMPAKT === */
@media screen and (max-width: 768px) {
    /* Datum-Inputs spezifisch klein */
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"] {
        height: 38px !important;
        padding: 6px 10px !important;
        font-size: 13px !important;
        min-height: 38px !important;
    }
    
    /* Select Felder kompakter */
    select {
        height: 40px !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
    
    /* Labels noch kleiner */
    label {
        font-size: 11px !important;
        margin-bottom: 3px !important;
        display: block;
    }
    
    /* Filter Container kompakt */
    [style*="margin-bottom: 25px"],
    [style*="margin-bottom: 20px"] {
        margin-bottom: 12px !important;
    }
    
    /* Grid Gap reduzieren */
    [style*="gap: 16px"],
    [style*="gap: 20px"],
    [style*="gap: 1rem"] {
        gap: 8px !important;
    }
    
    /* Padding in Cards reduzieren */
    [style*="padding: 20px"],
    [style*="padding: 24px"],
    [style*="padding: 1.5rem"] {
        padding: 12px !important;
    }
}

/* === BONUS WIDGET === */
@media screen and (max-width: 768px) {
    #bonus-widget {
        padding: 16px !important;
    }
    
    #bonus-widget h2 {
        font-size: 1.3rem !important;
    }
    
    #bonus-stufen-container > div {
        padding: 14px !important;
    }
}

/* === AKADEMIE MODULE CARDS === */
@media screen and (max-width: 768px) {
    .modul-card, [class*="modul"] {
        padding: 14px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   🔧 PARTNER DASHBOARD - MOBILE FIXES (18.12.2025)
   ═══════════════════════════════════════════════════════════════════════════ */

@media screen and (max-width: 968px) {
    
    /* === FIX: Doppeltes Menü entfernen === */
    /* Topbar komplett verstecken auf Mobile - wir nutzen mobile-header */
    .topbar {
        display: none !important;
    }
    
    /* Mobile Header immer anzeigen */
    .mobile-header {
        display: flex !important;
    }
    
    /* === FIX: Content nach oben, da keine Topbar === */
    .content {
        padding-top: 0 !important;
    }
    
    /* === FIX: Akademie Fortschritt Box === */
    #page-akademie .data-card:first-child,
    [style*="background: linear-gradient(135deg, #3b82f6"][style*="border-radius: 20px"] {
        padding: 20px !important;
        margin: 0 0 16px 0 !important;
    }
    
    /* Akademie Stats Grid - 3 Spalten werden zu einer Reihe */
    #page-akademie [style*="display: grid"][style*="grid-template-columns: repeat(3"] {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    #page-akademie [style*="display: grid"][style*="grid-template-columns: repeat(3"] > div {
        padding: 12px 8px !important;
        text-align: center;
    }
    
    #page-akademie [style*="font-size: 28px"],
    #page-akademie [style*="font-size: 24px"] {
        font-size: 18px !important;
    }
    
    #page-akademie [style*="font-size: 13px"],
    #page-akademie [style*="font-size: 12px"] {
        font-size: 11px !important;
    }
    
    /* === FIX: Provision nach Kategorie Chart === */
    #page-dashboard [style*="Provision nach Kategorie"],
    .chart-card,
    [style*="min-height: 300px"] {
        width: 100% !important;
        overflow: hidden !important;
    }
    
    /* Charts nicht abschneiden */
    canvas {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* === FIX: Bonus & Ziele Staffeln === */
    #page-provisionen .data-card,
    #bonus-stufen-container {
        padding: 16px !important;
    }
    
    /* Staffel Cards */
    #bonus-stufen-container > div,
    [style*="border-left: 4px solid"] {
        padding: 16px !important;
        margin-bottom: 12px !important;
    }
    
    /* Staffel Inhalt - nebeneinander */
    #bonus-stufen-container > div > div:first-child {
        display: flex !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 12px !important;
    }
    
    /* Medaille Icon kleiner */
    #bonus-stufen-container img,
    [src*="medal"] {
        width: 48px !important;
        height: 48px !important;
    }
    
    /* Staffel Text */
    #bonus-stufen-container [style*="font-size: 18px"],
    #bonus-stufen-container [style*="font-size: 1.1rem"] {
        font-size: 16px !important;
    }
    
    /* Fortschrittsbalken volle Breite */
    #bonus-stufen-container [style*="height: 12px"],
    .progress-bar {
        width: 100% !important;
        height: 10px !important;
        border-radius: 5px !important;
    }
    
    /* Status Badge rechts oben */
    #bonus-stufen-container [style*="position: absolute"] {
        position: relative !important;
        margin-top: 8px !important;
    }
    
    /* === FIX: Filter bei Meine Verträge - Kompakter === */
    #page-meine-vertraege [style*="display: grid"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    /* Filter Labels kleiner */
    #page-meine-vertraege label {
        font-size: 11px !important;
        margin-bottom: 4px !important;
    }
    
    /* Filter Inputs kleiner */
    #page-meine-vertraege select,
    #page-meine-vertraege input[type="date"],
    #page-meine-vertraege input[type="text"] {
        height: 40px !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
    
    /* Datum-Felder volle Breite auf sehr kleinen Screens */
    #page-meine-vertraege [style*="Von Datum"],
    #page-meine-vertraege [style*="Bis Datum"] {
        width: 100% !important;
    }
    
    /* Buttons nebeneinander */
    #page-meine-vertraege [style*="display: flex"][style*="gap"] {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    #page-meine-vertraege button {
        flex: 1 1 auto !important;
        min-width: 100px !important;
        padding: 10px 12px !important;
        font-size: 12px !important;
    }
    
    /* === FIX: Partner Empfehlungen === */
    #page-empfehlungen .data-card {
        padding: 16px !important;
    }
    
    #page-empfehlungen ol {
        padding-left: 20px !important;
    }
    
    #page-empfehlungen li {
        margin-bottom: 12px !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
    }
    
    /* Empfehlungen Buttons */
    #page-empfehlungen [style*="display: flex"][style*="gap"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    #page-empfehlungen button {
        width: 100% !important;
    }
    
    /* === FIX: Einstellungen Seite === */
    #page-einstellungen .data-card {
        padding: 16px !important;
    }
    
    #page-einstellungen [style*="display: grid"][style*="2"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* === ALLGEMEIN: Alles zentriert, nichts abgeschnitten === */
    .page-section {
        padding: 0 !important;
        overflow-x: hidden !important;
    }
    
    .data-card {
        margin: 0 0 12px 0 !important;
        border-radius: 16px !important;
        overflow: hidden !important;
    }
    
    /* Keine horizontale Scrollbar */
    body, html {
        overflow-x: hidden !important;
    }
    
    /* Container volle Breite */
    .container, .content, .page-content {
        max-width: 100% !important;
        padding: 12px !important;
    }
}

/* === FIX: Akademie Module Cards - Komplett responsive === */
    #page-akademie .modul-card,
    #page-akademie [onclick*="openModul"] {
        padding: 16px !important;
        border-radius: 16px !important;
    }
    
    /* Modul Card inneres Layout - alles untereinander */
    #page-akademie .modul-card > div,
    #page-akademie [onclick*="openModul"] > div {
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    /* Icon + Content nebeneinander bleiben, aber kleiner */
    #page-akademie .modul-card > div > div:first-child,
    #page-akademie [onclick*="openModul"] > div > div:first-child {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    /* Modul Icon kleiner */
    #page-akademie [style*="width: 90px"][style*="height: 90px"] {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        font-size: 1.8rem !important;
        border-radius: 14px !important;
    }
    
    /* Modul Titel kleiner */
    #page-akademie h3 {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
    }
    
    /* Badges in einer Reihe wrappen */
    #page-akademie [style*="display: flex"][style*="gap: 1rem"] {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    
    /* Badges kleiner */
    #page-akademie span[style*="padding: 0.4rem"] {
        padding: 4px 10px !important;
        font-size: 0.7rem !important;
    }
    
    /* Beschreibungstext */
    #page-akademie p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        margin-bottom: 12px !important;
    }
    
    /* Lektionen/Dauer Grid */
    #page-akademie [style*="grid-template-columns: repeat(auto-fit, minmax(140px"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    
    /* Lektionen Box kleiner */
    #page-akademie [style*="width: 40px"][style*="height: 40px"] {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* Tags kleiner */
    #page-akademie span[style*="padding: 0.6rem"] {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
    }
    
    /* Action Button rechts - volle Breite */
    #page-akademie .modul-action-button,
    #page-akademie [style*="text-align: right"] {
        text-align: center !important;
        min-width: auto !important;
        width: 100% !important;
    }
    
    #page-akademie .modul-action-button {
        padding: 12px 20px !important;
        font-size: 0.9rem !important;
        display: block !important;
        width: 100% !important;
    }
    
    /* Progress Text zentriert */
    #page-akademie .modul-progress-text {
        text-align: center !important;
        margin-top: 8px !important;
    }
}

/* === EXTRA SMALL PHONES === */
@media screen and (max-width: 400px) {
    /* Filter Grid auf 1 Spalte */
    #page-meine-vertraege [style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Akademie Stats auch 1 Spalte */
    #page-akademie [style*="display: grid"][style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Buttons untereinander */
    #page-meine-vertraege button {
        width: 100% !important;
    }
    
    /* Akademie Lektionen/Dauer auch 1 Spalte */
    #page-akademie [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   📱 KRITISCHE MOBILE SCROLL FIXES (07.01.2026)
   - Onboarding Widget Scroll
   - Sidebar letzte Items erreichbar
   - Forms & Content Scroll
   ═══════════════════════════════════════════════════════════════════════════ */

@media screen and (max-width: 968px) {
    /* === KRITISCH: Body & HTML SCROLL ERLAUBEN === */
    html, body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        position: relative !important;
    }

    /* === KRITISCH: Main Content SCROLL ERLAUBEN === */
    .main-content, .content, .dashboard-content {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        height: auto !important;
        min-height: 100vh !important;
        padding-bottom: 120px !important; /* Platz am Ende für Scroll */
    }

    /* === KRITISCH: Onboarding Widget === */
    #onboarding-widget {
        overflow: visible !important;
        max-height: none !important;
    }

    #onboarding-widget [style*="grid"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    #onboarding-widget > div {
        flex-direction: column !important;
    }

    /* Onboarding Steps - untereinander */
    #onboarding-steps {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    #onboarding-steps > div {
        min-width: 100% !important;
        width: 100% !important;
    }

    /* === KRITISCH: Sidebar SCROLL & letzte Items === */
    .sidebar {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: flex !important;
        flex-direction: column !important;
        padding-bottom: 150px !important; /* Extra Platz für letzte Items */
    }

    .sidebar-nav, .sidebar .tabs, .sidebar nav {
        overflow-y: visible !important;
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Sidebar Items - alle gleich */
    .sidebar .tab, .sidebar .nav-item, .sidebar a {
        flex-shrink: 0 !important;
        min-height: 48px !important;
    }

    /* Letzte 3 Items in Sidebar sichtbar */
    .sidebar .tab:nth-last-child(1),
    .sidebar .tab:nth-last-child(2),
    .sidebar .tab:nth-last-child(3),
    .sidebar a:nth-last-child(1),
    .sidebar a:nth-last-child(2),
    .sidebar a:nth-last-child(3) {
        margin-bottom: 8px !important;
    }

    /* === Page Sections - SCROLL ERLAUBEN === */
    .page-section, [id^="page-"] {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: none !important;
        height: auto !important;
    }

    /* === Data Cards - Nicht abschneiden === */
    .data-card {
        overflow: visible !important;
        max-height: none !important;
    }

    /* === Akademie Module - SCROLL & Layout === */
    #page-akademie {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 100px !important;
    }

    #page-akademie > div {
        overflow: visible !important;
    }

    /* === Provisionen Seite - SCROLL === */
    #page-provisionen {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 100px !important;
    }

    /* === Meine Verträge Seite - SCROLL === */
    #page-meine-vertraege {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 100px !important;
    }

    /* === Einstellungen Seite - SCROLL === */
    #page-einstellungen {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 100px !important;
    }

    /* === Forms - Touch-freundlich === */
    form {
        overflow: visible !important;
    }

    input, select, textarea, button {
        min-height: 44px !important;
        font-size: 16px !important; /* Verhindert iOS Zoom */
    }

    /* === Modals - SCROLL ERLAUBEN === */
    .modal-body, .modal-content {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: 80vh !important;
    }

    /* === Bonus Widget - Komplett sichtbar === */
    #bonus-widget, [id*="bonus"] {
        overflow: visible !important;
        max-height: none !important;
    }

    #bonus-stufen-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    /* === Quick Stats Grid - 2 Spalten === */
    .stats-grid, .stat-cards, .quick-stats, #stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* === Entdecken Widget Cards === */
    #entdecken-widget [style*="grid"] {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    #entdecken-widget [style*="grid"] > div {
        padding: 1rem !important;
    }

    #entdecken-widget [style*="font-size: 2.5rem"] {
        font-size: 1.5rem !important;
    }
}

/* === EXTRA SMALL PHONES (iPhone SE) === */
@media screen and (max-width: 375px) {
    /* Stats auf 1 Spalte */
    .stats-grid, .stat-cards, .quick-stats, #stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Entdecken Cards auf 1 Spalte */
    #entdecken-widget [style*="grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Noch mehr Platz am Ende */
    .main-content, .content {
        padding-bottom: 150px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   🌙 DARK MODE SUPPORT (für zukünftige Implementation)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
    /* Dark mode styles hier hinzufügen wenn benötigt */
}

/* ═══════════════════════════════════════════════════════════════════════════
   ⚡ PERFORMANCE OPTIMIZATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* GPU acceleration for smooth animations */
.sidebar,
.modal-content,
.mobile-header,
.toast,
.notification {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce repaints */
@media screen and (max-width: 768px) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}
