/* 
 * Mobile Styles for Dr. Daniel Araújo Site
 * Mobile First Approach - Critical CSS for Performance
 * Enhanced for mobile optimization following best practices
 */

/* ===== MOBILE CRITICAL CSS VARIABLES ===== */
:root {
    --mobile-base-font: 16px;
    --mobile-line-height: 1.7;
    --mobile-spacing: 1rem;
    --mobile-border-radius: 8px;
    --mobile-touch-target: 44px;
    --mobile-max-width: 350px;
}

/* ===== MOBILE MENU TOGGLE ===== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.mobile-menu-toggle span::before,
.mobile-menu-toggle span::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-toggle span::before { top: -8px; }
.mobile-menu-toggle span::after { top: 8px; }

/* ===== EXTRA SMALL DEVICES (phones, up to 576px) ===== */
@media (max-width: 576px) {
    /* Reset excessive spacing */
    :root {
        --section-spacing: 3rem;
        --element-spacing: 1.5rem;
        --border-radius: 8px;
        --border-radius-lg: 12px;
    }
    
    /* Base typography improvements for mobile readability */
    html {
        font-size: var(--mobile-base-font);
    }
    
    body {
        line-height: var(--mobile-line-height);
        overflow-x: hidden;
    }
    
    /* Mobile-optimized headings hierarchy */
    h1 {
        font-size: 2rem !important; /* 32px */
        line-height: 1.2 !important;
        margin-bottom: 1rem;
        font-weight: 700 !important;
    }
    
    h2 {
        font-size: 1.75rem !important; /* 28px */
        line-height: 1.3 !important;
        margin-bottom: 1rem;
        font-weight: 600 !important;
    }
    
    h3 {
        font-size: 1.375rem !important; /* 22px */
        line-height: 1.4 !important;
        margin-bottom: 0.75rem;
        font-weight: 600 !important;
    }
    
    p {
        font-size: 1rem !important; /* 16px - prevents zoom on iOS */
        line-height: var(--mobile-line-height) !important;
        margin-bottom: 1rem;
        max-width: none; /* Remove desktop constraints */
    }
    
    /* Improved mobile text readability */
    .headline {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.75rem;
    }
    
    .subheadline {
        font-size: 1.125rem !important; /* 18px */
        line-height: 1.5 !important;
        margin-bottom: 1.5rem;
        opacity: 0.9;
    }
    
    /* Container */
    .container {
        padding: 0 1rem !important;
    }
    
    /* Section spacing and mobile grid improvements */
    section {
        padding: 2.5rem 0 !important;
        scroll-margin-top: 80px; /* Account for sticky header */
        overflow-x: hidden; /* Prevent horizontal overflow */
    }
    
    .section-title {
        font-size: 1.5rem !important;
        margin-bottom: 1.5rem;
        text-align: center;
    }
    
    .section-title::after {
        width: 50px;
        height: 2px;
        margin: 0 auto;
    }
    
    /* Mobile Grid System Enhancements */
    .mobile-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
    }
    
    .mobile-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mobile-stack {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Responsive utilities */
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
        max-width: none !important;
    }
    
    /* Header & Navigation */
    .header {
        padding: 0.75rem 0;
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
        background: var(--white);
        z-index: 999;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
    }
    
    .header .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .header-text {
        text-align: center;
        flex-grow: 1;
        padding: 0 1rem;
    }
    
    .mobile-menu-toggle {
        display: flex;
        width: var(--mobile-touch-target);
        height: var(--mobile-touch-target);
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1001;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--white);
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .main-nav.active {
        right: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        padding: 2rem 1rem;
        margin: 0;
    }
    
    .main-nav li {
        margin: 0.5rem 0;
    }
    
    .main-nav a {
        display: block;
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    /* Hero Section */
    .hero {
        min-height: auto;
        padding: 3rem 0;
        background-size: cover;
        text-align: center;
    }
    
    .hero-content {
        text-align: center;
        padding: 0 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .hero .headline {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem;
    }
    
    .hero .subheadline {
        font-size: 1rem !important;
        margin-bottom: 1.5rem;
    }
    
    .hero .btn-hero {
        margin-top: 1rem;
        display: block;
        width: auto;
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Mobile-optimized buttons and CTAs */
    .btn {
        padding: 1rem 1.5rem !important;
        font-size: 1rem !important; /* 16px - prevents zoom */
        width: 100%;
        max-width: var(--mobile-max-width);
        min-height: var(--mobile-touch-target);
        border-radius: var(--mobile-border-radius);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        transition: all 0.2s ease;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border: none;
        cursor: pointer;
        text-decoration: none;
        margin: 0.5rem auto;
    }
    
    .btn-hero {
        padding: 0.875rem 1.5rem !important;
        font-size: 1rem !important; /* 16px */
        font-weight: 600;
        min-height: var(--mobile-touch-target); /* 44px */
        max-width: 280px;
        box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    }
    
    .btn-cta,
    .btn-cta-large {
        padding: 1.125rem 1.75rem !important;
        font-size: 1.125rem !important;
        font-weight: 600;
        width: 100%;
        max-width: none;
        margin: 1rem 0;
    }
    
    .btn-whatsapp,
    .btn-whatsapp-large {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        padding: 1rem 1.5rem !important;
        font-size: 1rem !important;
        width: 100%;
        margin: 0.75rem 0;
    }
    
    /* Touch feedback */
    .btn:active {
        transform: translateY(1px);
        box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }
    
    .btn:focus {
        outline: 2px solid var(--primary, #007bff);
        outline-offset: 2px;
    }
    
    /* Problem Cards */
    .problem-cards {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
        padding: 0 0.5rem; /* Add padding to prevent edge touching */
        width: 100%;
        box-sizing: border-box;
    }
    
    .problem-card {
        padding: 1.5rem;
        text-align: center;
        cursor: pointer;
        position: relative;
    }
    
    .problem-card::after {
        content: "Toque para ler mais";
        position: absolute;
        bottom: 10px;
        right: 10px;
        font-size: 0.75rem;
        color: var(--primary);
        opacity: 0.7;
    }
    
    .problem-card.expanded::after {
        content: "Toque para fechar";
    }
    
    .problem-card h3 {
        font-size: 1.1rem !important;
    }
    
    .problem-card p {
        display: none;
        animation: fadeIn 0.3s ease;
    }
    
    .problem-card.expanded p {
        display: block;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    .problem-image {
        max-height: 120px;
        margin-bottom: 1rem;
    }
    
    /* Previous Attempts Grid */
    .attempts-grid {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 0 0.5rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .attempt-item {
        padding: 1rem;
    }
    
    .icon-wrapper {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    /* Guide Section - Fixed Alignment */
    .guide {
        overflow: hidden;
        width: 100%;
    }
    
    .guide .container {
        padding: 0 1rem !important;
        max-width: 100%;
    }
    
    .guide-intro {
        text-align: center;
        margin-bottom: 2rem;
    }
    
    .guide-intro h2 {
        margin-bottom: 0.5rem;
    }
    
    .guide-intro-text {
        font-size: 1rem;
        opacity: 0.8;
    }
    
    .guide-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .guide-info {
        width: 100%;
        max-width: 500px;
        margin: 0 auto 2rem;
        text-align: center;
        padding: 0;
    }
    
    .guide-info h3 {
        font-size: 1.375rem !important;
        margin: 1rem 0 0.5rem;
        padding: 0 1rem;
    }
    
    .guide-info .credentials {
        font-size: 0.875rem !important;
        margin-bottom: 0.5rem;
        color: #666;
        padding: 0 1rem;
        display: block;
    }
    
    .guide-info .education {
        font-size: 0.813rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1rem;
        color: #777;
        padding: 0 1rem;
        display: block;
    }
    
    .doctor-image {
        width: 180px;
        height: auto;
        margin: 0 auto 1rem;
        display: block !important;
    }
    
    .doctor-image img {
        width: 100%;
        height: auto;
        border-radius: 8px;
        display: block !important;
    }
    
    .empathy-image {
        width: 180px;
        margin: 2rem auto 0;
        display: block;
    }
    
    .empathy-image img {
        width: 100%;
        height: auto;
    }
    
    .empathy-text {
        font-size: 0.938rem !important;
        line-height: 1.6 !important;
        margin: 0 auto 2rem;
        text-align: center;
        display: block !important;
        padding: 0 1rem;
        max-width: 500px;
    }
    
    .medical-difference {
        width: 100%;
        max-width: 500px;
        margin: 2rem auto 0;
        padding: 0;
    }
    
    .medical-difference h3 {
        font-size: 1.25rem !important;
        margin-bottom: 1rem;
        text-align: center;
        padding: 0 1rem;
    }
    
    .medical-difference > p {
        font-size: 0.938rem !important;
        margin-bottom: 1rem;
        text-align: center;
        padding: 0 1rem;
    }
    
    .medical-difference ul {
        padding: 0 1rem 0 2.5rem;
        list-style-type: disc;
        margin: 0;
        text-align: left;
    }
    
    .medical-difference li {
        font-size: 0.875rem !important;
        line-height: 1.5 !important;
        margin-bottom: 0.875rem;
        padding-right: 0.5rem;
    }
    
    /* Plan Steps */
    .plan-steps {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 0 0.5rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .step-card {
        padding: 1.5rem;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .step-card:active {
        transform: scale(0.98);
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .plan-image {
        max-height: 100px;
    }
    
    /* CTA Sections */
    .cta-options {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .whatsapp-option {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        text-align: center;
    }
    
    .whatsapp-option h3 {
        margin-bottom: 1.5rem;
    }
    
    .cta-buttons-wrapper {
        margin-top: 2rem;
    }
    
    /* Failure vs Success */
    .comparison-columns {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .failure-column,
    .success-column {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .consequence-item h3,
    .success-item h3 {
        font-size: 1.1rem !important;
    }
    
    .consequence-item p,
    .success-item p {
        font-size: 0.85rem !important;
    }
    
    .consequence-image,
    .success-image {
        max-height: 100px;
    }
    
    /* Aspirational Section */
    .aspirational-pillars {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .pillar-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Testimonials */
    .testimonials-slider {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 0;
        width: 100%;
        align-items: center;
    }
    
    .testimonial-card {
        margin-bottom: 1.5rem;
        padding: 1.5rem;
    }
    
    .testimonial-text {
        font-size: 0.9rem !important;
    }
    
    /* Footer */
    .footer {
        text-align: center;
        padding: 2rem 0;
    }
    
    .footer-content {
        display: flex;
        flex-direction: column;
        text-align: center;
        align-items: center;
        gap: 2rem;
    }
    
    .footer-info,
    .footer-links,
    .footer-social {
        margin-bottom: 0;
        width: 100%;
    }
    
    .footer-links ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .footer-bottom {
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    
    /* Empathy message mobile styles */
    .empathy-message {
        padding: 1.5rem !important;
        font-size: 1rem !important;
        margin: 2rem auto !important;
        max-width: none !important;
    }
    
    .empathy-message p {
        font-size: 1rem !important;
        line-height: 1.6 !important;
        margin-bottom: 0 !important;
    }

    /* Hide non-essential elements */
    .plan-difference {
        display: none;
    }
    
    /* Mobile-optimized forms */
    .contact-form {
        padding: 1.5rem;
        margin-bottom: 2rem;
        border-radius: var(--mobile-border-radius);
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-group label {
        display: block;
        font-weight: 600;
        margin-bottom: 0.5rem;
        font-size: 1rem;
        color: var(--text, #333);
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
        width: 100%;
        padding: 1rem;
        border: 2px solid #e1e5e9;
        border-radius: var(--mobile-border-radius);
        background: #fff;
        transition: border-color 0.2s ease;
        min-height: var(--mobile-touch-target);
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
    }
    
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="tel"]:focus,
    textarea:focus {
        outline: none;
        border-color: var(--primary, #007bff);
        box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
    }
    
    /* Improve textarea usability */
    textarea {
        min-height: 120px;
        resize: vertical;
        font-family: inherit;
    }
    
    /* Input validation styles */
    input:invalid:not(:placeholder-shown) {
        border-color: #dc3545;
    }
    
    input:valid:not(:placeholder-shown) {
        border-color: #28a745;
    }
}

/* ===== SMALL DEVICES (phones landscape & small tablets, 577px to 768px) ===== */
@media (min-width: 577px) and (max-width: 768px) {
    /* Adjust typography */
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }
    
    /* Container */
    .container { padding: 0 1.5rem; }
    
    /* Navigation - still mobile menu */
    .mobile-menu-toggle { display: block; }
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-width: 350px;
        height: 100vh;
        background: var(--white);
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
    }
    
    .main-nav.active { right: 0; }
    
    .main-nav ul {
        flex-direction: column;
        padding: 2rem 1rem;
    }
    
    /* Grid adjustments */
    .problem-cards,
    .attempts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .plan-steps {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== MEDIUM DEVICES (tablets & small desktops, 769px to 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Container */
    .container {
        max-width: 900px;
    }
    
    /* Typography fine-tuning */
    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    
    /* Grid adjustments */
    .problem-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== TOUCH-FRIENDLY ADJUSTMENTS (all mobile devices) ===== */
@media (max-width: 1024px) {
    /* Increase touch targets */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing for touch */
    .btn {
        margin: 0.5rem 0;
    }
    
    /* Improve form usability */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea {
        padding: 0.75rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Add hover states for touch */
    .btn:active {
        transform: translateY(2px);
    }
    
    /* CTA Final Section - Optimized UX Design */
    .cta-final {
        padding: 3rem 0;
        background: #f8f9fa;
        text-align: center;
        border-top: 1px solid #e9ecef;
    }
    
    .cta-final .container {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .cta-final h2 {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem;
        color: #2c3e50;
    }
    
    .cta-final .cta-text {
        font-size: 0.95rem !important;
        margin-bottom: 2rem;
        opacity: 0.8;
        line-height: 1.5;
    }
    
    .cta-final-buttons {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .cta-helper-text {
        font-size: 0.813rem !important;
        color: #6c757d;
        margin: 0.5rem 0 0;
    }
    
    /* Testimonials Section - Clean Design */
    .testimonials {
        background: #fff;
        padding-bottom: 2rem; /* Reduced bottom padding */
    }
    
    .testimonial-card {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 12px;
        padding: 1.5rem;
        margin-bottom: 1rem;
        position: relative;
    }
    
    .quote-mark {
        color: var(--primary, #007bff);
        opacity: 0.2;
        font-size: 2rem;
        position: absolute;
        top: 0.5rem;
        left: 1rem;
    }
    
    /* Primary WhatsApp Button */
    .btn-whatsapp-large.btn-primary {
        background: #25d366;
        color: white;
        padding: 1rem 2rem !important;
        font-size: 1.125rem !important;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
        border: none;
    }
    
    .btn-whatsapp-large.btn-primary:active {
        background: #20bd5a;
        transform: translateY(1px);
    }
}

/* ===== LANDSCAPE ORIENTATION ADJUSTMENTS ===== */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 1rem 0;
    }
    
    section {
        padding: 2rem 0 !important;
    }
    
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.3rem !important; }
}

/* ===== PRINT STYLES ===== */
@media print {
    .header,
    .cta-main,
    .cta-final,
    .footer,
    .mobile-menu-toggle {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a {
        text-decoration: underline;
    }
}
