/* ==========================================
   SOLVERO.DE - MOBILE STYLES
   Mobile-First Responsive Design
   ========================================== */

/* ==========================================
   MOBILE NAVIGATION
   ========================================== */

@media (max-width: 768px) {
    /* Mobile Menu Toggle Button - Visible on Mobile */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: calc(var(--z-header) + 1);
        position: relative;
    }

    /* Hamburger Icon */
    .hamburger {
        display: block;
        width: 28px;
        height: 2px;
        background: var(--black);
        position: relative;
        transition: background var(--transition-base);
    }

    .hamburger::before,
    .hamburger::after {
        content: '';
        position: absolute;
        width: 28px;
        height: 2px;
        background: var(--black);
        transition: transform var(--transition-base), top var(--transition-base), bottom var(--transition-base);
        left: 0;
    }

    .hamburger::before {
        top: -8px;
    }

    .hamburger::after {
        bottom: -8px;
    }

    /* Active State - X Icon */
    .mobile-menu-toggle.active .hamburger {
        background: transparent;
    }

    .mobile-menu-toggle.active .hamburger::before {
        top: 0;
        transform: rotate(45deg);
    }

    .mobile-menu-toggle.active .hamburger::after {
        bottom: 0;
        transform: rotate(-45deg);
    }

    /* Mobile Navigation Menu */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        background: var(--white);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--space-xl);
        padding: var(--space-xl);
        transition: right var(--transition-slow);
        box-shadow: var(--shadow-2xl);
        z-index: var(--z-header);
        overflow-y: auto;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links li {
        margin: 0;
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        font-size: var(--text-lg);
        padding: var(--space-sm) 0;
        display: block;
        width: 100%;
    }

    .nav-links a::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .nav-links a:hover::after,
    .nav-links a.active::after {
        width: 60%;
    }

    /* Backdrop Overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        background: var(--black-50);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-base);
        z-index: calc(var(--z-header) - 1);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }

    .mobile-menu-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    /* Prevent Body Scroll when Menu is Open */
    body.menu-open {
        overflow: hidden;
    }

    /* Header Adjustments */
    .site-header {
        padding: var(--space-sm) 0;
    }

    .nav-logo {
        font-size: var(--text-lg);
    }

    .nav-logo::before {
        width: 16px;
        height: 16px;
    }
}

/* ==========================================
   MOBILE TYPOGRAPHY
   ========================================== */

@media (max-width: 768px) {
    /* Adjust font sizes for mobile */
    h1 {
        font-size: var(--text-4xl);
        letter-spacing: 2px;
    }

    h2 {
        font-size: var(--text-3xl);
        letter-spacing: 1.5px;
    }

    h3 {
        font-size: var(--text-xl);
    }

    h4 {
        font-size: var(--text-lg);
    }

    p {
        font-size: var(--text-base);
    }

    /* Increase line height for better readability */
    body {
        line-height: 1.9;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: var(--text-3xl);
        letter-spacing: 1px;
    }

    h2 {
        font-size: var(--text-2xl);
    }

    h3 {
        font-size: var(--text-lg);
    }
}

/* ==========================================
   MOBILE LAYOUT ADJUSTMENTS
   ========================================== */

@media (max-width: 768px) {
    /* Container Padding */
    .container {
        padding: 0 var(--space-md);
    }

    /* Section Spacing */
    .section {
        padding: var(--space-xl) 0;
    }

    .section-header {
        margin-bottom: var(--space-xl);
    }

    /* Grid Layouts - Stack on Mobile */
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-auto {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    /* Cards */
    .card {
        padding: var(--space-md);
    }

    /* Buttons */
    .btn {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--text-sm);
        width: 100%; /* Full width on mobile */
    }

    .btn-sm {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--text-xs);
    }

    /* Modals */
    .modal {
        padding: var(--space-lg);
        width: 95%;
        margin: var(--space-sm);
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-sm);
    }

    .section {
        padding: var(--space-lg) 0;
    }

    .card {
        padding: var(--space-sm);
    }
}

/* ==========================================
   MOBILE TOUCH IMPROVEMENTS
   ========================================== */

