/* 
 * Mobile Optimization Styles
 * Enhances mobile responsiveness across the entire website
 */

/* Global mobile improvements */
@media (max-width: 768px) {
    /* Fix for service cards on home page */
    .services-grid .service-card {
        min-height: 400px;
        padding-bottom: 80px;
    }
    
    .services-grid .service-card p {
        max-width: 90%;
    }
    
    /* Improve layout for related service cards */
    .related-service-card {
        min-height: 320px;
        padding-bottom: 80px !important;
        margin-bottom: 20px;
    }

    /* Ensure proper text wrapping and readability */
    .service-card h3,
    .related-service-card h3 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 15px;
    }
    
    /* Service pages fixes */
    .service-hero {
        min-height: 350px;
        padding: 100px 0 50px 0;
    }
    
    .service-hero-content {
        padding: 0 15px;
    }
    
    .service-intro {
        gap: 2rem;
    }
    
    /* Fix CTA section for mobile */
    .cta-content h2 {
        font-size: 2rem;
        line-height: 1.3;
    }
    
    /* Fix spacing between sections */
    .section {
        padding: 4rem 0;
    }
    
    /* Fix padding for feature boxes */
    .feature-box {
        padding: 2rem 1.5rem;
    }
    
    /* Better button spacing and alignment */
    .btn {
        padding: 0.8rem 1.8rem;
        margin: 5px 0;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    /* Container padding for tight spaces */
    .container {
        padding: 0 1.3rem;
    }
    
    /* Service cards height adjustments */
    .services-grid .service-card {
        min-height: auto;
        padding: 2rem 1.2rem 80px 1.2rem;
    }
    
    /* Hero section text size */
    .hero h1, 
    .service-hero h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
        line-height: 1.25;
    }
    
    .hero p,
    .service-hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }
    
    /* Heading sizes */
    h2 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.4rem;
        line-height: 1.3;
    }
    
    /* Process timeline adjustments */
    .process-number {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    /* FAQ adjustments */
    .faq-question {
        padding: 1.2rem 1.5rem;
    }
    
    .faq-item.active .faq-answer {
        padding: 0 1.5rem 1.2rem;
    }
    
    /* Card adjustments */
    .feature-box,
    .benefit-item,
    .related-service-card {
        padding: 2rem 1.2rem;
        margin-bottom: 1.5rem;
        height: auto !important;
        min-height: auto !important;
    }
    
    /* Button size adjustments */
    .service-card .btn.btn-sm.btn-primary,
    .related-service-link {
        min-width: 120px !important;
        padding: 8px 20px !important;
        font-size: 0.85rem !important;
        position: relative !important;
        bottom: 20px !important;
    }
    
    /* Hero buttons on mobile */
    .hero-btns {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    /* Fix scroll issues on small devices */
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
}

/* Improve mobile menu toggle visibility */
@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
        z-index: 1002;
        width: 44px;
        height: 44px;
        padding: 8px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        background-color: rgba(0, 160, 227, 0.9);
        border-radius: 6px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        margin-left: auto;
    }
    
    .mobile-toggle .bar {
        height: 3.5px;
        background-color: white;
        margin: 3px 0;
        border-radius: 2px;
        transition: var(--transition);
    }
    
    .nav-menu {
        overflow-y: auto;
        padding: 1rem 0 2rem;
        max-height: calc(100vh - 80px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    /* Improved mobile navigation */
    .nav-link {
        width: 100%;
        text-align: center;
        margin: 0.5rem 0;
    }
    
    .nav-link a {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        width: 90%;
        margin: 0 auto;
    }
    
    /* Improved dropdown menu */
    .nav-link.has-dropdown > a:after {
        content: '\f107';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        margin-left: 8px;
        transition: transform 0.3s ease;
    }
    
    .nav-link.has-dropdown.show > a:after {
        transform: rotate(180deg);
    }
    
    .nav-link.has-dropdown.show .dropdown-menu {
        display: block;
        max-height: 350px;
        overflow-y: auto;
        margin: 0.5rem auto !important;
        width: 85% !important;
        border-radius: 10px !important;
        background-color: #f8f9fa !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08) !important;
    }
    
    .dropdown-menu {
        position: relative !important;
        width: 100% !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        opacity: 1 !important;
        box-shadow: none !important;
        display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .dropdown-item {
        padding: 12px 20px !important;
        transition: background-color 0.3s ease;
        text-align: center;
    }
    
    .dropdown-item:hover,
    .dropdown-item:focus,
    .dropdown-item.active {
        background-color: rgba(0, 160, 227, 0.1) !important;
        color: var(--primary-color) !important;
    }

    /* Improve Portfolio/Services Grid on Mobile */
    [style*="display: grid; grid-template-columns: repeat(3, 1fr)"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Make portfolio cards look better on mobile */
    [style*="background: white; border-radius: 10px; overflow: hidden;"] {
        background: white !important;
        border-radius: 15px !important;
        margin-bottom: 1.5rem !important;
        width: 100% !important;
        max-width: 450px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
    }
    
    /* Limit height of portfolio text on mobile */
    [style*="padding: 1.5rem; flex-grow: 1;"] p {
        max-height: 210px !important;
        overflow-y: auto !important;
        line-height: 1.5 !important;
        font-size: 0.95rem !important;
        padding-right: 10px !important;
    }
}

/* Fix case study layout */
@media (max-width: 768px) {
    .case-study-content-grid {
        grid-template-columns: 1fr;
    }
    
    .case-study-section {
        margin-bottom: 1rem;
    }
    
    .case-study-redesigned {
        padding: 1.5rem;
    }
    
    .case-study-quote {
        padding: 1.5rem;
    }
}

/* Fix contact and form sections */
@media (max-width: 768px) {
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-info,
    .contact-form {
        padding: 2rem 1.5rem;
        border-radius: 10px;
    }
    
    .form-control {
        padding: 0.8rem 1.2rem;
        font-size: 16px; /* Prevent iOS zoom on focus */
        width: 100%;
        box-sizing: border-box;
    }
    
    textarea.form-control {
        min-height: 120px;
    }
    
    /* Make forms more mobile-friendly */
    .form-group {
        margin-bottom: 1.2rem;
    }
    
    select.form-control {
        height: 50px;
        -webkit-appearance: menulist; /* Fix styling on iOS */
    }
}

/* Fix footer layout */
@media (max-width: 768px) {
    .footer {
        padding: 4rem 0 0;
    }
    
    .footer-content {
        gap: 2rem;
    }
    
    .footer-links, 
    .footer-subscribe {
        margin-top: 1rem;
    }
    
    .subscribe-form {
        max-width: 100%;
    }
}

/* Fix animation and transitions on mobile */
@media (max-width: 768px) {
    .service-card:hover,
    .feature-box:hover,
    .benefit-item:hover,
    .related-service-card:hover {
        transform: translateY(-5px);
    }
}

/* Fix spacing for social links in footer */
@media (max-width: 576px) {
    .social-links {
        justify-content: center;
    }
}

/* Ensure all text is readable on small screens */
@media (max-width: 768px) {
    p, li, .testimonial-text, .faq-answer p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

/* Ensure buttons stay within their containers */
.btn, .btn-primary, .btn-outline, .btn-accent {
    white-space: normal;
    max-width: 100%;
    text-align: center;
    display: inline-block;
}

/* Prevent overflow issues */
body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Fix image display on small screens */
@media (max-width: 576px) {
    .about-img::before {
        display: none;
    }
    
    .image-glow-container::before {
        filter: blur(10px);
    }
}

/* Improve header responsiveness */
@media (max-width: 576px) {
    .header {
        padding: 0.3rem 0;
    }
    
    .logo img {
        height: 40px;
    }
}

/* Make sure service page images scale properly */
@media (max-width: 768px) {
    .service-intro-img img.featured-image {
        max-height: 300px;
        object-fit: cover;
    }
}

/* Fix for stats section on mobile */
@media (max-width: 576px) {
    .stats-section {
        padding: 3rem 0;
    }
    
    .stat-count {
        font-size: 2.5rem;
    }
    
    .stat-item {
        padding: 1.5rem 1rem;
        margin-bottom: 0.5rem;
    }
    
    .stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

/* Prevent service card overflow on very small screens */
@media (max-width: 360px) {
    .services-grid .service-card {
        min-height: 380px;
    }
    
    .services-grid .service-card h3 {
        font-size: 1.3rem;
    }
    
    .services-grid .service-card p {
        font-size: 0.9rem;
    }
}

/* Better mobile touch experience */
@media (max-width: 768px) {
    .service-card .btn.btn-sm.btn-primary,
    .related-service-link,
    .btn {
        /* Larger touch target */
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Fix touch delay on mobile */
    a, button {
        touch-action: manipulation;
    }
}

/* Fix service comparison table on mobile */
@media (max-width: 768px) {
    .service-comparison-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1.3rem;
        padding: 0 1.3rem;
        position: relative;
    }
    
    .service-comparison-table {
        min-width: 650px;
    }
    
    /* Add visual indicator for scrollable table */
    .service-comparison-table-container::after {
        content: '\f0b1';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0, 160, 227, 0.1);
        color: var(--primary-color);
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        pointer-events: none;
        animation: swipeHint 1.5s ease-in-out infinite;
    }
    
    @keyframes swipeHint {
        0% { transform: translateY(-50%) translateX(0); }
        50% { transform: translateY(-50%) translateX(-10px); }
        100% { transform: translateY(-50%) translateX(0); }
    }
}

/* Fix SLA cards on mobile */
@media (max-width: 768px) {
    .sla-container {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .sla-card {
        width: 100%;
    }
}

/* Fix Digital Transformation section on mobile */
@media (max-width: 768px) {
    [style*="display: grid; grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
    }
}

/* Fix service pages padding on mobile */
@media (max-width: 576px) {
    .service-hero {
        padding-top: 100px;
        padding-bottom: 30px;
        min-height: auto;
    }
    
    .section {
        padding: 3rem 0;
    }
    
    .service-hero-btns {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .service-hero-btns .btn {
        margin: 0;
        width: 100%;
        max-width: 250px;
    }
}

/* Specifically fix portfolio card design on mobile */
@media (max-width: 768px) {
    /* Portfolio card container */
    div[style*="background: white; border-radius: 10px; overflow: hidden;"] {
        display: flex !important;
        flex-direction: column !important;
        background: white !important;
        border-radius: 15px !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05) !important;
        margin-bottom: 20px !important;
    }
    
    /* Icon container */
    div[style*="background: linear-gradient(135deg, #0080c0 0%, #00a0e3 100%); padding: 2rem; text-align: center;"] {
        padding: 1.5rem !important;
    }
    
    /* Portfolio text container */
    div[style*="padding: 1.5rem; flex-grow: 1;"] {
        padding: 1.2rem !important;
    }
    
    /* Portfolio text */
    div[style*="padding: 1.5rem; flex-grow: 1;"] p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        max-height: 120px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Portfolio icons */
    div[style*="background: linear-gradient(135deg, #0080c0 0%, #00a0e3 100%); padding: 2rem; text-align: center;"] i {
        font-size: 2.5rem !important;
    }
    
    /* Portfolio heading */
    div[style*="padding: 1.5rem; flex-grow: 1;"] h4 {
        font-size: 1.2rem !important;
        margin-bottom: 0.8rem !important;
    }
}
