/* ===== MOBILE-FIRST RESPONSIVE DESIGN ===== */

/* Base responsive container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== SMALL DESKTOP STYLES (1081px and up) ===== */
@media (min-width: 1081px) {
    /* Ensure normal desktop behavior */
    .header {
        background: transparent;
    }
    
    .hero {
        padding-top: 120px;
    }
}

/* ===== SMALL MOBILE (481px to 600px) - Handle menu wrapping ===== */
@media (max-width: 600px) and (min-width: 481px) {
    .hero {
        padding: 110px 0 40px; /* Extra padding for screens where menu might wrap more */
        min-height: calc(100vh - 90px);
    }
}

/* ===== VERY SMALL MOBILE (under 480px) ===== */
@media (max-width: 480px) {
    .navbar {
        padding: 0.3rem 0;
        gap: 0.2rem;
    }
    
    .logo h2 {
        font-size: 1rem !important;
    }
    
    .logo-subtitle {
        font-size: 0.6rem !important;
    }
    
    .logo-symbol,
    .logo-symbol-white {
        height: 28px;
    }
    
    .nav-menu ul {
        gap: 0.2rem 0.3rem;
    }
    
    .nav-menu li a {
        font-size: 0.65rem;
        padding: 0.15rem 0.25rem;
    }
    
    .hero {
        padding: 90px 0 30px; /* Adequate padding for very small screens with wrapped menu */
    }
}

/* ===== MEDIUM TABLET STYLES (769px to 900px) ===== */
@media (max-width: 1080px) and (min-width: 769px) {
    .container {
        padding: 0 20px;
    }
    
    /* Keep normal header behavior for tablets */
    .header {
        background: transparent;
    }
    
    .header.scrolled {
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(15px);
        box-shadow: 0 4px 25px rgba(0,0,0,0.15);
    }
    
    .navbar {
        padding: 1rem 0;
    }
    
    .header.scrolled .navbar {
        padding: 0.75rem 0;
    }
    
    /* Hero adjustments for tablets */
    .hero {
        padding-top: 100px;
    }
}

