/* ============================================
   MOBILE-ONLY ENHANCEMENTS
   Applied only on screens 768px and smaller
   Improves mobile UX, touch targets, and readability
   ============================================ */

@media (max-width: 768px) {
    
    /* ============================================
       PREVENT HORIZONTAL SCROLLING
       ============================================ */
    
    html, body {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
    
    * {
        max-width: 100% !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        box-sizing: border-box;
    }
    
    .container, section, div {
        max-width: 100% !important;
        overflow-x: hidden;
    }
    
    /* ============================================
       IMPROVED TOUCH TARGETS (44x44px minimum)
       ============================================ */
    
    .cta-button,
    .btn,
    button[type="submit"],
    .package-button,
    .view-project,
    .sticky-cta-mobile {
        min-height: 48px;
        min-width: 120px;
        padding: 14px 28px;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(6, 182, 212, 0.2);
    }
    
    /* Navigation links */
    .nav-links a,
    .mobile-nav-links a {
        min-height: 48px;
        padding: 12px 20px;
        display: flex;
        align-items: center;
        font-size: 1.05rem;
    }
    
    /* Social icons */
    .social-icon,
    .footer-social a {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
    }
    
    /* FAQ items */
    .faq-item {
        padding: 20px;
        margin-bottom: 16px;
    }
    
    .faq-question {
        min-height: 48px;
        padding: 16px;
        font-size: 1.05rem;
        cursor: pointer;
        display: flex;
        align-items: center;
    }
    
    /* Cookie banner buttons */
    .cookie-btn {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 1rem;
        margin: 6px;
    }
    
    /* ============================================
       HERO SECTION MOBILE
       ============================================ */
    
    /* Change "Get Free Quote" button to "Contact" on mobile */
    .hero-buttons .btn-secondary {
        color: transparent;
        font-size: 0;
        position: relative;
        padding: 16px 40px;
        min-height: 48px;
    }
    
    .hero-buttons .btn-secondary::after {
        content: 'Contact';
        color: white;
        font-size: 1.05rem;
        font-weight: 600;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        white-space: nowrap;
    }
    
    /* ============================================
       ENHANCED SPACING & BREATHING ROOM
       ============================================ */
    
    section {
        padding: 48px 24px !important;
        margin-top: 0 !important;
    }

    /* Inner pages (pricing, services, portfolio, etc.) need more top padding
       to clear the fixed navbar (~65px) with comfortable breathing room */
    .page-section {
        padding-top: 65px !important;
        margin-top: 0 !important;
    }
    
    .hero {
        padding: 65px 24px 32px !important;
    }
    
    .container {
        padding: 0 24px;
    }
    
    /* Card spacing */
    .package-demo-card,
    .service-card,
    .benefit-card,
    .pricing-card {
        margin-bottom: 24px;
        padding: 20px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Pricing specific improvements */
    .pricing-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 16px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    .pricing-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 20px !important;
        overflow: hidden;
        word-wrap: break-word;
    }
    
    .pricing-card h3 {
        font-size: 1.3rem !important;
        line-height: 1.3;
    }
    
    .pricing-features {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .pricing-features li {
        margin-bottom: 8px;
        word-wrap: break-word;
    }
    
    /* Section titles */
    h1, h2, h3 {
        margin-bottom: 24px;
    }
    
    p {
        margin-bottom: 20px;
    }
    
    /* List spacing */
    ul, ol {
        margin-bottom: 24px;
    }
    
    li {
        margin-bottom: 12px;
    }
    
    /* ============================================
       IMPROVED MOBILE TYPOGRAPHY
       ============================================ */
    
    body {
        font-size: 16px;
        line-height: 1.7;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .hero-title {
        font-size: 2rem !important;
        line-height: 1.3;
        margin-bottom: 20px;
        letter-spacing: -0.02em;
    }
    
    .hero-subtitle {
        font-size: 1.1rem !important;
        line-height: 1.6;
        margin-bottom: 24px;
    }
    
    h2 {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 20px;
    }
    
    h3 {
        font-size: 1.3rem;
        line-height: 1.4;
    }
    
    p {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    /* Better text contrast */
    .hero-description p,
    .section-description {
        color: #2d3748;
        font-size: 1.05rem;
        line-height: 1.7;
    }
    
    /* ============================================
       IMPROVED FORM INPUTS
       ============================================ */
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    select {
        min-height: 52px;
        padding: 16px;
        font-size: 16px; /* Prevents iOS zoom */
        border: 2px solid #e2e8f0;
        border-radius: 8px;
        width: 100%;
        margin-bottom: 16px;
        -webkit-appearance: none;
        appearance: none;
        touch-action: manipulation;
    }
    
    textarea {
        min-height: 140px;
        padding: 16px;
        font-size: 16px; /* Prevents iOS zoom */
        border: 2px solid #e2e8f0;
        border-radius: 8px;
        width: 100%;
        margin-bottom: 16px;
        -webkit-appearance: none;
        appearance: none;
        resize: vertical;
    }
    
    label {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 8px;
        display: block;
        color: var(--text-primary, #f1f5f9);
    }
    
    input:focus,
    textarea:focus,
    select:focus {
        border-color: #06b6d4;
        outline: none;
        box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
    }
    
    /* ============================================
       ENHANCED MOBILE NAVIGATION
       ============================================ */
    
    .nav,
    .navbar {
        padding: 16px 20px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        position: relative;
        overflow: visible;
    }
    
    .logo {
        font-size: 1.3rem;
        font-weight: 700;
        margin-right: auto;
    }
    
    /* Don't override hamburger positioning - let base CSS handle it */
    .hamburger span,
    .menu-toggle span {
        width: 24px !important;
        height: 3px !important;
        display: block;
    }
    
    /* Mobile menu overlay */
    .mobile-menu {
        padding-top: 80px;
    }
    
    .mobile-nav-links {
        padding: 24px;
    }
    
    .mobile-nav-links a {
        font-size: 1.2rem;
        padding: 16px 20px;
        margin-bottom: 4px;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .mobile-nav-links a:active {
        background: rgba(6, 182, 212, 0.1);
        transform: scale(0.98);
    }
    
    /* ============================================
       IMPROVED PACKAGE CARDS
       ============================================ */
    
    .package-demo-card {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        margin-bottom: 24px;
    }
    
    .package-overlay {
        padding: 28px 20px;
        min-height: 280px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .package-title {
        font-size: 1.6rem;
        margin-bottom: 16px;
    }
    
    .package-price-new {
        font-size: 2rem;
        font-weight: 700;
    }
    
    .package-description {
        font-size: 1.05rem;
        margin: 16px 0;
        line-height: 1.5;
    }
    
    /* ============================================
       STICKY CTA IMPROVEMENTS
       ============================================ */
    
    .sticky-cta-mobile {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: linear-gradient(135deg, #06b6d4, #0891b2);
        color: white;
        padding: 16px 32px;
        border-radius: 50px;
        font-weight: 700;
        font-size: 1.05rem;
        box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4), 0 3px 10px rgba(0, 0, 0, 0.2);
        z-index: 999;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 52px;
        transition: all 0.3s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .sticky-cta-mobile:active {
        transform: translateX(-50%) scale(0.95) translateY(2px);
        box-shadow: 0 3px 12px rgba(6, 182, 212, 0.3);
    }
    
    /* ============================================
       IMPROVED CARD INTERACTIONS
       ============================================ */
    
    .service-card,
    .benefit-card {
        padding: 24px;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
        transition: all 0.2s ease;
        margin-bottom: 20px;
    }
    
    .service-card:active,
    .benefit-card:active {
        transform: scale(0.98);
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
    }
    
    /* ============================================
       BETTER HERO SECTION MOBILE
       ============================================ */
    
    .hero {
        text-align: center;
        background:
            radial-gradient(ellipse at 70% 15%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
            radial-gradient(ellipse at 25% 85%, rgba(168, 85, 247, 0.12) 0%, transparent 50%),
            repeating-linear-gradient(45deg, transparent, transparent 40px, rgba(6, 182, 212, 0.07) 40px, rgba(6, 182, 212, 0.07) 41px),
            repeating-linear-gradient(-45deg, transparent, transparent 40px, rgba(168, 85, 247, 0.05) 40px, rgba(168, 85, 247, 0.05) 41px),
            linear-gradient(135deg, rgba(6, 182, 212, 0.03) 0%, rgba(59, 130, 246, 0.05) 50%, rgba(168, 85, 247, 0.03) 100%) !important;
        padding: 5px 24px 32px !important;
        min-height: auto !important;
        margin-bottom: 0 !important;
    }
    
    .hero-content {
        z-index: 2;
        position: relative;
        margin-bottom: 0 !important;
    }
    
    .hero-buttons {
        display: flex;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .hero-buttons .cta-button {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }
    
    .hero-description {
        display: none !important;
        margin-bottom: 20px !important;
    }
    
    /* Remove excessive spacing after hero */
    section + section {
        margin-top: 0 !important;
        padding-top: 48px !important;
    }
    
    .hero + section,
    .hero + * {
        margin-top: 0 !important;
        padding-top: 48px;
    }
    
    /* Remove excessive spacing after hero */
    section + section {
        margin-top: 0 !important;
    }
    
    /* ============================================
       IMPROVED FOOTER
       ============================================ */
    
    footer {
        padding: 48px 24px 28px;
    }
    
    .footer-content {
        text-align: center;
    }
    
    .footer-links {
        margin: 24px 0;
    }
    
    .footer-links a {
        display: block;
        padding: 12px;
        margin: 8px 0;
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* ============================================
       "GET IN TOUCH" FOOTER LINKS
       ============================================ */
    
    /* Enhance touch targets for "Get in Touch" section links on mobile */
    .footer-section p a {
        min-height: 48px !important;
        min-width: 140px !important;
        padding: 14px 20px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 8px 4px !important;
        font-size: 1rem !important;
        font-weight: 500;
        border-radius: 6px;
        transition: all 0.2s ease;
    }
    
    .footer-section p a:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    /* ============================================
       PORTFOLIO IMPROVEMENTS
       ============================================ */
    
    .portfolio-item {
        margin-bottom: 32px;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .portfolio-image {
        min-height: 200px;
    }
    
    /* Steven Dodds Plastering Service - Mobile Specific Fix */
    .portfolio-item:first-child {
        min-height: auto !important;
    }
    
    .portfolio-item:first-child .portfolio-image {
        background-size: 90% !important;
        background-position: center 20% !important;
        background-repeat: no-repeat !important;
        min-height: 180px !important;
        background-color: #ffffff !important;
    }
    
    .portfolio-item:first-child > div {
        min-height: 180px !important;
    }
    
    /* ============================================
       PROCESS TIMELINE MOBILE
       ============================================ */
    
    .process-step {
        padding: 24px;
        margin-bottom: 24px;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }
    
    .process-step h3 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    /* ============================================
       IMPROVED PRICING SECTION
       ============================================ */
    
    .pricing-card {
        padding: 28px;
        margin-bottom: 28px;
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    
    .pricing-card h3 {
        font-size: 1.5rem;
        margin-bottom: 16px;
    }
    
    .price {
        font-size: 2.2rem;
        font-weight: 700;
        margin: 20px 0;
    }
    
    /* ============================================
       CONTACT FORM IMPROVEMENTS
       ============================================ */
    
    .contact-form {
        padding: 28px 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
        overflow: visible;
        padding-top: 14px; /* space for floating label to sit above input without clipping */
    }

    .form-group label {
        color: var(--text-secondary, #94a3b8) !important; /* prevent dark colour override on dark bg */
        position: absolute !important;
    }

    .form-group input:focus + label,
    .form-group input:not(:placeholder-shown) + label,
    .form-group textarea:focus + label,
    .form-group textarea:not(:placeholder-shown) + label {
        top: 2px !important; /* shift into padding-top space instead of going negative */
        font-size: 0.78rem;
    }
    
    /* ============================================
       ACCESSIBILITY IMPROVEMENTS
       ============================================ */
    
    /* Focus visible for keyboard navigation */
    *:focus-visible {
        outline: 3px solid #06b6d4;
        outline-offset: 2px;
    }
    
    /* Remove outline for mouse users */
    *:focus:not(:focus-visible) {
        outline: none;
    }
    
    /* ============================================
       PERFORMANCE OPTIMIZATIONS
       ============================================ */
    
    /* Reduce animations on mobile for battery */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Prevent text selection on buttons */
    .cta-button,
    .btn,
    button {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* ============================================
       SAFE AREA INSETS (iPhone notch support)
       ============================================ */
    
    .nav {
        padding-top: max(16px, env(safe-area-inset-top));
    }
    
    .sticky-cta-mobile {
        bottom: max(20px, env(safe-area-inset-bottom));
    }
    
    footer {
        padding-bottom: max(28px, calc(28px + env(safe-area-inset-bottom)));
    }
    
    /* ============================================
       FOOTER BOTTOM PADDING FIX (Floating Buttons)
       ============================================ */
    
    /* Increase footer bottom padding to prevent floating buttons from covering content */
    footer {
        padding-bottom: 150px !important;
    }
    
}

/* ============================================
   SMALL MOBILE (iPhone SE, small Android)
   ============================================ */

@media (max-width: 375px) {
    
    .hero-title {
        font-size: 1.75rem !important;
    }

}

/* ============================================
   MOBILE COMPACT PASS (Medium Density)
   ============================================ */

@media (max-width: 768px) {
    section {
        padding: 36px 16px !important;
    }

    .hero {
        padding: 5px 16px 24px !important;
    }

    .container {
        padding: 0 16px;
    }

    .navbar {
        padding: 12px 16px;
    }

    .hero-title {
        font-size: 1.8rem !important;
        line-height: 1.25;
        margin-bottom: 16px;
    }

    .hero-subtitle {
        font-size: 1rem !important;
        margin-bottom: 16px;
    }

    .hero-description {
        margin-bottom: 14px !important;
    }

    h1, h2, h3 {
        margin-bottom: 16px;
    }

    p {
        margin-bottom: 14px;
        font-size: 0.98rem;
        line-height: 1.6;
    }

    .service-card,
    .benefit-card,
    .pricing-card,
    .package-demo-card,
    .portfolio-item,
    .faq-item,
    .process-step {
        padding: 18px !important;
        margin-bottom: 16px !important;
    }

    .pricing-card {
        padding: 20px !important;
    }

    .package-overlay {
        padding: 20px 16px;
        min-height: 240px;
    }

    .package-title {
        font-size: 1.45rem;
    }

    .package-price-new {
        font-size: 1.8rem;
    }

    .faq-question {
        padding: 12px !important;
        font-size: 1rem;
    }

    .form-group {
        margin-bottom: 16px;
    }

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        min-height: 48px;
        padding: 12px;
    }

    .cta-button,
    .btn,
    button[type="submit"],
    .package-button,
    .view-project {
        padding: 12px 20px;
        min-height: 44px;
        font-size: 0.98rem;
    }

    .hero-buttons {
        gap: 12px;
    }

    ul, ol {
        margin-bottom: 16px;
    }

    li {
        margin-bottom: 8px;
    }

    .sticky-cta-mobile {
        padding: 12px 24px;
        font-size: 1rem;
        min-height: 48px;
    }

    footer {
        padding: 36px 16px 22px;
        padding-bottom: 120px !important;
    }

    /* Pricing page - compact cards */
    .pricing-card {
        padding: 16px !important;
        margin-bottom: 14px !important;
        border-radius: 10px;
    }

    .pricing-card h3 {
        font-size: 1.25rem;
        margin-bottom: 10px;
    }

    .price {
        font-size: 1.8rem;
        margin: 12px 0;
    }

    .pricing-features li {
        margin-bottom: 6px;
        line-height: 1.5;
    }
}

@media (max-width: 768px) {
    h2 {
        font-size: 1.5rem;
    }
    
    .cta-button,
    .btn {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    section {
        padding: 40px 16px !important;
    }
    
    .hero {
        padding: 5px 16px 32px !important;
    }
    
    .package-overlay {
        padding: 24px 16px;
    }
}

/* ============================================
   LANDSCAPE MODE OPTIMIZATION
   Prevents cramped forms and improves UX
   ============================================ */

@media (orientation: landscape) and (max-height: 600px) {
    
    section {
        padding: 32px 24px !important;
    }
    
    .hero {
        padding: 5px 24px 24px !important;
    }
    
    .hero-title {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.95rem !important;
    }
    
    /* Reduce form spacing in landscape */
    .form-group {
        margin-bottom: 1rem !important;
    }
    
    .cta-button,
    .btn,
    button[type="submit"] {
        padding: 12px 24px;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    /* Compact cards layout */
    .service-card,
    .pricing-card,
    .faq-item {
        margin-bottom: 16px;
        padding: 16px;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    /* Optimize hero description for landscape */
    .hero-description {
        max-height: 100px;
        overflow-y: auto;
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
}

/* ============================================
   HIDE SECTIONS ON MOBILE
   ============================================ */

@media (max-width: 768px) {
    /* Hide the "Ready to Get Started" section on mobile */
    .ready-to-start {
        display: none !important;
    }
}

/* ============================================
   BENEFIT CARDS - SINGLE COLUMN ON MOBILE
   ============================================ */
@media (max-width: 768px) {
    .why-website {
        padding: 3rem 1rem !important;
    }
    .benefits-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .benefit-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    .benefit-icon {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 auto 1rem auto !important;
        line-height: normal !important;
    }
}
