/**
 * Mobile Optimization - Serene Space AI
 * Comprehensive mobile-first responsive design
 * Optimized for phones (320px - 768px)
 */

/* ========================================
   MOBILE-FIRST BASE IMPROVEMENTS
   ======================================== */

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Better touch targets on mobile (min 44px x 44px) but more compact */
button,
a.btn-primary,
a.btn-secondary,
.cta-button,
input[type="submit"],
input[type="button"] {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 20px;
}

/* Larger tap targets for links */
a {
    padding: 4px 0;
}

/* Optimize text readability on mobile */
body {
    font-size: 16px; /* Prevents iOS zoom on input focus */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Darker text colors for better mobile readability */
@media (max-width: 768px) {
    /* Override CSS variables for darker text on mobile */
    :root {
        --text-secondary: #334155; /* Much darker gray (was #64748b) */
        --text-light: #475569; /* Darker light gray (was #94a3b8) */
    }
    
    /* Ensure body text is dark and readable */
    body {
        color: #1e293b; /* Very dark slate */
    }
    
    /* Make all paragraphs highly readable */
    p {
        color: #334155; /* Dark slate gray - much more readable */
    }
    
    /* List items should be readable */
    li {
        color: #334155;
    }
    
    /* Headings stay very dark */
    h1, h2, h3, h4, h5, h6 {
        color: #0f172a; /* Almost black */
    }
    
    /* Feature cards and descriptions */
    .feature-description,
    .feature-card p,
    .service-description,
    .benefit-description {
        color: #334155; /* Dark and readable */
    }
    
    /* Testimonial text */
    .testimonial-text,
    .testimonial-content,
    .testimonial p {
        color: #334155;
    }
    
    /* FAQ answers */
    .faq-answer,
    .faq-answer p {
        color: #334155;
    }
    
    /* Card content */
    .card p,
    .card-description,
    .card-text {
        color: #334155;
    }
    
    /* Section descriptions */
    .section-description,
    .section-subtitle {
        color: #334155;
    }
    
    /* Stats and numbers should be visible */
    .stat-description,
    .stat-label {
        color: #475569; /* Medium-dark gray */
    }
    
    /* Small text still readable */
    small, 
    .small-text,
    .text-sm {
        color: #475569;
    }
    
    /* Ensure pricing text is readable */
    .pricing-card p,
    .pricing-description,
    .price-details {
        color: #334155;
    }
    
    /* Blog and article text */
    article p,
    .blog-content p,
    .post-content p {
        color: #334155;
    }
}

/* ========================================
   NAVIGATION - MOBILE OPTIMIZED
   ======================================== */

@media (max-width: 768px) {
    /* Ensure body has padding for navbar */
    body {
        padding-top: 70px !important; /* Navbar height */
    }

    .navbar {
        padding: 12px 0;
    }

    .nav-content {
        padding: 0 16px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .nav-links {
        display: none; /* Hide desktop nav */
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        padding: 14px 20px;
        font-size: 1.1rem;
        border-bottom: 1px solid #e2e8f0;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-cta {
        margin-top: 10px;
        display: block;
        text-align: center;
        padding: 14px 20px !important;
    }

    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 25px;
        height: 3px;
        background: #667eea;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

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

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

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

/* ========================================
   HERO SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .hero-section {
        padding: 80px 20px 60px;
        min-height: auto;
    }

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

    .hero-content h1 {
        font-size: 2rem; /* Was probably 3-4rem */
        line-height: 1.2;
        margin-bottom: 20px;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        line-height: 1.6;
        margin-bottom: 30px;
    }

    .hero-cta {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .hero-cta .btn-large {
        width: 100%;
        font-size: 1rem;
        padding: 16px 24px;
    }

    /* Hero stats/badges */
    .hero-stats {
        flex-direction: column;
        gap: 15px;
        margin-top: 30px;
    }

    .stat-card {
        width: 100%;
        padding: 20px;
    }

    .stat-number {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }
}

/* ========================================
   PRICING SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .pricing-section {
        padding: 60px 20px;
    }

    .pricing-comparison {
        flex-direction: column;
        gap: 20px;
    }

    .pricing-card {
        width: 100%;
        max-width: 100%;
    }

    .pricing-amount {
        font-size: 2.5rem;
    }

    .pricing-features {
        padding: 20px;
    }

    .pricing-features li {
        font-size: 0.95rem;
        padding: 10px 0;
    }

    .pricing-cta {
        font-size: 1rem;
        padding: 14px 20px;
    }

    /* Pricing grid for multiple plans */
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ========================================
   FAQ SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .faq-section {
        padding: 60px 20px;
    }

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

    .faq-item {
        padding: 14px 16px;
    }

    .faq-question {
        font-size: 1.1rem;
        line-height: 1.4;
        padding-right: 30px; /* Space for accordion icon */
    }

    .faq-answer {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

/* ========================================
   FOOTER - MOBILE
   ======================================== */

@media (max-width: 768px) {
    footer {
        padding: 40px 20px 20px;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .footer-column {
        margin-bottom: 20px;
    }

    .footer-heading {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .footer-column a {
        font-size: 0.9rem;
        padding: 8px 0;
    }

    .trust-badges {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .trust-badge {
        font-size: 0.8rem;
        padding: 8px 16px;
        width: 100%;
        max-width: 280px;
        text-align: center;
    }

    .contact-info {
        font-size: 0.85rem;
        line-height: 1.8;
        text-align: center;
    }

    .copyright {
        font-size: 0.85rem;
        text-align: center;
    }
}

/* ========================================
   FORMS & INPUTS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 14px;
        width: 100%;
    }

    .form-group {
        margin-bottom: 20px;
    }

    label {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
}

/* ========================================
   MODAL/POPUP - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 20px auto;
        padding: 30px 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .modal-body {
        font-size: 0.95rem;
    }

    .modal-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
}

/* ========================================
   TABLES - MOBILE (Make Responsive)
   ======================================== */

@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .comparison-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .comparison-table {
        min-width: 600px; /* Allow horizontal scroll */
    }

    .comparison-table th,
    .comparison-table td {
        font-size: 0.85rem;
        padding: 10px 8px;
    }
}

/* ========================================
   IMAGES - MOBILE OPTIMIZATION
   ======================================== */

@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }

    .hero-image,
    .feature-image,
    .testimonial-image {
        width: 100%;
        height: auto;
        object-fit: cover;
    }
}

/* ========================================
   GRID LAYOUTS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .benefits-grid,
    .features-grid,
    .steps-grid,
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .two-column-layout,
    .three-column-layout {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   BUTTONS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .btn-primary,
    .btn-secondary,
    .btn-large {
        width: 100%;
        max-width: 100%;
        font-size: 1rem;
        padding: 14px 20px;
        text-align: center;
    }

    .button-group {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .button-group button {
        width: 100%;
    }
}

/* ========================================
   SECTION SPACING - MOBILE
   ======================================== */

@media (max-width: 768px) {
    section {
        padding: 60px 20px;
    }

    .section-header {
        margin-bottom: 40px;
    }

    .section-title {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 15px;
    }

    .section-subtitle {
        font-size: 1rem;
        line-height: 1.6;
    }
}

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

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }
}

/* ========================================
   CARDS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .card,
    .feature-card,
    .benefit-card,
    .testimonial-card {
        padding: 24px;
        margin-bottom: 20px;
    }

    .card-title {
        font-size: 1.2rem;
    }

    .card-description {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

/* ========================================
   TYPOGRAPHY - MOBILE
   ======================================== */

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.4rem;
        line-height: 1.4;
    }

    h4 {
        font-size: 1.2rem;
    }

    h5, h6 {
        font-size: 1rem;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
    }

    .lead {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    p {
        font-size: 0.95rem;
    }
}

