/* ========================================
   RESPONSIVE OPTIMIZATIONS - FINAL VERSION
   Optimiert für: Mobile (320px+), Tablet (768px+), Desktop (1024px+)
   ======================================== */

/* ==================== BURGER MENU FIX ==================== */

/* Burger Menu - Indigo/Purple Theme */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 48px;
    height: 48px;
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid #6366f1;
    border-radius: 12px;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
    position: relative;
    -webkit-tap-highlight-color: rgba(99, 102, 241, 0.3);
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    min-width: 48px;
    min-height: 48px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.burger-menu:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #8b5cf6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.burger-menu:active {
    transform: scale(0.95);
    background: rgba(99, 102, 241, 0.3);
}

.burger-menu span {
    width: 24px;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    display: block;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

/* Burger Menu Active State (X-Icon) */
.burger-menu.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: #8b5cf6;
}

.burger-menu.active span {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.burger-menu.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.burger-menu.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ==================== DESKTOP (1440px+) ==================== */
@media (min-width: 1440px) {
    html {
        font-size: 16px;
    }
    
    .nav-container,
    .section-container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 0 3rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .modal-content {
        max-width: 900px;
    }
}

/* ==================== LAPTOP/DESKTOP (1024px - 1439px) ==================== */
@media (min-width: 1024px) and (max-width: 1439px) {
    html {
        font-size: 15px;
    }
    
    .nav-container {
        max-width: 1200px;
        padding: 1rem 2.5rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .section-container {
        max-width: 1100px;
        padding: 0 2rem;
    }
}

/* ==================== TABLET LANDSCAPE (769px - 1023px) ==================== */
@media (min-width: 769px) and (max-width: 1023px) {
    html {
        font-size: 15px;
    }
    
    /* Navbar anpassen */
    .nav-container {
        padding: 1rem 1.5rem;
        gap: 1.5rem;
    }
    
    .nav-links {
        gap: 1.5rem;
    }
    
    .nav-link {
        font-size: 0.95rem;
        padding: 0.7rem 1rem;
    }
    
    /* Hero Section */
    .hero {
        padding: 6rem 0 4rem;
    }
    
    .hero-content {
        max-width: 85%;
    }
    
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    /* Kategorien Grid */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .category-card {
        padding: 1.75rem;
    }
    
    /* Stats Section */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Buttons größer für Touch */
    .btn {
        min-height: 52px;
        font-size: 1rem;
        padding: 0.875rem 2rem;
        min-width: 160px;
    }
    
    /* Modal */
    .modal-content {
        max-width: 85vw;
        margin: 2rem auto;
    }
    
    /* Pricing Modal */
    .pricing-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Forms */
    input, textarea, select {
        font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
        min-height: 48px;
    }
}

/* ==================== TABLET PORTRAIT (481px - 768px) ==================== */
@media (min-width: 481px) and (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    /* Burger Menu anzeigen */
    .burger-menu {
        display: flex;
        order: 3;
    }
    
    /* Navbar */
    .nav-container {
        padding: 0.875rem 1.25rem;
        gap: 1rem;
    }
    
    .logo {
        font-size: 1.15rem;
        order: 1;
    }
    
    /* Mobile Navigation - Slide-in */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(80vw, 360px);
        height: 100vh;
        background: var(--dark-bg);
        border-left: 1px solid var(--border-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 5rem 1.5rem 2rem;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 1001;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.6);
        order: 4;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    /* Overlay */
    .nav-links.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.75);
        z-index: -1;
        animation: fadeIn 0.3s ease;
    }
    
    /* Navigation Links - Touch-optimiert */
    .nav-link {
        width: 100%;
        padding: 1rem 1.25rem;
        margin: 0.5rem 0;
        border-radius: 12px;
        background: var(--dark-card);
        border: 1px solid var(--border-color);
        text-align: left;
        font-size: 1rem;
        min-height: 52px;
        display: flex;
        align-items: center;
        transition: all 0.3s ease;
    }
    
    .nav-link:active {
        transform: scale(0.98);
        background: linear-gradient(135deg, #6366f1, #8b5cf6);
        color: white;
        border-color: #8b5cf6;
    }
    
    /* Search in Mobile Menu */
    .nav-search {
        width: 100%;
        margin: 1rem 0;
        order: 1;
    }
    
    .search-input {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }
    
    /* Cart & Auth Buttons */
    .cart-icon-wrapper,
    .auth-buttons {
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .cart-btn {
        width: 100%;
        padding: 1rem;
        min-height: 52px;
        justify-content: center;
    }
    
    .btn-login,
    .btn-register {
        width: 100%;
        margin: 0.5rem 0;
        min-height: 52px;
    }
    
    /* Hero Section */
    .hero {
        padding: 5rem 0 3rem;
        min-height: 60vh;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
        min-height: 52px;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Kategorien */
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    /* Modal */
    .modal-content {
        width: 95vw;
        max-width: 500px;
        margin: 1.5rem auto;
        padding: 1.75rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    /* Pricing Modal - stacked */
    .pricing-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Forms */
    input, textarea, select {
        font-size: 16px;
        min-height: 48px;
        padding: 0.875rem 1rem;
    }
    
    .btn {
        min-height: 52px;
        font-size: 1rem;
    }
}

/* ==================== MOBILE (320px - 480px) ==================== */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    /* Burger Menu */
    .burger-menu {
        display: flex;
        order: 3;
        width: 44px;
        height: 44px;
    }
    
    /* Navbar Ultra-kompakt */
    .nav-container {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .logo {
        font-size: 1rem;
        order: 1;
    }
    
    .logo i {
        font-size: 1.1rem;
    }
    
    /* Mobile Navigation - Full Width */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100vw;
        height: 100vh;
        background: var(--dark-bg);
        flex-direction: column;
        align-items: flex-start;
        padding: 4.5rem 1rem 2rem;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 1001;
        order: 4;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    /* Overlay */
    .nav-links.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.85);
        z-index: -1;
    }
    
    /* Navigation Items */
    .nav-link {
        width: 100%;
        padding: 1rem;
        margin: 0.4rem 0;
        border-radius: 10px;
        background: var(--dark-card);
        border: 1px solid var(--border-color);
        min-height: 52px;
        font-size: 0.95rem;
    }
    
    .nav-search {
        width: 100%;
        margin: 1rem 0 0.5rem;
        order: 1;
    }
    
    .search-input {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
        padding: 0.875rem;
    }
    
    /* Cart & Auth */
    .cart-icon-wrapper,
    .auth-buttons {
        width: 100%;
        margin: 0.4rem 0;
    }
    
    .cart-btn,
    .btn-login,
    .btn-register {
        width: 100%;
        min-height: 52px;
    }
    
    /* Hero Section - kompakt */
    .hero {
        padding: 4rem 0 2.5rem;
        min-height: auto;
    }
    
    .hero-content {
        padding: 0 1rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        margin: 1rem 0 1.5rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 0.875rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
        min-height: 52px;
        font-size: 0.95rem;
    }
    
    /* Stats - 1 Spalte */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .stat-box {
        padding: 1.25rem;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Section Titles */
    .section-title {
        font-size: 1.75rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
    }
    
    /* Kategorien - 1 Spalte */
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 0 1rem;
    }
    
    .category-card {
        padding: 1.5rem;
    }
    
    .category-title {
        font-size: 1.25rem;
    }
    
    /* Modal - Full Screen Feel */
    .modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        padding: 1.5rem 1rem;
        border-radius: 0;
        overflow-y: auto;
    }
    
    .modal-header {
        margin-bottom: 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.35rem;
    }
    
    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    /* Pricing Modal */
    .pricing-table {
        overflow-x: auto;
    }
    
    .pricing-row {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }
    
    .pricing-cell {
        padding: 0.875rem;
        font-size: 0.9rem;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    input, textarea, select {
        width: 100%;
        font-size: 16px;
        min-height: 48px;
        padding: 0.875rem;
        border-radius: 8px;
    }
    
    .btn {
        width: 100%;
        min-height: 52px;
        font-size: 0.95rem;
        padding: 1rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-section {
        padding: 0 1rem;
    }
}

/* ==================== EXTRA SMALL MOBILE (< 375px) ==================== */
@media (max-width: 374px) {
    html {
        font-size: 13px;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .burger-menu {
        width: 40px;
        height: 40px;
    }
    
    .burger-menu span {
        width: 20px;
    }
    
    .nav-container {
        padding: 0.625rem 0.875rem;
    }
    
    .logo {
        font-size: 0.9rem;
    }
}

/* ==================== LANDSCAPE MODE FIX ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .nav-links {
        padding: 3rem 1rem 1rem;
    }
    
    .hero {
        padding: 3rem 0 2rem;
        min-height: auto;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .modal-content {
        max-height: 95vh;
        margin: 0.5rem auto;
    }
}

/* ==================== UTILITIES ==================== */

/* Touch-optimierte Buttons */
.btn-touch-optimized {
    min-width: 48px;
    min-height: 48px;
    padding: 0.875rem 1.5rem;
    font-size: 16px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Verhindere Text-Selektion bei Buttons */
button, .btn {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Smooth Scroll für alle Links */
html {
    scroll-behavior: smooth;
}

/* Anti-Flicker für Animationen */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
    }
    to { 
        opacity: 1; 
    }
}
