/* ============================================
   MOBILE RESPONSIVE IMPROVEMENTS
   ============================================ */

/* Mobile-first approach: improve responsiveness for small screens */

/* Hide desktop navigation on mobile, show hamburger menu only */
@media (max-width: 768px) {
    /* Hide the desktop navigation items completely */
    .nav-center,
    .nav-actions .github-link,
    .nav-actions .nav-cta {
        display: none !important;
    }

    /* Show mobile menu button */
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* Ensure mobile menu is properly positioned */
    .mobile-menu {
        width: 100%;
    }
}

/* Base typography adjustments for mobile */
@media (max-width: 768px) {
    /* Hero section */
    .hero-title {
        font-size: 32px !important;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 18px !important;
    }

    .hero-description {
        font-size: 16px !important;
        padding: 0 var(--spacing-sm);
    }

    .hero-card {
        padding: var(--spacing-md) !important;
        margin: var(--spacing-sm);
        max-width: calc(100% - var(--spacing-md));
        box-sizing: border-box;
    }

    /* Fix glassmorphism cards on mobile */
    .glass-ultra,
    .glass-strong,
    .glass-medium,
    .glass-light {
        max-width: 100%;
        box-sizing: border-box;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        padding: 0 var(--spacing-sm);
    }

    .hero-actions .cta-button {
        width: 100%;
        text-align: center;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    /* Section cards and containers */
    .section-card {
        padding: var(--spacing-md) var(--spacing-sm) !important;
        margin: var(--spacing-sm) 0;
    }

    /* Headings */
    h1 {
        font-size: 32px !important;
    }

    h2 {
        font-size: 26px !important;
    }

    h3 {
        font-size: 22px !important;
    }

    h4 {
        font-size: 18px !important;
    }

    /* Grids - stack on mobile */
    .icon-grid,
    .feature-grid,
    .pricing-grid,
    .industry-grid,
    .stats-grid,
    .metric-grid {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-sm) !important;
    }

    /* Pricing cards - fix cut-off issue on mobile */
    .pricing-card {
        margin-bottom: var(--spacing-md);
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100% !important;
    }

    .pricing-grid {
        padding: 0 var(--spacing-sm);
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Feature cards */
    .feature-card,
    .icon-card {
        padding: var(--spacing-md);
    }

    /* Button groups - stack vertically */
    .button-group {
        flex-direction: column;
        gap: var(--spacing-sm);
        width: 100%;
    }

    .button-group .cta-button {
        width: 100%;
        text-align: center;
    }

    /* Accordion */
    .accordion-header {
        font-size: 16px !important;
        padding: var(--spacing-sm) !important;
    }

    .accordion-content {
        padding: var(--spacing-sm) !important;
        font-size: 15px;
    }

    /* Timeline */
    .timeline-item {
        padding-left: 0 !important;
    }

    .timeline-content {
        padding: var(--spacing-sm) !important;
    }

    /* Stats and metrics */
    .stat-card,
    .metric-card {
        padding: var(--spacing-md);
    }

    .stat-number,
    .metric-value {
        font-size: 32px !important;
    }

    /* Message cards */
    .message-card {
        padding: var(--spacing-md);
        margin: var(--spacing-md) 0;
    }

    /* CTA section */
    .cta-section {
        padding: var(--spacing-md);
    }

    /* Footer CTA */
    .footer-cta {
        padding: var(--spacing-md);
        text-align: center;
    }

    /* Pricing comparison */
    .pricing-comparison {
        padding: var(--spacing-md);
    }

    .pricing-comparison ul {
        padding-left: var(--spacing-md);
    }
}

/* Smaller mobile devices (< 480px) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 28px !important;
    }

    .hero-subtitle {
        font-size: 16px !important;
    }

    .hero-description {
        font-size: 14px !important;
    }

    h1 {
        font-size: 28px !important;
    }

    h2 {
        font-size: 24px !important;
    }

    h3 {
        font-size: 20px !important;
    }

    .logo {
        width: 48px !important;
        height: 48px !important;
    }

    .brand-name {
        font-size: 24px !important;
    }

    /* Reduce padding on very small screens */
    .section-card,
    .feature-card,
    .pricing-card,
    .message-card {
        padding: var(--spacing-sm) !important;
    }

    /* Stat numbers smaller on tiny screens */
    .stat-number,
    .metric-value {
        font-size: 28px !important;
    }
}

