/* Prevent text size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Improve tap highlighting */
* {
    -webkit-tap-highlight-color: rgba(196, 149, 106, 0.2);
}

/* Touch-friendly scrolling */
html, body {
    -webkit-overflow-scrolling: touch;
}

/* 2. TOUCH TARGETS - Minimum 44x44px for accessibility */

@media (max-width: 991px) {
    /* Buttons and interactive elements - NOT navbar toggle */
    .btn,
    .button,
    .share-btn,
    .cookie-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Form inputs */
    .form-input,
    .form-control {
        min-height: 48px;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    /* Social links */
    .footer-social-link {
        min-width: 48px;
        min-height: 48px;
    }
}

/* 3. MOBILE NAVIGATION */

@media (max-width: 1199px) {
    /* Improved mobile menu */
    .rd-navbar-nav-wrap {
        padding: 20px;
        padding-top: 80px;
    }

    .rd-navbar-nav {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .rd-navbar-nav .rd-nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .rd-navbar-nav .rd-nav-item:last-child {
        border-bottom: none;
    }

    .rd-navbar-nav .rd-nav-link {
        padding: 16px 12px;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Contact info in mobile menu */
    .contacts-classic {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .contacts-classic .unit {
        padding: 12px 0;
    }

    .contacts-classic-text {
        font-size: 16px;
    }
}

/* 4. STICKY MOBILE CTA BUTTON */

/* Hidden on desktop - IMPORTANT to override any other styles */
.mobile-cta {
    display: none !important;
    visibility: hidden;
}

@media (max-width: 768px) {
    .mobile-cta {
        display: flex !important;
        visibility: visible !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: linear-gradient(135deg, var(--color-primary, #C4956A) 0%, var(--color-primary-dark, #a67c52) 100%);
        padding: 12px 20px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        gap: 10px;
        align-items: center;
        justify-content: center;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-cta.is-visible {
        transform: translateY(0);
    }

    .mobile-cta__text {
        color: white;
        font-size: 14px;
        font-weight: 600;
    }

    .mobile-cta__btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        background: white;
        color: var(--color-primary, #C4956A);
        font-size: 14px;
        font-weight: 700;
        border: none;
        border-radius: 8px;
        text-decoration: none;
        white-space: nowrap;
        transition: all 0.3s ease;
    }

    .mobile-cta__btn:hover,
    .mobile-cta__btn:active {
        background: rgba(255, 255, 255, 0.9);
        transform: scale(1.02);
    }

    .mobile-cta__btn svg {
        width: 16px;
        height: 16px;
    }

    /* Add padding to body to prevent content from being hidden behind CTA */
    body {
        padding-bottom: 70px;
    }

    /* Move ui-to-top button up when mobile CTA is visible */
    .ui-to-top {
        right: 15px !important;
        bottom: 80px !important;
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 18px !important;
    }
}

/* 5. MOBILE TYPOGRAPHY */

@media (max-width: 576px) {
    h1, .h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    h2, .h2 {
        font-size: 1.5rem;
        line-height: 1.25;
    }

    h3, .h3 {
        font-size: 1.25rem;
    }

    h4, .h4 {
        font-size: 1.1rem;
    }

    p, .lead {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .display-4 {
        font-size: 1.75rem;
    }
}

/* 6. MOBILE FORMS */

@media (max-width: 768px) {
    /* Form groups */
    .form-group-modern {
        margin-bottom: 20px;
    }

    /* Form labels */
    .form-label-top {
        font-size: 14px;
        margin-bottom: 6px;
    }

    /* Input wrapper */
    .form-input-wrapper {
        border-radius: 10px;
    }

    /* Form inputs - larger for mobile */
    .form-input-wrapper input,
    .form-input-wrapper textarea,
    .form-input-wrapper select {
        padding: 16px;
        font-size: 16px;
    }

    /* Textarea */
    .form-input-wrapper textarea {
        min-height: 100px;
    }

    /* Form button full width on mobile */
    .form-button-wrapper {
        margin-top: 24px;
    }

    .form-button-wrapper .button,
    .form-button-wrapper .btn {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
    }

    /* Error messages */
    .form-error-message {
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* 7. OWL CAROUSEL ARROW NAVIGATION */

/* Mobile: Arrows always below carousel - centered horizontally */
@media (max-width: 768px) {
    /* Force arrows below content - horizontal row */
    .owl-nav-arrows .owl-nav {
        position: static !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 24px !important;
        margin-top: 20px !important;
        width: auto !important;
        float: none !important;
    }

    .owl-nav-arrows .owl-nav button.owl-prev,
    .owl-nav-arrows .owl-nav button.owl-next {
        position: static !important;
        display: inline-flex !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        margin: 0 !important;
        float: none !important;
        flex-shrink: 0 !important;
    }

    .owl-nav-arrows .owl-nav button.owl-prev:active,
    .owl-nav-arrows .owl-nav button.owl-next:active {
        opacity: 0.7 !important;
    }

    /* Arrow icons slightly smaller on mobile */
    .owl-nav-arrows .owl-nav button.owl-prev::before,
    .owl-nav-arrows .owl-nav button.owl-next::before {
        width: 10px !important;
        height: 10px !important;
        border-width: 0 2.5px 2.5px 0 !important;
    }

    /* Project carousel - smaller images on mobile */
    .owl-style-1 .project-mary-figure {
        height: 250px !important;
    }
}

/* 8. MOBILE TEAM CAROUSEL */

@media (max-width: 768px) {
    /* Team section - better mobile presentation */
    #team .owl-carousel {
        padding: 0 20px;
    }

    #team .team-classic {
        text-align: center;
        padding: 0 10px;
    }

    /* Quadratische Bilder mit einheitlicher Größe */
    #team .team-classic-figure {
        width: 180px;
        height: 180px;
        margin: 0 auto 16px;
        overflow: hidden;
    }

    #team .team-classic-figure img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center top;
    }

    #team .team-classic-name {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    #team .team-classic-status {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    #team .team-classic-figure {
        width: 150px;
        height: 150px;
    }
}

/* 8. MOBILE CARDS & SECTIONS */

@media (max-width: 768px) {
    /* Cards */
    .card {
        margin-bottom: 16px;
    }

    .card-body {
        padding: 20px;
    }

    .card-title {
        font-size: 1.1rem;
    }

    /* Disable hover transforms on mobile (causes issues) */
    .card:hover {
        transform: none;
    }

    /* Sections */
    section {
        padding: 40px 0;
    }

    .section-lg {
        padding: 50px 0;
    }

    .section-xl {
        padding: 60px 0;
    }

    /* Section separators - smaller on mobile */
    .section-separator {
        max-height: 200px;
    }

    .section-separator img {
        height: 200px;
    }

    /* Counter items */
    .counter-item {
        margin-bottom: 20px;
    }

    .counter-value {
        font-size: 2rem;
    }
}

/* 8. MOBILE FOOTER */

@media (max-width: 768px) {
    .footer-modern {
        text-align: center;
    }

    .footer-main {
        padding: 40px 0 30px;
    }

    .footer-brand {
        margin: 0 auto 30px;
    }

    .footer-widget {
        padding-left: 0;
        margin-bottom: 30px;
    }

    .footer-widget-title::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-contact-item {
        justify-content: center;
    }

    .footer-social {
        justify-content: center;
    }

    .footer-bottom-inner {
        flex-direction: column;
        gap: 12px;
    }
}

/* 9. MOBILE SHARE BUTTONS */

@media (max-width: 576px) {
    .share-section {
        margin-top: 24px;
        padding-top: 16px;
    }

    .share-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .share-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
}

/* 10. MOBILE COOKIE BANNER */

@media (max-width: 576px) {
    .cookie-banner {
        padding: 0 8px 8px;
    }

    .cookie-banner__content {
        padding: 16px;
        gap: 12px;
    }

    .cookie-banner__icon {
        width: 40px;
        height: 40px;
    }

    .cookie-banner__title {
        font-size: 15px;
    }

    .cookie-banner__desc {
        font-size: 12px;
    }

    .cookie-banner__actions {
        flex-direction: column;
        width: 100%;
    }

    .cookie-btn {
        width: 100%;
        padding: 14px 16px;
        font-size: 14px;
    }
}

/* 11. MOBILE HERO SECTION */

@media (max-width: 768px) {
    .hero-section {
        min-height: 60vh;
    }

    .hero-overlay {
        padding: 20px 15px;
    }

    .hero-overlay h1 {
        font-size: 1.5rem;
        margin-bottom: 12px;
    }

    .hero-overlay .lead {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .hero-overlay .btn {
        padding: 14px 24px;
        font-size: 14px;
    }
}

/* 12. MOBILE SLIDER */

@media (max-width: 768px) {
    .section-horace {
        min-height: 50vh;
    }

    .section-horace-left {
        padding: 30px 20px;
    }

    .project-classic-title {
        font-size: 2rem;
    }

    .project-classic-text {
        font-size: 0.9rem;
    }

    /* Swiper navigation */
    .swiper-custom-nav {
        gap: 10px;
    }

    .swiper-button-prev,
    .swiper-button-next {
        width: 44px;
        height: 44px;
    }
}

/* 13. MOBILE FAQ ACCORDION */

@media (max-width: 576px) {
    #accordion .card {
        margin-bottom: 8px;
    }

    #accordion .card-header {
        padding: 0;
    }

    #accordion .card-header button {
        padding: 14px 16px;
        font-size: 14px;
        text-align: left;
    }

    #accordion .card-body {
        padding: 16px;
        font-size: 14px;
    }
}

/* 14. MOBILE MODAL */

@media (max-width: 576px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-content-modern {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .modal-success-icon .checkmark {
        width: 60px;
        height: 60px;
    }

    .modal-title-modern {
        font-size: 20px;
    }

    .modal-text-modern {
        font-size: 14px;
    }

    .modal-close-modern {
        width: 100%;
        padding: 14px 20px;
    }
}

/* 15. LANDSCAPE MOBILE OPTIMIZATIONS */

@media (max-width: 896px) and (orientation: landscape) {
    .hero-section {
        min-height: 100vh;
    }

    .section-horace {
        min-height: 100vh;
    }

    .mobile-cta {
        padding: 8px 16px;
    }
}

/* 16. REDUCE MOTION FOR USERS WHO PREFER IT */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .mobile-cta {
        transition: none;
    }
}

/* 17. SAFE AREA INSETS (for notched devices) */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-cta {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    .footer-modern {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