@media (max-width: 768px) {
    /* Larger touch targets */
    a, button, .btn, input[type="checkbox"], input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    @media (hover: none) and (pointer: coarse) {
        .hover-lift:hover,
        .hover-scale:hover,
        .hover-tilt:hover {
            transform: none;
        }

        .card:hover {
            transform: none;
            box-shadow: var(--shadow-md);
        }

        /* Keep active states for touch feedback */
        .btn:active {
            transform: scale(0.95);
        }

        .card:active {
            transform: scale(0.98);
        }
    }

    /* Tap highlight color */
    * {
        -webkit-tap-highlight-color: var(--black-10);
    }
}

/* ==========================================
   MOBILE FORM IMPROVEMENTS
   ========================================== */

@media (max-width: 768px) {
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: var(--space-md);
    }

    .form-label {
        font-size: var(--text-base);
    }

    .form-group {
        margin-bottom: var(--space-md);
    }
}

/* ==========================================
   MOBILE TABLE IMPROVEMENTS
   ========================================== */

@media (max-width: 768px) {
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table thead {
        display: none;
    }

    .table tr {
        display: block;
        margin-bottom: var(--space-md);
        border: var(--border-thin) solid var(--gray-900);
    }

    .table td {
        display: block;
        text-align: right;
        padding: var(--space-sm);
        border-bottom: var(--border-thin) solid var(--gray-950);
    }

    .table td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        text-transform: uppercase;
        font-size: var(--text-xs);
    }

    .table td:last-child {
        border-bottom: none;
    }
}

/* ==========================================
   MOBILE SPECIFIC UTILITIES
   ========================================== */

/* Hide on Mobile */
.hide-mobile {
    display: none !important;
}

/* Show only on Mobile */
.show-mobile {
    display: block !important;
}

@media (min-width: 769px) {
    .hide-mobile {
        display: block !important;
    }

    .show-mobile {
        display: none !important;
    }
}

/* ==========================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ========================================== */

@media (max-width: 768px) {
    /* Reduce animation complexity */
    .parallax {
        transform: none !important;
    }

    /* Disable complex 3D transforms */
    .hover-tilt {
        transform: none !important;
    }

    /* Faster transitions on mobile */
    * {
        transition-duration: var(--transition-fast) !important;
    }

    /* Hardware acceleration for smooth scrolling */
    .site-header,
    .nav-links,
    .modal {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }
}

/* ==========================================
   LANDSCAPE MODE ADJUSTMENTS
   ========================================== */

@media (max-width: 768px) and (orientation: landscape) {
    /* Reduce vertical spacing in landscape */
    .section {
        padding: var(--space-lg) 0;
    }

    .section-header {
        margin-bottom: var(--space-lg);
    }

    /* Adjust navigation menu for landscape */
    .nav-links {
        padding: var(--space-lg);
        gap: var(--space-md);
    }

    .nav-links a {
        font-size: var(--text-base);
        padding: var(--space-xs) 0;
    }

    /* Stack modals horizontally if needed */
    .modal {
        max-height: 85vh;
    }
}

/* ==========================================
   SAFE AREA INSETS (iPhone X+)
   ========================================== */

@supports (padding: max(0px)) {
    .site-header {
        padding-left: max(var(--space-md), env(safe-area-inset-left));
        padding-right: max(var(--space-md), env(safe-area-inset-right));
    }

    .container {
        padding-left: max(var(--space-md), env(safe-area-inset-left));
        padding-right: max(var(--space-md), env(safe-area-inset-right));
    }

    .nav-links {
        padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom));
    }
}

/* ==========================================
   MOBILE IMAGE OPTIMIZATIONS
   ========================================== */

@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Prevent layout shift */
    img[width][height] {
        height: auto;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    /* Hide navigation and interactive elements */
    .site-header,
    .mobile-menu-toggle,
    .mobile-menu-overlay,
    .btn,
    button {
        display: none !important;
    }

    /* Adjust colors for print */
    body {
        background: white;
        color: black;
    }

    /* Remove shadows and effects */
    *,
    *::before,
    *::after {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    .card,
    .section {
        page-break-inside: avoid;
    }

    /* Show links */
    a[href]::after {
        content: " (" attr(href) ")";
    }
}
