/* Mobile First Responsive Design für CRMTalks */

/* Touch-optimierte Grundlagen */
* {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Verbesserte Touch-Targets */
a, button, .btn, .clickable {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Navigation Verbesserungen */
@media (max-width: 768px) {
    /* Header Mobile Optimierung */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: white;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .header-content {
        padding: 0.75rem 1rem;
    }
    
    .logo img {
        max-height: 40px;
        width: auto;
    }
    
    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        width: 44px;
        height: 44px;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        background: transparent;
        border: none;
        cursor: pointer;
    }
    
    .mobile-menu-toggle span {
        width: 24px;
        height: 3px;
        background: #333;
        transition: all 0.3s ease;
        border-radius: 2px;
    }
    
    /* Fullscreen Mobile Navigation */
    .main-nav {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .main-nav.active {
        transform: translateX(0);
    }
    
    .main-nav ul {
        flex-direction: column;
        padding: 1rem;
    }
    
    .main-nav li {
        width: 100%;
        margin: 0;
    }
    
    .main-nav a {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid #eee;
        font-size: 1.1rem;
    }
    
    /* Dropdown Mobile */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f8f9fa;
        padding-left: 1rem;
        display: none;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
    }
    
    /* Content Spacing */
    .section {
        padding: 2rem 0;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    /* Typography Mobile */
    h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* Buttons Mobile */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        border-radius: 8px;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Cards Mobile */
    .card, .crm-card, .blog-post, .article-card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
        overflow: hidden;
    }
    
    /* Grid Mobile */
    .grid, .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Tables Mobile - Horizontal Scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Forms Mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    select,
    textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 16px; /* Verhindert Zoom auf iOS */
        border-radius: 8px;
        border: 2px solid #ddd;
    }
    
    /* CRM Detail Page Mobile */
    .crm-header {
        flex-direction: column;
        text-align: center;
    }
    
    .crm-logo {
        margin-bottom: 1rem;
    }
    
    .price-tag {
        font-size: 1.25rem;
    }
    
    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .tab-button {
        flex-shrink: 0;
        padding: 0.75rem 1rem;
    }
    
    /* Blog Mobile */
    .blog-hero {
        padding: 2rem 0;
    }
    
    .blog-categories {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        margin: 0 -1rem 2rem;
        padding: 0 1rem 0.5rem;
        gap: 0.5rem;
    }
    
    .category-filter {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Glossar Mobile */
    .glossar-navigation {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .letter-link {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    /* FAQ Mobile */
    .faq-question {
        padding-right: 2rem;
        position: relative;
    }
    
    .faq-toggle {
        position: absolute;
        right: 0;
        top: 0;
        width: 44px;
        height: 44px;
    }
    
    /* Footer Mobile */
    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    .footer-column {
        width: 100%;
    }
    
    /* Swipe Indicators */
    .swipe-indicator {
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: #666;
        margin-top: 0.5rem;
    }
    
    /* Mobile Utility Classes */
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}

/* Tablet Optimierungen */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 2rem;
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch-Gesten Unterstützung */
.swipeable {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

.swipeable > * {
    scroll-snap-align: start;
}

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

/* Accessibility für Mobile */
.sr-only-mobile {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Performance-Optimierungen */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-load.loaded {
    opacity: 1;
}

/* PWA-Ready Styles */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: #005a73;
    color: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: none;
    z-index: 1000;
}

.install-prompt.show {
    display: block;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: #ff6b6b;
    color: white;
    padding: 0.5rem;
    text-align: center;
    display: none;
}

body.offline .offline-indicator {
    display: block;
}

/* Bottom Navigation für Mobile */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #eee;
    z-index: 999;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        padding: 0.5rem 0;
    }
    
    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        color: #666;
        text-decoration: none;
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .mobile-bottom-nav a.active {
        color: #005a73;
    }
    
    .mobile-bottom-nav i {
        font-size: 1.25rem;
    }
    
    /* Adjust content for bottom nav */
    body {
        padding-bottom: 60px;
    }
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Pull to Refresh */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    z-index: 999;
}

.pull-to-refresh.show {
    transform: translateY(60px);
}

/* Improved Focus States for Mobile */
:focus {
    outline: 3px solid rgba(0, 90, 115, 0.5);
    outline-offset: 2px;
}

/* Remove focus on touch */
:focus:not(:focus-visible) {
    outline: none;
}

/* Print Styles */
@media print {
    .header, .footer, .mobile-menu-toggle, .mobile-bottom-nav {
        display: none;
    }
    
    body {
        padding: 0;
    }
    
    .container {
        max-width: 100%;
    }
}