/* Responsive Design */
@media (max-width: 1024px) {
    .about-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .about-image-wrapper {
        padding: 20px;
    }

    /* Hero Section Tablet */
    .hero {
        padding: 72px 0 64px;
    }

    .hero-inner {
        gap: 40px;
    }

    .hero-panel {
        max-width: 400px;
        margin: 0 auto;
    }

    /* Stats Section Tablet */
    .stats-row {
        flex-wrap: wrap;
        gap: 20px;
    }

    .stats-card {
        flex: 1 1 calc(50% - 10px);
        min-width: 200px;
    }

    /* Features Section Tablet */
    .features {
        padding: 80px 40px;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    /* Integration Section Tablet */
    .integration-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    /* Pricing Section Tablet */
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    /* Steps Section Tablet */
    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .about-title {
        font-size: 16px;
    }
    
    .about-desc {
        font-size: 14px;
    }

    /* Mobile Header Styles */
    .header .container {
        position: relative;
    }

    /* Full-width mobile dropdown — works regardless of container width */
    .mobile-menu {
        left: -16px;
        right: -16px;
        width: auto;
        margin-left: 0;
        background-color: var(--header-bg);
        -webkit-backdrop-filter: saturate(180%) blur(18px);
        backdrop-filter: saturate(180%) blur(18px);
    }

    .header-link {
        display: none;
    }

    /* Hide desktop theme toggle on mobile — saves space for login button */
    .header .theme-toggle {
        display: none;
    }

    /* Show login button on mobile as a compact text link */
    .header-actions .btn-secondary {
        display: inline-flex;
        padding: 0 14px;
        height: 36px;
        font-size: 13px;
        border-radius: 999px;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: transparent;
        border: 1px solid var(--header-border);
        color: var(--heading-color);
        font-size: 20px;
    }

    .mobile-menu-toggle:hover {
        color: var(--brand-mid);
        border-color: rgba(124, 58, 237, 0.4);
        background: rgba(124, 58, 237, 0.06);
    }

    .header-actions {
        gap: 10px;
    }

    .btn-primary {
        padding: 0 16px;
        font-size: 13px;
    }

    /* Hero: stack on mobile */
    .hero {
        padding: 56px 0 48px;
    }

    .hero-inner {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .hero-content {
        text-align: center;
        max-width: none;
    }

    .hero-description {
        margin-left: auto;
        margin-right: auto;
        font-size: 16px;
        margin-bottom: 20px;
        max-width: 100%;
    }

    .hero-meta {
        text-align: center;
    }

    .hero-title {
        margin-bottom: 14px;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-visual {
        order: -1;
    }

    .hero-panel {
        max-width: 100%;
    }

    /* Features Section Responsive - Mobile */
    .features {
        padding: 60px 20px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .features-card {
        padding: 20px;
        gap: 16px;
        width: 100%;
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .feature-icon {
        width: 56px;
        height: 56px;
        flex-shrink: 0;
    }

    .feature-icon i {
        font-size: 24px;
    }

    .feature-text {
        min-width: 0;
        flex: 1;
        width: 100%;
    }

    .feature-text h3 {
        font-size: 18px;
        line-height: 1.3;
        margin-bottom: 4px;
    }

    .feature-text p {
        font-size: 14px;
        line-height: 1.5;
    }

    /* Section Header Mobile */
    .section-header .title {
        font-size: 28px;
        line-height: 1.3;
        margin-bottom: 16px;
    }

    .section-header .desc {
        font-size: 14px;
        line-height: 1.6;
        padding: 0 10px;
    }

    /* Automation Card Mobile */
    .automation-card {
        grid-template-columns: 1fr;
        margin-bottom: calc(100vh - 100px);
    }

    .automation-card:last-child {
        margin-bottom: 0;
    }

    .automation-cards-container {
        height: auto;
        padding-bottom: 0vh;
    }

    /* Integration Section Mobile */
    .integration-section {
        padding: 60px 0;
    }

    .integration-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Pricing Section Mobile */
    .pricing {
        padding: 60px 0;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .pricing-card {
        padding: 30px;
    }

    /* Steps Section Mobile */
    .steps {
        padding: 60px 0;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Footer Mobile */
    .footer {
        padding: 60px 0 40px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
        margin-bottom: 30px;
    }

    .footer-tagline {
        max-width: 100%;
    }

    .footer-links {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        padding-top: 20px;
    }

    .footer-copyright {
        text-align: left;
    }

    /* FAQ Section Mobile */
    .faq {
        padding: 60px 0;
    }

    .faq-container {
        gap: 16px;
    }

    .faq-item {
        padding: 20px;
    }

    .faq-question {
        gap: 12px;
    }

    .faq-question h3 {
        font-size: 16px;
        line-height: 1.4;
    }

    .faq-icon {
        font-size: 18px;
    }

    .faq-answer p {
        font-size: 14px;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 48px 0 40px;
    }

    .hero-title {
        margin-bottom: 12px;
    }

    .hero-description {
        font-size: 15px;
        margin-bottom: 18px;
    }

    .hero-cta-primary {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 14px;
    }

    .hero-meta {
        font-size: 12px;
        line-height: 1.5;
    }

    /* Stats Section Responsive */
    .stats {
        padding: 40px 0;
    }

    .stats-row {
        flex-direction: column;
        gap: 24px;
        align-items: flex-start;
    }

    .stats-card {
        width: 100%;
        flex: none;
        gap: 16px;
    }

    .stats-icon {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }

    .stats-icon i {
        font-size: 20px;
    }

    .stats-text {
        min-width: 0;
        flex: 1;
    }

    .stats-text h3 {
        font-size: 18px;
    }

    .stats-text p {
        font-size: 13px;
        white-space: normal;
        line-height: 1.5;
        word-wrap: break-word;
    }

    /* Features Section Responsive */
    .features {
        padding: 60px 20px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .features-card {
        padding: 20px;
        gap: 16px;
        width: 100%;
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .feature-icon {
        width: 56px;
        height: 56px;
        flex-shrink: 0;
    }

    .feature-icon i {
        font-size: 24px;
    }

    .feature-text {
        min-width: 0;
        flex: 1;
        width: 100%;
    }

    .feature-text h3 {
        font-size: 18px;
        line-height: 1.3;
        margin-bottom: 4px;
    }

    .feature-text p {
        font-size: 14px;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .features {
        padding: 40px 16px;
    }

    .features-grid {
        gap: 12px;
    }

    .features-card {
        padding: 18px;
        gap: 14px;
        flex-direction: column;
        align-items: flex-start;
    }

    .feature-icon {
        width: 52px;
        height: 52px;
    }

    .feature-icon i {
        font-size: 22px;
    }

    .feature-text h3 {
        font-size: 17px;
    }

    .feature-text p {
        font-size: 13px;
    }

    .toggle-label {
        width: 50px;
        height: 28px;
        padding: 0 6px;
    }

    .toggle-label .toggle-text {
        width: 22px;
        height: 22px;
        top: 3px;
        left: 3px;
    }

    .toggle-switch input:checked + .toggle-label .toggle-text {
        transform: translateX(22px);
    }

    .toggle-label::before,
    .toggle-label::after {
        font-size: 12px;
    }
}

/* ========== Global mobile overflow fix ========== */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Ensure all sections don't bleed horizontally */
    section, .hero, .features, .stats, .pricing, .steps, .faq, .footer {
        overflow-x: hidden;
    }

    /* Header: explicit side padding so logo/buttons never touch screen edges */
    .header .container {
        width: 100%;
        padding-left: 16px;
        padding-right: 16px;
        box-sizing: border-box;
    }

    .header-row {
        padding: 10px 0;
        gap: 12px;
    }

    /* Logo sizing on mobile */
    .logo {
        height: 30px;
        max-width: 140px;
    }

    .logo-text--with-logo {
        font-size: 13px;
        max-width: min(100px, 24vw);
    }

    .header-brand {
        gap: 8px;
    }

    /* Sign up button: tighter on mobile */
    .header-actions .btn-primary {
        padding: 0 14px;
        height: 36px;
        font-size: 13px;
    }

    /* Hide the arrow icon from Sign Up on mobile to save width */
    .header-actions .btn-primary i {
        display: none;
    }

    /* Mobile menu item touch targets */
    .mobile-menu-item a {
        padding: 14px 20px;
        font-size: 15px;
    }

    .hero-meta {
        text-wrap: balance;
        padding: 0 12px;
    }

    /* Stats section: 2 columns on tablets */
    .stats-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    /* Section headers: slightly tighter */
    .section-header {
        padding: 0 12px;
    }

    /* Automation section: remove huge bottom margin */
    .automation-card {
        margin-bottom: 40px;
    }

    .automation-cards-container {
        height: auto;
    }

    /* Review cards: single column */
    .reviews-grid,
    .review-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* CTA section */
    .cta {
        padding: 60px 0;
    }

    .cta-title {
        font-size: 28px;
    }

    .cta-desc {
        font-size: 14px;
    }
}

/* ========== Very small phones (≤ 360px) ========== */
@media (max-width: 360px) {
    /* Keep header padding consistent on tiny phones */
    .header .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .mobile-menu {
        left: -12px;
        right: -12px;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-description {
        font-size: 14px;
        padding: 0 8px;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .section-header .title {
        font-size: 22px;
    }

    .logo {
        height: 26px;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 12px;
        padding: 0 12px;
        height: 36px;
    }

    .footer-bottom {
        text-align: center;
        align-items: center;
    }
}