/* ============================================
   MOBILE OPTIMIZATION CSS - SHARED STYLES
   GrowthArc Landing Pages
   ============================================ */

/* ============ CSS VARIABLE DEFAULTS ============ */
:root {
    --primary: #1a1f3c;
    --primary-dark: #0f1229;
    --secondary: #d4a039;
    --accent: #e8c87a;
    --gray-200: #e5e7eb;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --success: #10b981;
    --life-coach-accent: #10b981;
    --exec-accent: #3b82f6;
}

/* ============ BASE MOBILE RESETS ============ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent horizontal scroll from any element */
img, video, svg, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Prevent long words from breaking layouts */
p, h1, h2, h3, h4, h5, h6, li, td, th, a, span {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============ TOUCH TARGET OPTIMIZATION ============ */
/* Minimum 44x44px touch targets for all interactive elements */
a, button, input[type="button"], input[type="submit"], 
.btn, .nav-cta, .pricing-btn, [role="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* Links in content areas - add padding for touch */
@media (max-width: 768px) {
    nav a, .footer-column a, .nav-links a {
        padding: 12px 16px;
        display: inline-block;
    }
}

/* ============ MOBILE NAVIGATION ============ */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary, #1a1f3c);
    margin: 3px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active,
.mobile-menu-overlay.open {
    display: block;
    opacity: 1;
}

/* Mobile Menu Panel */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: #fff;
    z-index: 999;
    padding: 80px 24px 24px;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active,
.mobile-menu.open {
    right: 0;
}

.mobile-menu a {
    display: block;
    padding: 16px 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--primary, #1a1f3c);
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: color 0.2s;
}

.mobile-menu a:hover {
    color: var(--secondary, #d4a039);
}

.mobile-menu a:last-child {
    border-bottom: none;
}

.mobile-menu .nav-cta {
    display: block;
    margin-top: 24px;
    padding: 16px 24px;
    background: var(--secondary, #d4a039);
    color: var(--primary, #1a1f3c) !important;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
}

/* ============ RESPONSIVE BREAKPOINTS ============ */

/* Tablet - 1024px */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }
    
    /* Two column grids become single */
    .hero-grid,
    .dashboard-showcase,
    .widgets-grid,
    .utm-grid,
    .use-case-grid,
    .enterprise-grid {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
    }
    
    /* Four column grids become two */
    .use-cases-grid,
    .team-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Three column grids become two */
    .features-grid,
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Case study card */
    .case-study-card {
        grid-template-columns: 1fr !important;
    }
    
    /* Footer simplification */
    .footer-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Pricing - remove scale effect */
    .pricing-card.featured {
        transform: none !important;
    }
}

/* Mobile - 768px */
@media (max-width: 768px) {
    /* Show mobile menu button, hide desktop nav */
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .mobile-menu {
        display: block;
    }
    
    .nav-links {
        display: none !important;
    }
    
    /* Navbar adjustments */
    .navbar {
        padding: 0 !important;
    }
    
    .nav-content {
        height: 64px !important;
        padding: 0 16px !important;
    }
    
    /* Typography - ensure readable sizes */
    body {
        font-size: 16px !important;
        line-height: 1.6 !important;
    }
    
    h1, .hero-title {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }
    
    h2, .section-title {
        font-size: 1.75rem !important;
        line-height: 1.25 !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    p, li {
        font-size: 16px !important;
        line-height: 1.6 !important;
    }
    
    /* Section padding reduction */
    section, .section {
        padding: 60px 0 !important;
    }
    
    .segment-hero,
    .hero-creators {
        padding: 100px 0 60px !important;
    }
    
    /* Grids become single column */
    .features-grid,
    .testimonials-grid,
    .use-cases-grid,
    .team-grid,
    .pricing-cards,
    .faq-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    /* Pricing cards - full width */
    .pricing-cards {
        max-width: 100% !important;
    }
    
    .pricing-card {
        padding: 24px !important;
    }
    
    /* CTAs - full width */
    .hero-cta,
    .hero-cta-group {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .btn,
    .btn-white,
    .btn-outline,
    .btn-outline-white,
    .btn-primary,
    .pricing-btn {
        width: 100% !important;
        padding: 16px 24px !important;
        font-size: 16px !important;
        text-align: center !important;
        justify-content: center !important;
    }
    
    /* Stats - wrap on mobile */
    .hero-stats {
        flex-wrap: wrap !important;
        gap: 20px !important;
    }
    
    .hero-stat {
        flex: 1 1 45% !important;
        min-width: 120px !important;
    }
    
    /* Pricing header - stack */
    .pricing-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }
    
    .pricing-amount {
        text-align: left !important;
    }
    
    /* Case study results */
    .case-study-results {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
        text-align: center !important;
    }
    
    .footer-brand {
        text-align: center !important;
    }
    
    .footer-column {
        text-align: center !important;
    }
    
    .footer-column ul {
        padding: 0 !important;
    }
    
    .footer-bottom {
        flex-direction: column !important;
        gap: 16px !important;
        text-align: center !important;
    }
    
    .footer-bottom-links {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    
    /* Hide floating decorative elements */
    .social-float {
        display: none !important;
    }
    
    /* Attribution grid */
    .attribution-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Security badges */
    .security-badges {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Feature icon sizes */
    .feature-icon,
    .use-case-icon {
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
    }
    
    /* Card padding */
    .feature-card,
    .use-case-card,
    .testimonial-card,
    .team-card,
    .faq-item {
        padding: 24px !important;
    }
    
    /* Testimonial author - center on mobile */
    .testimonial-author {
        justify-content: center !important;
    }
    
    /* Large testimonial */
    .testimonial-large {
        padding: 24px !important;
    }
    
    .testimonial-large .quote {
        font-size: 1.1rem !important;
    }
    
    /* Section headers */
    .section-header {
        margin-bottom: 40px !important;
    }
    
    .section-description {
        font-size: 16px !important;
    }
    
    /* Mockups - scale down */
    .hero-mockup,
    .creator-mockup {
        transform: scale(0.9) !important;
        transform-origin: center center !important;
    }
    
    /* Dashboard mockup */
    .dashboard-mockup {
        padding: 16px !important;
    }
    
    /* Code blocks */
    .code-block {
        padding: 16px !important;
        font-size: 12px !important;
    }
    
    /* Widget preview */
    .widget-preview {
        padding: 20px !important;
    }
    
    /* UTM example */
    .utm-example {
        padding: 20px !important;
    }
    
    /* Enterprise visual */
    .enterprise-visual {
        padding: 24px !important;
    }
}

/* Small Mobile - 480px */
@media (max-width: 480px) {
    /* Even more compact */
    h1, .hero-title {
        font-size: 1.75rem !important;
    }
    
    h2, .section-title {
        font-size: 1.5rem !important;
    }
    
    section, .section {
        padding: 48px 0 !important;
    }
    
    .segment-hero,
    .hero-creators {
        padding: 90px 0 48px !important;
    }
    
    .container {
        padding: 0 16px !important;
    }
    
    /* Smaller badges */
    .hero-badge,
    .section-badge {
        font-size: 11px !important;
        padding: 6px 12px !important;
    }
    
    /* Price amount */
    .price, .pricing-card .price {
        font-size: 2.5rem !important;
    }
    
    /* Security badges - single column */
    .security-badges {
        grid-template-columns: 1fr !important;
    }
    
    /* ROI grid */
    .roi-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Hero stats */
    .hero-stat {
        flex: 1 1 100% !important;
    }
    
    .hero-stat-value {
        font-size: 24px !important;
    }
}

/* Extra Small - 375px */
@media (max-width: 375px) {
    h1, .hero-title {
        font-size: 1.5rem !important;
    }
    
    h2, .section-title {
        font-size: 1.35rem !important;
    }
    
    .btn,
    .btn-white,
    .btn-primary,
    .pricing-btn {
        padding: 14px 20px !important;
        font-size: 15px !important;
    }
}

/* ============ FORM OPTIMIZATION ============ */
@media (max-width: 768px) {
    /* Forms stack vertically */
    form {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        width: 100% !important;
        min-height: 48px !important;
        padding: 12px 16px !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        border-radius: 8px !important;
    }
    
    /* Widget inputs */
    .widget-input {
        font-size: 16px !important;
        padding: 14px 16px !important;
    }
    
    .widget-btn {
        padding: 14px !important;
        font-size: 16px !important;
    }
}

/* ============ IMAGE OPTIMIZATION ============ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading placeholder */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============ MODAL MOBILE OPTIMIZATION ============ */
@media (max-width: 768px) {
    .modal,
    [class*="modal"] {
        padding: 16px !important;
    }
    
    .modal-content,
    [class*="modal-content"] {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        border-radius: 16px !important;
    }
}

/* ============ SCROLL BEHAVIOR ============ */
html {
    scroll-behavior: smooth;
}

/* 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;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ============ SAFE AREA INSETS (Notch support) ============ */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .navbar {
        padding-top: max(0px, env(safe-area-inset-top));
    }
    
    .site-footer {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
}

/* ============ ADDITIONAL MOBILE FIXES ============ */

/* Navbar baseline styles - ensure visibility on all pages */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

/* Logo - ensure proper display */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    z-index: 1001;
}

/* Ensure nav-cta buttons are properly styled */
.nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--secondary);
    color: var(--primary) !important;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-cta:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

/* Fix for cards with inline emoji icons */
@media (max-width: 768px) {
    [class*="icon"]:not(svg) {
        font-size: 32px !important;
    }
}

/* Pricing features list - ensure proper display */
@media (max-width: 768px) {
    .pricing-features {
        margin: 20px 0 !important;
    }
    
    .pricing-features li {
        padding: 8px 0 !important;
        font-size: 14px !important;
    }
}

/* Dashboard mockups on mobile */
@media (max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr !important;
    }
    
    .dashboard-sidebar {
        display: none !important;
    }
    
    .dashboard-main {
        padding: 12px !important;
    }
    
    .stat-card {
        padding: 12px !important;
    }
    
    .stat-value {
        font-size: 20px !important;
    }
}

/* Code blocks - prevent overflow */
@media (max-width: 768px) {
    pre, code, .code-block, .code-content {
        overflow-x: auto !important;
        white-space: pre-wrap !important;
        word-break: break-word !important;
        font-size: 12px !important;
    }
}

/* Timeline items */
@media (max-width: 768px) {
    .timeline-item {
        gap: 12px !important;
    }
    
    .timeline-marker {
        width: 6px !important;
        height: 6px !important;
    }
}

/* Case study section */
@media (max-width: 768px) {
    .case-study-visual {
        padding: 32px 20px !important;
    }
    
    .case-study-avatar {
        width: 80px !important;
        height: 80px !important;
        font-size: 32px !important;
    }
    
    .case-study-name {
        font-size: 20px !important;
    }
    
    .case-study-content {
        padding: 32px 20px !important;
    }
    
    .case-study-content h3 {
        font-size: 22px !important;
    }
}

/* Final CTA sections */
@media (max-width: 768px) {
    .final-cta,
    .cta-section {
        padding: 60px 0 !important;
    }
    
    .final-cta h2,
    .cta-section h2 {
        font-size: 1.75rem !important;
    }
    
    .final-cta p,
    .cta-section p {
        font-size: 16px !important;
        padding: 0 16px !important;
    }
}

/* Section-dark text visibility */
@media (max-width: 768px) {
    .section-dark h2,
    .section-dark .section-title {
        color: #fff !important;
    }
    
    .section-dark p,
    .section-dark .section-description {
        color: rgba(255,255,255,0.8) !important;
    }
}

/* ROI grid in mockups */
@media (max-width: 768px) {
    .roi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    .roi-card {
        padding: 12px !important;
    }
    
    .roi-card .value {
        font-size: 1.25rem !important;
    }
    
    .roi-card .label {
        font-size: 10px !important;
    }
}

/* Progress bars */
@media (max-width: 768px) {
    .progress-item {
        padding: 10px !important;
    }
    
    .progress-label {
        font-size: 12px !important;
    }
    
    .progress-bar-bg {
        height: 6px !important;
    }
}

/* ============ PRINT STYLES (for completeness) ============ */
@media print {
    .navbar,
    .mobile-menu-btn,
    .mobile-menu,
    .mobile-menu-overlay,
    footer {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    a {
        text-decoration: underline;
    }
}