/* ===== MOBILE STYLES (768px and below) ===== */
@media (max-width: 768px) {
    /* Prevent horizontal overflow on mobile */
    body {
        overflow-x: hidden !important;
    }
    
    * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .container {
        padding: 0 15px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Ensure all sections and image containers stay within viewport */
    section, 
    .hero-wrapper,
    .features-detail-wrapper,
    .budget-planning-wrapper,
    .campaign-insights-wrapper,
    .solution-wrapper,
    .customisable-settings-wrapper,
    .why-choose-grid {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Ensure all image containers don't overflow */
    .hero-image,
    .features-mockup,
    .budget-mockup,
    .insights-mockup,
    .solution-mockup,
    .settings-mockup {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    /* Header Mobile */
    .header {
        padding: 6px 0;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(15px);
        box-shadow: 0 4px 25px rgba(0,0,0,0.15);
    }
    
    .navbar {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0.4rem 0;
        gap: 0.3rem;
    }
    
    .logo {
        order: 1;
        margin-bottom: 0.2rem;
    }
    
    .nav-menu {
        order: 2;
        display: flex;
        justify-content: center;
    }
    
    .nav-buttons {
        order: 3;
        display: none; /* Hide on very small screens to save space */
    }
    
    .navbar {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0.4rem 0;
        gap: 0.3rem;
    }
    
    .logo {
        order: 1;
        margin-bottom: 0.2rem;
    }
    
    .nav-menu {
        order: 2;
        display: flex;
        justify-content: center;
    }
    
    .nav-buttons {
        order: 3;
        display: none; /* Hide on very small screens to save space */
    }
    
    .logo h2 {
        font-size: 1.1rem;
        color: #1890FF !important; /* Always blue on mobile */
    }
    
    .logo-subtitle {
        font-size: 0.65rem;
        color: #1890FF !important; /* Always blue on mobile */
        opacity: 0.7 !important;
    }
    
    .logo-symbol {
        height: 32px; /* Smaller logo on mobile */
        opacity: 0 !important;
    }
    
    .logo-symbol-white {
        height: 32px;
        opacity: 1 !important; /* Always use white logo on mobile */
    }
    
    .nav-menu ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.3rem 0.5rem;
        margin: 0;
        list-style: none;
        padding: 0;
    }
    
    .nav-menu li a {
        font-size: 0.7rem;
        padding: 0.2rem 0.3rem;
        color: #1e293b !important; /* Always dark on mobile */
        font-weight: 500;
        text-decoration: none;
        white-space: nowrap;
    }
    
    .nav-buttons {
        display: none; /* Hide on mobile to save space */
    }
    
    .nav-buttons .btn-primary {
        padding: 0.3rem 0.6rem;
        font-size: 0.65rem;
        white-space: nowrap;
    }

    /* Hero Section Mobile */
    .hero {
        padding: 100px 0 40px; /* Increased top padding to account for taller wrapped menu */
        text-align: center;
        min-height: calc(100vh - 80px); /* Adjust for taller header */
    }
    
    .hero-wrapper {
        display: flex !important; /* Override grid layout */
        flex-direction: column;
        gap: 2rem;
        align-items: center;
    }
    
    .hero-content {
        order: 1;
        width: 100%;
        text-align: center;
    }
    
    .hero-image {
        order: 2;
        width: 100%;
        display: flex;
        justify-content: center;
    }
    
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero p {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
    
    /* Hero buttons mobile alignment */
    .hero-buttons {
        display: flex;
        justify-content: center;
        width: 100%;
    }
    
    /* MOBILE IMAGE OPTIMIZATION */
    .main-dashboard-screen {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        border-radius: 8px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    }

    /* Section Headers Mobile */
    .section-header {
        text-align: center;
        margin-bottom: 2rem;
    }
    
    .section-header h2 {
        font-size: 1.8rem;
        line-height: 1.3;
        margin-bottom: 0.8rem;
    }
    
    .section-header p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    /* Features Grid Mobile */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .feature-card {
        padding: 1.5rem;
        text-align: center;
    }

    /* Features Detail Features Mobile */
    .features-detail-features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem;
        padding: 1.5rem 0;
    }
    
    .feature-detail-section {
        padding: 1.25rem;
    }

    /* Media Plan Features Mobile */
    .media-plan-features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem;
        padding: 1.5rem 0;
    }
    
    .feature-section {
        padding: 1.25rem;
    }

    /* Customisable Settings Features Mobile */
    .customisable-settings-features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem;
        padding: 1.5rem 0;
    }
    
    .settings-feature-section {
        padding: 1.25rem;
    }

    /* Carousel Mobile */
    .toolkits-carousel {
        padding: 60px 0;
    }
    
    .toolkit-categories {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        margin-bottom: 2rem;
    }
    
    .category-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .carousel-container {
        flex-direction: column;
        gap: 1rem;
        min-height: auto;
    }
    
    .preview-card {
        display: none; /* Hide preview cards on mobile */
    }
    
    .carousel-wrapper {
        max-width: 100%;
        order: 1;
        margin: 0 40px; /* Space for nav buttons */
    }
    
    .carousel-nav-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 20;
        width: 45px;
        height: 45px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(24, 144, 255, 0.2);
    }
    
    .carousel-prev {
        left: -25px;
    }
    
    .carousel-next {
        right: -25px;
    }
    
    .toolkit-card {
        padding: 1.5rem;
        min-height: 350px;
    }
    
    .card-header h3 {
        font-size: 1.2rem;
    }
    
    .card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    /* Progress Image Mobile */
    .progress-image {
        margin: 0.5rem 0;
    }
    
    .progress-image img {
        max-width: 100% !important;
        border-radius: 6px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }

    /* Solution Section Mobile */
    .solution-section {
        padding: 60px 0;
    }
    
    .solution-wrapper {
        display: flex !important; /* Override grid layout */
        flex-direction: column;
        gap: 2rem;
        text-align: center;
        align-items: center;
    }
    
    .solution-image {
        order: 2; /* Image below text on mobile */
        width: 100%;
    }
    
    .solution-content {
        order: 1; /* Text above image on mobile */
        width: 100%;
        text-align: center;
    }
    
    .solution-mockup {
        max-width: 100%;
    }
    
    .solution-screen-img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    }

    /* Features Detail Mobile */
    .features-detail {
        padding: 60px 0;
    }
    
    .features-detail-wrapper {
        display: flex !important; /* Override grid layout */
        flex-direction: column;
        gap: 2rem;
        text-align: center;
        align-items: center;
    }
    
    .features-detail-image {
        order: 2; /* Image below text on mobile */
        width: 100%;
    }
    
    .features-detail-content {
        order: 1; /* Text above image on mobile */
        width: 100%;
        text-align: center;
    }
    
    .features-mockup {
        max-width: 100%;
    }
    
    .features-screen-gif {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    }

    /* Budget Planning Mobile */
    .budget-planning-section {
        padding: 60px 0;
    }
    
    .budget-planning-wrapper {
        display: flex !important; /* Override grid layout */
        flex-direction: column;
        gap: 2rem;
        text-align: center;
        align-items: center;
    }
    
    .budget-planning-image {
        order: 2; /* Image below text on mobile */
        width: 100%;
    }
    
    .budget-planning-content {
        order: 1; /* Text above image on mobile */
        width: 100%;
        text-align: center;
    }
    
    .budget-mockup {
        max-width: 100%;
    }
    
    .budget-screen-img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    }

    /* Campaign Insights Mobile */
    .campaign-insights-section {
        padding: 60px 0;
    }
    
    .campaign-insights-wrapper {
        display: flex !important;
        flex-direction: column;
        gap: 2rem;
        text-align: center;
        align-items: center;
    }
    
    .campaign-insights-image {
        order: 2;
        width: 100%;
    }
    
    .campaign-insights-content {
        order: 1;
        width: 100%;
        text-align: center;
    }
    
    .insights-mockup {
        max-width: 100%;
    }
    
    .insights-screen-img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    }

    /* Customisable Settings Mobile */
    .customisable-settings-section {
        padding: 60px 0;
    }
    
    .customisable-settings-wrapper {
        display: flex !important;
        flex-direction: column;
        gap: 2rem;
        text-align: center;
        align-items: center;
    }
    
    .customisable-settings-image {
        order: 2;
        width: 100%;
    }
    
    .customisable-settings-content {
        order: 1;
        width: 100%;
        text-align: center;
    }
    
    .settings-mockup {
        max-width: 100%;
    }
    
    .settings-screen-img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    }

        /* Budget Benefits Mobile */
    .budget-benefits {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1.5rem;
        padding: 1.5rem 0;
    }
    
    .benefit-section {
        padding: 1.25rem;
    }
    
    .benefit-section h3 {
        font-size: 1rem;
    }
    
    .benefit-section p {
        font-size: 0.9rem;
    }
    
    /* Why Choose Mobile */
    .why-choose {
        padding: 60px 0;
    }
    
    .why-choose-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        max-width: 400px;
    }
    
    .why-choose-item {
        text-align: center;
        padding: 1.5rem;
    }

    /* CTA Section Mobile */
    .cta-section {
        padding: 60px 0;
        text-align: center;
    }
    
    .cta-content h2 {
        font-size: 1.8rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }
    
    .cta-content p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Modal Mobile */
    .modal-content {
        width: 95%;
        max-width: 400px;
        margin: 5% auto;
        padding: 1rem;
    }
    
    .contact-form .form-group {
        margin-bottom: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-submit, .btn-cancel {
        width: 100%;
        padding: 0.75rem;
    }

    /* Image Modal Mobile */
    .image-modal-content {
        padding: 10px;
        width: 95%;
    }
    
    .modal-image {
        max-height: 70vh !important;
        border-radius: 6px;
    }
    
    .image-modal-close {
        top: 15px;
        right: 15px;
        font-size: 2rem;
    }
}