/* ========================================
   LIVE CHAT WIDGET - MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Tawk.to chat widget positioning */
    .fallback-chat-button {
        bottom: 15px;
        right: 15px;
        padding: 12px 20px;
        font-size: 14px;
    }

    .fallback-chat-button span {
        display: none; /* Hide text on mobile, show icon only */
    }

    .fallback-chat-button {
        border-radius: 50%;
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
    }
}

/* ========================================
   COOKIE CONSENT - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .cookie-consent-banner {
        padding: 20px 16px;
    }

    .cookie-consent-content {
        flex-direction: column;
        gap: 15px;
    }

    .cookie-consent-text {
        font-size: 0.9rem;
    }

    .cookie-consent-buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .cookie-btn {
        width: 100%;
        padding: 12px;
        font-size: 0.95rem;
    }
}

/* ========================================
   URGENCY COUNTER - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .urgency-counter {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .spot-progress-bar {
        padding: 12px;
    }

    .progress-label {
        font-size: 0.75rem;
    }

    .hero-urgency-badge {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* ========================================
   BLOG SEARCH - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .blog-search-container {
        margin-bottom: 40px;
    }

    #blog-search-input {
        font-size: 1rem;
        padding: 12px;
    }

    #blog-search-btn {
        width: 42px;
        height: 42px;
    }

    .result-item {
        padding: 20px 15px;
    }

    .result-item h3 {
        font-size: 1.1rem;
    }

    .result-item p {
        font-size: 0.95rem;
    }
}

/* ========================================
   CITY PAGES - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .city-hero {
        padding: 80px 20px 60px;
    }

    .city-hero h1 {
        font-size: 2rem;
    }

    .neighborhoods {
        padding: 40px 20px;
    }

    .neighborhoods-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .neighborhood-item {
        padding: 12px;
        font-size: 0.95rem;
    }
}

/* ========================================
   INVESTOR PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .investor-hero {
        padding: 80px 20px 60px;
    }

    .market-size-chart,
    .traction-metrics {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

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

    .investment-card {
        padding: 24px;
    }
}

/* ========================================
   ACCESSIBILITY PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .legal-content {
        padding: 60px 15px 40px;
    }

    .legal-content .container {
        padding: 40px 20px;
    }

    .legal-content h1 {
        font-size: 2rem;
    }

    .legal-content h2 {
        font-size: 1.5rem;
    }

    .legal-content h3 {
        font-size: 1.2rem;
    }

    .legal-content p,
    .legal-content li {
        font-size: 0.95rem;
    }
}

/* ========================================
   REFERRAL PROGRAM - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .referral-hero h1 {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 15px;
    }

    .hero-stats .stat {
        padding: 20px 25px;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .how-it-works h2,
    .referral-benefits h2,
    .share-section h2,
    .message-templates h2,
    .referral-faq h2,
    .final-cta h2 {
        font-size: 2rem;
    }

    .share-box {
        padding: 30px 20px;
    }

    .templates-grid,
    .faq-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    /* Reduce animations on mobile for performance */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }

    /* Optimize scroll performance */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* Reduce box shadows on mobile (performance) */
    .card,
    .pricing-card,
    .feature-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
}

/* ========================================
   LANDSCAPE MODE (PHONES)
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 60px 20px 40px;
    }

    .modal-content {
        max-height: 85vh;
    }
}

/* ========================================
   VERY SMALL SCREENS (iPhone SE, etc.)
   ======================================== */

@media (max-width: 375px) {
    .container {
        padding: 0 16px;
    }

    h1 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 0.95rem;
        padding: 12px 16px;
    }

    .trust-badge {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
}

/* ========================================
   TOUCH INTERACTIONS
   ======================================== */

/* Remove hover effects on touch devices */
@media (hover: none) {
    button:hover,
    a:hover,
    .card:hover {
        transform: none;
    }

    /* Keep tap highlight for touch feedback */
    button:active,
    a:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* Better tap highlight color */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
    }
}

/* ========================================
   PRINT STYLES (Bonus)
   ======================================== */

@media print {
    .navbar,
    .chat-widget,
    .cookie-consent-banner,
    footer {
        display: none;
    }

    body {
        font-size: 12pt;
    }

    h1 {
        font-size: 24pt;
    }

    h2 {
        font-size: 18pt;
    }
}