/* Tablet landscape (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .pricing-grid,
    .industry-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

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

    .hero-subtitle {
        font-size: 20px;
    }
}

/* Improve touch targets for mobile */
@media (max-width: 768px) {
    .cta-button,
    .nav-link,
    .mobile-nav-link,
    .accordion-header {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Edition badges */
    .edition-badge {
        font-size: 12px;
        padding: 4px 12px;
    }
}

/* Fix horizontal overflow on mobile */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        width: 100%;
    }

    .container,
    .content-wrapper,
    .markdown-content {
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Ensure all cards and sections stay within bounds */
    .section-card,
    .feature-card,
    .message-card,
    .contact-card,
    .icon-card,
    .stat-card,
    .metric-card,
    .timeline-item,
    .accordion-item {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Ensure code blocks don't overflow */
    pre,
    code {
        max-width: 100%;
        overflow-x: auto;
        word-wrap: break-word;
    }

    pre code {
        white-space: pre-wrap;
    }
}

/* Improve spacing for mobile */
@media (max-width: 768px) {
    main {
        padding-top: 85px;
    }

    .content-wrapper {
        padding: var(--spacing-sm);
    }

    /* Reduce spacing between sections */
    section {
        margin-bottom: var(--spacing-lg);
    }

    hr {
        margin: var(--spacing-lg) 0;
    }
}

/* Floating elements - hide or reduce on mobile */
@media (max-width: 768px) {
    .floating-bee,
    .floating-hexagon {
        display: none;
    }

    .hexagon-grid {
        opacity: 0.3;
    }
}

/* Newsletter modal - full screen on mobile */
@media (max-width: 768px) {
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 5% auto;
        padding: var(--spacing-md);
    }

    .newsletter-form input,
    .newsletter-form button {
        width: 100%;
    }
}

/* Screenshot gallery (when uncommented) */
@media (max-width: 768px) {
    .screenshot-gallery {
        grid-template-columns: 1fr !important;
    }

    .screenshot-item {
        max-width: 100%;
    }
}

/* Improve list readability on mobile */
@media (max-width: 768px) {
    .feature-list,
    .markdown-content ul,
    .markdown-content ol {
        padding-left: var(--spacing-md);
    }

    .feature-list li,
    .markdown-content li {
        margin-bottom: var(--spacing-xs);
        font-size: 15px;
        line-height: 1.6;
    }
}

/* Support tier info - better mobile layout */
@media (max-width: 768px) {
    .support-tier {
        margin-top: var(--spacing-sm);
    }

    .support-tier ul {
        padding-left: var(--spacing-md);
    }
}

/* Who's it for section in pricing */
@media (max-width: 768px) {
    .who-for {
        font-size: 14px;
    }
}

/* Improve checkbox groups on mobile */
@media (max-width: 768px) {
    .checkbox-group label {
        font-size: 14px;
        padding: var(--spacing-xs) 0;
    }
}

/* Form improvements for mobile */
@media (max-width: 768px) {
    .contact-card input,
    .contact-card select,
    .contact-card textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* Table scroll wrapper for mobile horizontal scrolling */
.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.mobile-scroll-hint {
    display: none;
    text-align: center;
    font-size: 11px;
    color: var(--sting-yellow);
    padding: 8px 0;
    font-weight: 600;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Table improvements for mobile - enable horizontal scroll */
@media (max-width: 768px) {
    .table-scroll-wrapper {
        overflow-x: scroll !important;
        -webkit-overflow-scrolling: touch;
        margin: 0 calc(-1 * var(--spacing-sm)); /* Extend to edge of card */
        padding: 0 var(--spacing-sm);
    }
    
    .mobile-scroll-hint {
        display: block !important;
    }
    
    /* Requirements table - set minimum width to force scrolling */
    .requirements-section table {
        display: table !important;
        width: 100% !important;
        min-width: 500px !important; /* Force horizontal scroll on narrow screens */
        font-size: 12px !important;
        table-layout: auto !important;
    }
    
    .requirements-section thead,
    .requirements-section tbody {
        display: table-row-group !important;
    }
    
    .requirements-section tr {
        display: table-row !important;
    }
    
    .requirements-section th,
    .requirements-section td {
        display: table-cell !important;
        padding: 8px 6px !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        white-space: normal !important;
        vertical-align: top !important;
    }
    
    .requirements-section th {
        font-size: 11px !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
    }
    
    /* Let columns auto-size naturally */
    .requirements-section th:first-child,
    .requirements-section td:first-child {
        font-weight: 700 !important;
        white-space: nowrap !important;
    }
    
    /* Other tables keep standard mobile table layout */
    .markdown-content table:not(.requirements-section table) {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Direct contact info - stack on mobile */
@media (max-width: 768px) {
    .direct-contact {
        grid-template-columns: 1fr !important;
    }
}