/* ===== MEDIUM MOBILE STYLES (480px - 767px) ===== */
@media (min-width: 480px) and (max-width: 767px) {
    .hero {
        padding: 130px 0 50px; /* Medium spacing for medium phones */
        min-height: calc(100vh - 90px);
    }
    
    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.25;
    }
    
    .navbar {
        padding: 0.5rem 0;
        gap: 0.5rem;
    }
}

/* ===== SMALL MOBILE STYLES (320px - 479px) ===== */
@media (max-width: 479px) {
    .container {
        padding: 0 10px;
    }
    
    /* Extra spacing for small phones */
    .hero {
        padding: 140px 0 40px; /* Even more top padding for small phones */
        min-height: calc(100vh - 100px);
    }
    
    .hero h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    .section-header h2 {
        font-size: 1.6rem;
    }
    
    .btn-large {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .toolkit-card {
        padding: 1.25rem;
        min-height: 320px;
    }
    
    .carousel-wrapper {
        margin: 0 35px;
    }
    
    .carousel-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .carousel-prev {
        left: -20px;
    }
    
    .carousel-next {
        right: -20px;
    }
    
    /* Extra small image optimization */
    .main-dashboard-screen,
    .solution-screen-img,
    .features-screen-gif,
    .budget-screen-img,
    .progress-image img {
        border-radius: 6px !important;
        box-shadow: 0 6px 15px rgba(0,0,0,0.12) !important;
    }
}

/* ===== TABLET STYLES (768px - 1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 0 30px;
    }
    
    .hero {
        padding-top: 110px; /* Ensure proper spacing on tablets */
    }
    
    .hero-wrapper {
        gap: 3rem;
    }
    
    .main-dashboard-screen {
        max-width: 500px !important;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .features-detail-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .media-plan-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .why-choose-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
    
    .carousel-container {
        gap: 1.5rem;
    }
    
    .preview-card {
        width: 200px;
        height: 300px;
        padding: 1.25rem;
    }
    
    .solution-screen-img,
    .features-screen-gif,
    .budget-screen-img {
        max-width: 90% !important;
    }
}

/* ===== LARGE SCREENS (1024px and up) ===== */
@media (min-width: 1024px) {
    /* Ensure images don't get too large on very wide screens */
    .main-dashboard-screen {
        max-width: 700px;
    }
    
    .solution-screen-img {
        max-width: 110%;
    }
    
    .features-screen-gif {
        max-width: 120%;
    }
    
    .budget-screen-img {
        max-width: 120%;
    }
}