/* Comprehensive Responsive Layout Fixes */
/* Ensures proper proportions, alignment, and spacing across all screen sizes */

:root {
    /* Responsive container widths */
    --max-content-width: min(100%, 1200px);
    --comfortable-reading-width: min(100%, 65ch);
    --mobile-padding: clamp(1rem, 4vw, 2rem);
    --desktop-padding: clamp(2rem, 5vw, 4rem);
}

/* Universal responsive container */
.container, .container-fluid {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
}

/* Prevent horizontal overflow globally */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Responsive sections with proper spacing */
section {
    padding: var(--mobile-padding) 0;
    width: 100%;
}

/* Cards and panels - prevent overflow */
.card, .panel, .modal-content, .feature-card {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Responsive text alignment */
.text-center {
    text-align: center;
}

/* Force center alignment for CTA sections - Ultimate Override */
.section-cta {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 3rem auto 0 auto !important;
    width: 100% !important;
    padding: 2rem 1rem !important;
    position: relative !important;
}

.section-cta::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 1px;
}

.section-cta * {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
}

.section-cta .btn {
    display: block !important;
    margin: 0 auto !important;
    text-align: center !important;
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.section-cta .cta-subtext {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    width: 100% !important;
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* Force center alignment for feature cards and benefit highlights */
.benefit-highlight {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    width: 100% !important;
}

.feature-card {
    text-align: center !important;
}

.feature-card h3,
.feature-card p,
.feature-card .benefit-highlight,
.feature-card .example-label,
.feature-card .example-text {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.features-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    gap: 2rem !important;
    justify-items: center !important;
    align-items: start !important;
}

/* Clean Simple Pricing */
.simple-pricing-section {
    padding: 3rem 0 !important;
    background: rgba(255, 255, 255, 0.02) !important;
}

.pricing-header {
    text-align: center !important;
    margin-bottom: 3rem !important;
}

.pricing-header h2 {
    color: #A7F0BA !important;
    font-size: 2.2rem !important;
    font-weight: 600 !important;
    margin-bottom: 0 !important;
}

.clean-pricing {
    display: flex !important;
    gap: 1.5rem !important;
    justify-content: center !important;
    align-items: stretch !important;
    max-width: 900px !important;
    margin: 0 auto !important;
}

.plan {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 16px !important;
    padding: 2rem 1.5rem !important;
    text-align: center !important;
    flex: 1 !important;
    min-width: 240px !important;
    max-width: 280px !important;
    position: relative !important;
    transition: all 0.3s ease !important;
}

.plan.popular {
    border-color: rgba(255, 217, 61, 0.4) !important;
    background: rgba(255, 217, 61, 0.06) !important;
    transform: scale(1.05) !important;
}

.popular-label {
    position: absolute !important;
    top: -12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: linear-gradient(135deg, #f59e0b, #f97316) !important;
    color: #000 !important;
    padding: 6px 16px !important;
    border-radius: 16px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.plan h3 {
    color: #A7F0BA !important;
    font-size: 1.4rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
}

.plan-price {
    color: #FFD93D !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    margin: 0.75rem 0 !important;
}

.plan p {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.9rem !important;
    margin-bottom: 1.5rem !important;
    line-height: 1.4 !important;
}

.plan-btn {
    display: block !important;
    width: 100% !important;
    padding: 0.9rem 1.5rem !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    border: none !important;
    font-size: 0.9rem !important;
}

.free-btn {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

.free-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.premium-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: white !important;
}

.premium-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3) !important;
    color: white !important;
}

.platinum-btn {
    background: linear-gradient(135deg, #a855f7, #9333ea) !important;
    color: white !important;
}

.platinum-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.3) !important;
    color: white !important;
}

@media (max-width: 768px) {
    .clean-pricing {
        flex-direction: column !important;
        align-items: center !important;
        gap: 1rem !important;
    }
    
    .plan {
        max-width: 100% !important;
        min-width: 280px !important;
    }
    
    .plan.popular {
        transform: none !important;
    }
}

/* Flexible layouts */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.col, .col-md-6, .col-lg-4 {
    flex: 1;
    padding: 0 0.75rem;
    min-width: 0; /* Prevents overflow in flex items */
}

/* Mobile-first responsive breakpoints */
@media (max-width: 576px) {
    /* Extra small devices */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .row {
        margin: 0;
    }
    
    .col, .col-md-6, .col-lg-4 {
        flex: 100%;
        padding: 0;
        margin-bottom: 1rem;
    }
    
    /* Responsive button sizing */
    .btn {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        display: block;
        padding: 0.875rem 1rem;
        font-size: clamp(0.875rem, 3.5vw, 1rem);
    }
    
    /* Card spacing on mobile */
    .card, .panel {
        margin-bottom: 1rem;
        padding: 1.5rem 1rem;
    }
    
    /* Typography adjustments */
    h1 { font-size: clamp(1.75rem, 7vw, 2.5rem); }
    h2 { font-size: clamp(1.5rem, 6vw, 2rem); }
    h3 { font-size: clamp(1.25rem, 5vw, 1.75rem); }
    
    /* Responsive modals */
    .modal-content {
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    /* Small tablets */
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .btn {
        width: auto;
        min-width: 120px;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    /* Large tablets */
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

@media (min-width: 993px) {
    /* Desktop */
    .container {
        padding-left: var(--desktop-padding);
        padding-right: var(--desktop-padding);
    }
    
    section {
        padding: var(--desktop-padding) 0;
    }
}

/* Responsive images and media */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Responsive tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Form responsiveness */
.form-control, .form-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Landing page specific fixes */
.landing-page .hero {
    padding: 3rem 0;
    text-align: center;
}

.landing-page .hero-title {
    max-width: var(--comfortable-reading-width);
    margin: 0 auto 1.5rem;
}

.landing-page .hero-subtitle {
    max-width: var(--comfortable-reading-width);
    margin: 0 auto 2rem;
}

/* Feature cards grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

@media (max-width: 576px) {
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Main app layout fixes */
.main-app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Modal responsiveness */
.modal {
    padding: 1rem;
}

.modal-dialog {
    max-width: min(90vw, 600px);
    margin: 2rem auto;
}

.modal-content {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

@media (max-width: 576px) {
    .modal {
        padding: 0.5rem;
    }
    
    .modal-dialog {
        margin: 1rem auto;
        max-width: 95vw;
    }
    
    .modal-content {
        border-radius: 0.75rem;
    }
}

/* Header responsiveness - Keeping original alignment */

/* Center align all feature card text and CTA sections */
.benefit-highlight {
    text-align: center !important;
}

.section-cta {
    text-align: center !important;
}

.feature-card {
    text-align: center !important;
}

.feature-card h3,
.feature-card p,
.feature-card .feature-example {
    text-align: center !important;
}

/* Navigation improvements */
.navbar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .navbar-nav {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        text-align: center;
    }
}

/* Fix overflow in specific components */
.testimonial-carousel,
.feature-demo,
.pricing-grid {
    overflow: hidden;
    width: 100%;
}

/* Ensure no horizontal scrollbar */
.no-scroll-x {
    overflow-x: hidden !important;
}

/* Add to body for global application */
body {
    overflow-x: hidden;
}

/* Fix for specific problematic elements */
.progress-bar,
.chart-container,
.stats-display {
    max-width: 100%;
    overflow: hidden;
}

/* Responsive utilities */
.d-mobile-none {
    display: block;
}

.d-desktop-none {
    display: none;
}

@media (max-width: 768px) {
    .d-mobile-none {
        display: none !important;
    }
    
    .d-desktop-none {
        display: block !important;
    }
}

/* Safe area for mobile devices with notches */
@supports (padding: env(safe-area-inset-left)) {
    .safe-area-padding {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Performance optimizations */
.scroll-smooth {
    scroll-behavior: smooth;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}