/* ========================================
   MOBILE OPTIMIZATION STYLESHEET
   ======================================== */

/* GLOBAL TITLE FIX - ENSURE READABILITY */
.title,
h1.title,
h2.title,
h3.title,
h4.title,
h5.title {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    background: none !important;
    background-color: transparent !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.7) !important;
    font-weight: bold !important;
    text-decoration: none !important;
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.9)) !important;
}

/* ========================================
   TOUCH DEVICE DETECTION & OPTIMIZATION
   ======================================== */

/* DESKTOP / LARGE SCREENS - Grid Layouts */
@media (min-width: 1025px) {
    .stats-grid-dash {
        display: grid !important;
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 1.5rem !important;
    }
    
    .stats-grid,
    .stats-grid-admin,
    .stats-grid-modern {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
        gap: 1.25rem !important;
    }
}

@media (hover: none) and (pointer: coarse) {
    /* Touch devices - deaktiviere hover effects */
    .btn,
    .nav-links a,
    .nav-section a,
    .sidebar-nav-item,
    .card,
    .service-card,
    .license-item,
    .contact-toggle-btn {
        -webkit-tap-highlight-color: transparent;
        /* Minimum Touch Target */
        min-height: 48px;
        min-width: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Deaktiviere Hover-Transforms auf Touch */
    .btn:hover,
    .card:hover,
    .service-card:hover,
    .license-item:hover {
        transform: none;
    }

    /* Active/Press-State statt Hover */
    .btn:active,
    .card:active,
    .service-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Touch-freundliche Inputs */
    input,
    textarea,
    select,
    button {
        font-size: 16px; /* Verhindert Zoom auf iOS */
        padding: 12px 14px;
        min-height: 44px;
    }

    /* Entferne Hover-Schatten */
    .card:hover {
        box-shadow: none;
    }

    /* Tabellen optimieren */
    .table tbody tr:hover {
        background: transparent;
    }

    .table tbody tr:active {
        background: rgba(0, 229, 153, 0.1);
    }
}

/* ========================================
   TABLET OPTIMIZATION (768px - 1024px)
   ======================================== */

@media (max-width: 1024px) and (min-width: 768px) {
    /* ========================================
       HAMBURGER MENÜ FÜR TABLET
       ======================================== */
    
    /* Hamburger Button für Tablet */
    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        background: linear-gradient(135deg, rgba(0, 229, 153, 0.15), rgba(0, 150, 210, 0.1));
        border: 1px solid rgba(0, 229, 153, 0.3);
        border-radius: 12px;
        color: var(--accent-primary);
        font-size: 1.5rem;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        z-index: 1001;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        flex-shrink: 0;
    }

    .sidebar-toggle:hover {
        background: linear-gradient(135deg, rgba(0, 229, 153, 0.25), rgba(0, 150, 210, 0.2));
        border-color: rgba(0, 229, 153, 0.5);
        transform: scale(1.05);
    }

    /* Sidebar als Overlay für Tablet */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        padding: 5.5rem 2rem 2rem 2rem;
        border-radius: 0;
        border-right: 1px solid var(--border-medium);
        background: linear-gradient(180deg, rgba(15, 20, 29, 0.98), rgba(10, 14, 23, 0.98));
        backdrop-filter: blur(20px);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0 !important;
    }

    /* Overlay für Tablet */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 999;
        backdrop-filter: blur(4px);
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Schließen-Button für Tablet */
    .sidebar-close {
        position: absolute;
        top: 1.25rem;
        right: 1.25rem;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-subtle);
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 1.5rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .sidebar-close:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: var(--accent-primary);
        color: var(--accent-primary);
    }

    /* Layout anpassen */
    .layout {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    .main {
        width: 100%;
        padding-top: 5rem;
    }

    /* Top Bar für Tablet */
    .top-bar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 998;
        background: linear-gradient(180deg, rgba(15, 20, 29, 0.95), rgba(10, 14, 23, 0.9));
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border-subtle);
        padding: 1rem 1.25rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    .top-bar-title {
        font-size: 1.25rem !important;
        margin: 0 !important;
        flex: 1;
        text-align: center;
    }

    /* Grid-Layouts für Tablet - 2 Spalten */
    .grid-col-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Admin & Dashboard Stats - 3 Spalten auf Tablet */
    .stat-container,
    .stats-grid,
    .stats-grid-admin,
    .stats-grid-modern {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
    
    /* Dashboard Stats bleiben flexibel - wird von customer-pages.css gesteuert */
    .stats-grid-dash {
        gap: 1rem !important;
    }

    /* Stat Cards kompakter auf Tablet */
    .stat-card,
    .stat-card-admin,
    .stat-card-modern,
    .stat-card-dash {
        padding: 1.25rem 1rem;
    }

    .stat-value,
    .stat-value-admin,
    .stat-value-modern,
    .stat-value-dash {
        font-size: 1.65rem;
    }

    .stat-icon,
    .stat-icon-admin,
    .stat-icon-modern,
    .stat-icon-dash {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .stat-label,
    .stat-label-admin,
    .stat-label-modern,
    .stat-label-dash {
        font-size: 0.8rem;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Padding reduzieren */
    .container {
        padding: 1.5rem 1.25rem;
    }

    /* Fonts optimieren */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    /* Cards kompakter */
    .card {
        padding: 1.25rem;
        overflow: visible !important;
        margin-bottom: 1rem;
    }

    /* Buttons breiter aber nicht vollbreit */
    .btn {
        padding: 0.875rem 1.5rem;
    }

    /* Kontaktformular für Tablet */
    .contact-slide-in {
        width: 340px;
    }

    /* Kontakt Button - Tablet optimiert */
    .contact-floating-btn {
        bottom: 24px;
        right: 24px;
        padding: 14px 24px;
        font-size: 15px;
        gap: 10px;
        box-shadow: 0 6px 20px rgba(0, 208, 132, 0.35);
        border-radius: 50px;
    }

    .contact-floating-btn svg {
        width: 22px;
        height: 22px;
    }

    /* Kontakt Panel - Tablet optimiert */
    .contact-panel {
        max-width: 520px;
        width: 85%;
        padding: 28px;
        border-radius: 16px;
    }

    .contact-panel-header h3 {
        font-size: 1.4rem;
    }

    .contact-form input,
    .contact-form textarea {
        font-size: 16px;
        padding: 12px 14px;
    }

    /* Installation Guide */
    .install-content {
        grid-template-columns: 1fr 1.5fr;
    }

    /* Modals optimieren */
    .modal-content {
        max-width: 90vw;
        width: 90vw;
    }
}

/* ========================================
   SMARTPHONE OPTIMIZATION (<768px)
   ======================================== */

@media (max-width: 768px) {
    /* Basis Layout */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    html {
        scroll-behavior: smooth;
        /* Verhindere horizontal scrolling */
        overflow-x: hidden;
        width: 100%;
    }

    body {
        overflow-x: hidden;
        width: 100%;
    }

    /* Container & Padding */
    .container {
        padding: 1rem 0.875rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Prevent horizontal scroll from cards */
    .container > * {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* ========================================
       HAMBURGER MENÜ FÜR MOBILE
       ======================================== */
    
    /* Hamburger Button */
    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: linear-gradient(135deg, rgba(0, 229, 153, 0.15), rgba(0, 150, 210, 0.1));
        border: 1px solid rgba(0, 229, 153, 0.3);
        border-radius: 12px;
        color: var(--accent-primary);
        font-size: 1.5rem;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        z-index: 1001;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        flex-shrink: 0;
    }

    .sidebar-toggle:hover,
    .sidebar-toggle:active {
        background: linear-gradient(135deg, rgba(0, 229, 153, 0.25), rgba(0, 150, 210, 0.2));
        border-color: rgba(0, 229, 153, 0.5);
        transform: scale(1.05);
    }

    /* Sidebar als Overlay */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        padding: 5rem 1.5rem 2rem 1.5rem;
        border-radius: 0;
        border-right: 1px solid var(--border-medium);
        background: linear-gradient(180deg, rgba(15, 20, 29, 0.98), rgba(10, 14, 23, 0.98));
        backdrop-filter: blur(20px);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0 !important;
    }

    /* Overlay hinter Sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 999;
        backdrop-filter: blur(4px);
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Schließen-Button in Sidebar */
    .sidebar-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-subtle);
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 1.5rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .sidebar-close:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: var(--accent-primary);
        color: var(--accent-primary);
    }

    /* Layout anpassen */
    .layout {
        flex-direction: column;
        gap: 0;
        padding: 0;
        min-height: auto;
    }

    .main {
        width: 100%;
        padding-top: 4.5rem;
    }

    /* Top Bar für Mobile */
    .top-bar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 998;
        background: linear-gradient(180deg, rgba(15, 20, 29, 0.95), rgba(10, 14, 23, 0.9));
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border-subtle);
        padding: 0.875rem 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    .top-bar-title {
        font-size: 1.125rem !important;
        margin: 0 !important;
        flex: 1;
        text-align: center;
    }

    /* Body padding für fixed header */
    body {
        padding-top: 0 !important;
    }

    /* ========================================
       KONTAKT BUTTON & FORMULAR - MOBILE
       ======================================== */
    
    /* Kontakt Floating Button - Mobile optimiert */
    .contact-floating-btn {
        position: fixed;
        bottom: 16px;
        right: 16px;
        padding: 12px 18px;
        font-size: 14px;
        gap: 8px;
        border-radius: 50px;
        min-width: 48px;
        min-height: 48px;
        z-index: 997 !important; /* Unter Sidebar aber über Content */
        box-shadow: 0 4px 16px rgba(0, 208, 132, 0.4);
        backdrop-filter: blur(10px);
    }

    .contact-floating-btn svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .contact-floating-btn span {
        font-size: 14px;
        font-weight: 600;
    }

    /* Verhindere Konflikt mit Sidebar Toggle */
    .contact-floating-btn:active {
        transform: scale(0.95);
    }

    /* Kontakt Overlay - Mobile */
    .contact-overlay {
        z-index: 9998 !important;
        backdrop-filter: blur(6px);
    }

    /* Kontakt Panel - Mobile optimiert */
    .contact-panel {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: calc(100% - 32px);
        width: calc(100% - 32px);
        max-height: calc(100vh - 100px);
        padding: 20px;
        border-radius: 16px;
        z-index: 9999 !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .contact-panel.active {
        transform: translate(-50%, -50%) scale(1);
    }

    /* Panel Header - Mobile */
    .contact-panel-header {
        margin-bottom: 20px;
        padding-bottom: 12px;
        position: sticky;
        top: -20px;
        background: rgba(35, 38, 58, 0.98);
        z-index: 10;
        padding-top: 0;
    }

    .contact-panel-header h3 {
        font-size: 1.25rem;
        font-weight: 700;
    }

    /* Close Button - Mobile optimiert */
    .contact-close-btn {
        width: 40px;
        height: 40px;
        font-size: 1.75rem;
        min-width: 44px;
        min-height: 44px;
        border-radius: 8px;
    }

    /* Form Groups - Mobile */
    .contact-form .form-group {
        margin-bottom: 18px;
    }

    .contact-form label {
        margin-bottom: 6px;
        font-size: 14px;
        font-weight: 600;
    }

    /* Form Inputs - Mobile Touch optimiert */
    .contact-form input,
    .contact-form textarea {
        width: 100%;
        padding: 14px 12px;
        font-size: 16px !important; /* Verhindert Zoom auf iOS */
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
        -webkit-appearance: none;
        appearance: none;
        min-height: 48px;
    }

    .contact-form input:focus,
    .contact-form textarea:focus {
        border-color: var(--accent-primary, #00d084);
        background: rgba(255, 255, 255, 0.12);
        outline: none;
    }

    .contact-form textarea {
        min-height: 120px;
        resize: vertical;
    }

    /* Submit Button - Mobile */
    .contact-form .btn-primary,
    .contact-form button[type="submit"] {
        width: 100%;
        padding: 14px 24px;
        font-size: 16px;
        font-weight: 600;
        min-height: 52px;
        border-radius: 12px;
        margin-top: 8px;
        -webkit-tap-highlight-color: transparent;
    }

    /* Message - Mobile */
    .contact-message {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 16px;
        font-size: 14px;
    }

    /* Scrollbar für Panel */
    .contact-panel::-webkit-scrollbar {
        width: 6px;
    }

    .contact-panel::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 3px;
    }

    .contact-panel::-webkit-scrollbar-thumb {
        background: rgba(0, 208, 132, 0.3);
        border-radius: 3px;
    }

    /* Positionierung anpassen wenn Sidebar offen */
    .sidebar.active ~ * .contact-floating-btn {
        opacity: 0.3;
        pointer-events: none;
    }

    /* Navbar optimieren */
    .navbar {
        padding: 0.75rem 1rem;
    }

    .nav-container {
        position: relative;
    }

    .logo {
        font-size: 1rem;
    }

    .logo img {
        width: 32px;
        height: 32px;
    }

    /* Hamburger Menu Button */
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: var(--text-primary);
        font-size: 1.25rem;
        cursor: pointer;
        padding: 0.625rem;
        border-radius: var(--radius-md);
        transition: all var(--transition-fast);
        width: 44px;
        height: 44px;
        z-index: 1201;
    }

    .menu-toggle:hover {
        background: rgba(255, 255, 255, 0.15);
        border-color: var(--accent-primary);
        color: var(--accent-primary);
    }

    /* Mobile Navigation Links */
    .nav-links {
        position: absolute;
        top: calc(100% + 1rem);
        right: 0;
        background: linear-gradient(180deg, rgba(10, 14, 23, 0.98), rgba(10, 14, 23, 0.95));
        backdrop-filter: blur(20px);
        border: 1px solid var(--border-medium);
        border-radius: var(--radius-lg);
        padding: 1rem;
        gap: 0.5rem;
        flex-direction: column;
        min-width: 200px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all var(--transition-base);
        z-index: 1200;
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-links a {
        padding: 0.875rem 1rem;
        font-size: 1rem;
        min-height: 44px;
        width: 100%;
        text-align: left;
    }

    /* Typography */
    h1, .title {
        font-size: clamp(1.5rem, 6vw, 2.25rem) !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        background: none !important;
        line-height: 1.2;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 0, 0, 0.7) !important;
        font-weight: bold !important;
    }

    h2 {
        font-size: 1.375rem;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 0, 0, 0.7) !important;
        font-weight: bold !important;
    }

    h3 {
        font-size: 1.125rem;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 0, 0, 0.7) !important;
        font-weight: bold !important;
    }

    h4 {
        font-size: 1rem;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 0, 0, 0.7) !important;
        font-weight: bold !important;
    }

    h5 {
        font-size: 0.875rem;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 0, 0, 0.7) !important;
        font-weight: bold !important;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* Buttons - volle Breite */
    .btn {
        width: 100%;
        padding: 0.875rem 1rem;
        border-radius: 10px;
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    .btn + .btn {
        margin-top: 0.5rem;
    }

    /* Cards kompakter */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
        overflow: visible !important;
        min-height: auto !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    .kpi {
        padding: 1rem;
    }

    .kpi .value {
        font-size: 1.75rem;
    }

    .kpi .label {
        font-size: 0.8rem;
    }

    /* Grid Layouts - inkl. Admin Stats */
    .grid-col-2,
    .grid-col-3,
    .dashboard-stats,
    .services-grid,
    .profile-grid,
    .install-content {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Feature Cards auf Homepage - prevent clipping */
    .container > div[style*="display: grid"] .card {
        overflow: visible !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    /* Dashboard Stats - wird von customer-pages.css gesteuert */
    .stats-grid-admin,
    .stats-grid-modern,
    .stats-grid-dash {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Admin Stat Cards - Mobile */
    .stat-card,
    .stat-card-admin,
    .stat-card-modern,
    .stat-card-dash {
        padding: 1.25rem 1rem;
        text-align: center;
    }

    .stat-value,
    .stat-value-admin,
    .stat-value-modern,
    .stat-value-dash {
        font-size: 1.75rem;
    }

    .stat-icon,
    .stat-icon-admin,
    .stat-icon-modern,
    .stat-icon-dash {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .stat-label,
    .stat-label-admin,
    .stat-label-modern,
    .stat-label-dash {
        font-size: 0.8rem;
    }

    /* Tables Mobile-friendly */
    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    /* Forms optimieren */
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    input,
    textarea,
    select {
        width: 100%;
        padding: 0.875rem;
        font-size: 16px; /* iOS Zoom Prevention */
        border-radius: 10px;
    }

    /* Kontaktformular */
    .contact-slide-in {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        max-height: 70vh;
    }

    .contact-toggle-btn {
        width: 60px;
        height: 60px;
        font-size: 1.75rem;
        bottom: 20px;
        right: 20px;
        z-index: 9998;
    }

    .contact-slide-header {
        padding: 1.25rem;
    }

    .contact-form {
        padding: 1.25rem;
    }

    .form-group {
        margin-bottom: 0.875rem;
    }

    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

    /* Modal optimieren */
    .modal-content {
        width: calc(100vw - 20px);
        max-width: 100%;
        padding: 1.25rem;
        margin: 20% auto;
        max-height: 80vh;
        border-radius: 16px;
    }

    .modal-header h3 {
        font-size: 1.25rem;
    }

    /* Installation Guide */
    .installation-container {
        padding: 1rem;
    }

    .install-header {
        padding: 2rem 1rem;
    }

    .install-header h1 {
        font-size: 1.75rem;
    }

    .install-content {
        gap: 1rem;
    }

    .license-sidebar {
        position: static;
        max-height: none;
    }

    .install-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    .install-tab {
        padding: 0.875rem 1rem;
        white-space: nowrap;
    }

    .install-section {
        padding: 1.25rem;
    }

    .code-block {
        padding: 0.875rem;
        font-size: 0.8rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Footer */
    .footer {
        padding: 2rem 1rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    /* Alerts & Notifications */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    /* Dashboard spezifisch */
    .welcome-header {
        flex-direction: column;
        padding: 1.5rem;
        text-align: center;
    }

    .welcome-text h1 {
        font-size: 1.75rem;
    }

    .balance-widget {
        width: 100%;
    }

    .license-item {
        flex-direction: column;
        padding: 1rem;
    }

    /* Section Headers */
    .section-header {
        flex-direction: column;
        gap: 1rem;
    }

    .section-header a {
        width: 100%;
    }

    /* Badges */
    .badge {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Links */
    a {
        touch-action: manipulation;
    }

    /* Dropdown Menus */
    select {
        appearance: none;
        padding-right: 2rem;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 1.5rem;
        padding-right: 2.5rem;
    }

    /* Status Badges */
    .status-dot {
        width: 10px;
        height: 10px;
    }

    /* Icons */
    .icon {
        font-size: 1.5rem;
    }

    /* Spacing Utilities */
    .mt-1 { margin-top: 0.5rem; }
    .mt-2 { margin-top: 0.75rem; }
    .mt-3 { margin-top: 1rem; }
    .mt-4 { margin-top: 1.5rem; }

    .mb-1 { margin-bottom: 0.5rem; }
    .mb-2 { margin-bottom: 0.75rem; }
    .mb-3 { margin-bottom: 1rem; }
    .mb-4 { margin-bottom: 1.5rem; }

    .px-1 { padding-left: 0.5rem; padding-right: 0.5rem; }
    .px-2 { padding-left: 0.75rem; padding-right: 0.75rem; }

    /* Prevent zoom on input focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px;
    }

    /* Reduce motion for animations on mobile */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation: none !important;
            transition: none !important;
        }
    }
}

/* ========================================
   SMALL PHONE OPTIMIZATION (<480px)
   ======================================== */

@media (max-width: 480px) {
    /* Extra kleine Screens */
    .container {
        padding: 0.75rem 0.625rem;
    }

    h1 {
        font-size: 1.375rem;
    }

    h2 {
        font-size: 1.125rem;
    }

    h3 {
        font-size: 1rem;
    }

    .btn {
        padding: 0.75rem 0.875rem;
        font-size: 0.9375rem;
    }

    .card {
        padding: 0.875rem;
        overflow: visible !important;
        min-height: auto !important;
    }

    .kpi .value {
        font-size: 1.5rem;
    }

    .logo {
        font-size: 0.9rem;
    }

    .logo img {
        width: 28px;
        height: 28px;
    }

    /* Modal auf extra kleinen Screens */
    .modal-content {
        width: calc(100vw - 10px);
        padding: 1rem;
    }

    /* Kontaktformular - Extra klein */
    .contact-slide-in {
        width: calc(100vw - 10px);
        right: 5px;
        bottom: 70px;
    }

    .contact-toggle-btn {
        width: 56px;
        height: 56px;
        font-size: 1.625rem;
        bottom: 16px;
        right: 16px;
    }

    /* ========================================
       KONTAKT BUTTON & PANEL - EXTRA KLEIN
       ======================================== */
    
    /* Kontakt Button - Extra klein */
    .contact-floating-btn {
        bottom: 12px;
        right: 12px;
        padding: 10px 16px;
        font-size: 13px;
        gap: 6px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 40px;
    }

    .contact-floating-btn svg {
        width: 18px;
        height: 18px;
    }

    .contact-floating-btn span {
        font-size: 13px;
    }

    /* Kontakt Panel - Extra klein */
    .contact-panel {
        max-width: calc(100% - 20px);
        width: calc(100% - 20px);
        max-height: calc(100vh - 60px);
        padding: 16px;
        border-radius: 12px;
    }

    .contact-panel-header {
        margin-bottom: 16px;
        padding-bottom: 10px;
    }

    .contact-panel-header h3 {
        font-size: 1.125rem;
    }

    .contact-close-btn {
        width: 36px;
        height: 36px;
        min-width: 40px;
        min-height: 40px;
        font-size: 1.5rem;
    }

    .contact-form .form-group {
        margin-bottom: 14px;
    }

    .contact-form label {
        font-size: 13px;
        margin-bottom: 5px;
    }

    .contact-form input,
    .contact-form textarea {
        padding: 12px 10px;
        font-size: 16px !important;
        border-radius: 8px;
        min-height: 44px;
    }

    .contact-form textarea {
        min-height: 100px;
    }

    .contact-form .btn-primary,
    .contact-form button[type="submit"] {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 48px;
        border-radius: 10px;
    }

    .contact-message {
        padding: 10px;
        font-size: 13px;
        margin-bottom: 14px;
    }

    /* Installation Guide */
    .install-header {
        padding: 1.5rem 1rem;
    }

    .install-header h1 {
        font-size: 1.5rem;
    }

    .install-section {
        padding: 1rem;
    }

    /* Code blocks */
    .code-block {
        padding: 0.75rem;
        font-size: 0.75rem;
    }

    .copy-button {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Table optimization */
    .table {
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }

    /* Input optimization */
    input,
    textarea,
    select {
        padding: 0.75rem 0.625rem;
        font-size: 16px;
    }

    /* Prevent long text overflow */
    p, span, a {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Navigation links smaller */
    .nav-links a {
        padding: 0.75rem 0.875rem;
        font-size: 0.95rem;
    }
}

/* ========================================
   LANDSCAPE OPTIMIZATION
   ======================================== */

@media (max-width: 1024px) and (orientation: landscape) {
    /* Reduce vertical height usage */
    .navbar {
        padding: 0.5rem 1rem;
    }

    .nav-links {
        height: calc(100vh - 50px);
        padding: 0.75rem;
        gap: 0.25rem;
    }

    .nav-links a {
        padding: 0.5rem 0.875rem;
        font-size: 0.9rem;
        min-height: 40px;
    }

    .container {
        padding: 0.75rem 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .card {
        padding: 0.875rem;
    }

    .modal-content {
        max-height: 80vh;
    }

    .welcome-header {
        padding: 1.25rem;
    }

    /* Sidebar in landscape */
    .sidebar {
        width: 220px;
        overflow-y: auto;
        max-height: calc(100vh - 60px);
    }
}

/* ========================================
   HIGH DPI / RETINA OPTIMIZATION
   ======================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Feinere Borders auf Retina */
    .btn,
    .card,
    input,
    textarea,
    select {
        border-width: 0.5px;
    }

    /* Optimiere Bilder */
    img {
        image-rendering: auto;
    }
}

/* ========================================
   NOTCH / SAFE AREA OPTIMIZATION
   ======================================== */

@supports (padding: env(safe-area-inset-top)) {
    body {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }

    .navbar {
        padding-top: max(0.75rem, env(safe-area-inset-top));
    }

    .footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }

    .contact-toggle-btn {
        bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
        right: max(20px, calc(20px + env(safe-area-inset-right)));
    }

    .contact-floating-btn {
        bottom: max(16px, calc(16px + env(safe-area-inset-bottom)));
        right: max(16px, calc(16px + env(safe-area-inset-right)));
    }
}

/* ========================================
   PRINT OPTIMIZATION
   ======================================== */

@media print {
    /* Hide elements in print */
    .navbar,
    .sidebar,
    .footer,
    .contact-toggle-btn,
    .btn-icon {
        display: none !important;
    }

    /* Optimize for print */
    body {
        background: white;
        color: black;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    a {
        color: inherit;
        text-decoration: none;
    }

    .card,
    .modal-content {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}
