/* ============================================
   MOBILE NAVIGATION STYLES
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    transition: all 0.3s ease;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: center;
}

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

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

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

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 80%;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 80px 30px 30px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.mobile-nav-overlay.active .mobile-nav {
    transform: translateX(0);
}

.mobile-nav-link {
    display: block;
    padding: 15px 0;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    position: relative;
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

.mobile-nav-link:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    color: var(--primary);
    padding-left: 15px;
}

.mobile-nav-link:hover:before {
    width: 8px;
}

/* Show mobile menu on tablets and phones */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
    }

    .back-link {
        display: none !important;
        /* Hide back links on mobile, use menu instead */
    }
}


/* ============================================
   ENHANCED MOBILE RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {

    /* Header Adjustments */
    header {
        padding: 1rem 4%;
    }

    .logo {
        font-size: 1.5rem;
    }

    /* Hero Section */
    .hero {
        padding: 120px 4% 60px;
    }

    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

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

    /* Simplify hero mesh on tablets */
    .msp-mesh {
        width: 350px;
        height: 350px;
    }

    .msp-node {
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    .n-center {
        width: 100px;
        height: 100px;
    }

    /* Sections */
    .section {
        padding: 60px 4%;
    }

    .tech-showcase {
        padding: 80px 4%;
    }

    /* Feature Rows */
    .feature-row {
        margin-bottom: 60px;
    }

    /* Data to Insights - Stack vertically on tablet */
    .data-decision-flow {
        flex-direction: column;
        gap: 30px;
        padding: 30px 10px;
    }

    .dd-group {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .dd-arrow-container {
        transform: rotate(90deg);
    }

    .dd-core-container {
        margin: 20px 0;
    }

    /* Queue Visual - Responsive adjustments */
    .queue-visual-tree {
        padding: 20px;
    }

    .queue-branches {
        flex-direction: row;
        gap: 8px;
    }

    .q-branch {
        margin-bottom: 15px;
    }

    /* BSP Toolkit - Stack on tablet */
    .bsp-tool-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Vision Section */
    .vision-section {
        padding: 80px 4%;
    }

    .vision-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    /* Forms */
    .form-container {
        padding: 30px 20px;
        margin: 40px 4%;
    }

    .demo-card {
        padding: 30px 20px;
    }

    /* Footer Fix */
    .footer-grid {
        display: flex;
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }

    .footer-col {
        align-items: center;
    }

    .footer-col h4 {
        justify-content: center;
    }

    /* Unifying Operations Animation Fix */
    .data-flow-pipeline {
        flex-direction: column;
        height: auto;
        padding: 40px 10px;
        gap: 20px;
        overflow: visible;
        transform: scale(1);
    }

    .flow-connector {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    /* Ensure the FontAwesome arrow icon itself rotates and is transformable */
    .flow-connector i {
        display: inline-block !important;
        transform: rotate(90deg) !important;
        transition: transform 0.25s ease !important;
    }

    .flow-stage {
        width: 100%;
        margin: 0;
    }

    .neural-engine {
        transform: scale(0.9);
    }

    .insight-items {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .source-items {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Just hide particles on mobile to reduce noise/complexity */
    .flow-particles,
    .mm-data-particle {
        display: none !important;
    }
}

/* ============================================
   MOBILE PHONES (Small Screens)
   ============================================ */

@media (max-width: 480px) {

    /* Header */
    header {
        padding: 0.8rem 3%;
    }

    .logo {
        font-size: 1.2rem;
    }

    .logo i {
        font-size: 1.1rem;
    }

    /* Hero Section - Mobile Optimized */
    .hero {
        padding: 100px 3% 50px;
    }

    .hero h1 {
        font-size: 1.6rem;
        line-height: 1.25;
        margin-bottom: 15px;
    }

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

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

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

    /* Simplify mesh animation but make it MORE VIBRANT on mobile */
    .msp-mesh {
        width: 280px;
        /* Increased from 250px */
        height: 280px;
        margin-top: 20px;
    }

    .msp-node {
        padding: 10px 14px;
        /* Increased from 8px 12px */
        font-size: 0.75rem;
        /* Slightly larger */
        gap: 6px;
        box-shadow: 0 6px 20px rgba(25, 118, 210, 0.25) !important;
        /* Stronger shadow */
        animation: float-mobile 4s ease-in-out infinite !important;
        /* Faster, more visible */
    }

    /* More vibrant float animation for mobile */
    @keyframes float-mobile {

        0%,
        100% {
            transform: translateY(0) scale(1);
        }

        50% {
            transform: translateY(-15px) scale(1.05);
            /* More movement */
        }
    }

    .msp-node i {
        font-size: 1.1rem;
        /* Larger icons */
    }

    /* More vibrant center node */
    .n-center {
        width: 90px !important;
        /* Increased */
        height: 90px !important;
        border-width: 4px !important;
        /* Thicker border */
        box-shadow:
            0 0 30px rgba(25, 118, 210, 0.6),
            /* Stronger outer glow */
            0 0 60px rgba(25, 118, 210, 0.4),
            0 8px 25px rgba(0, 0, 0, 0.15) !important;
        /* Depth shadow */
        animation: pulse-center-mobile 2s ease-in-out infinite !important;
    }

    /* Vibrant pulse animation */
    @keyframes pulse-center-mobile {

        0%,
        100% {
            transform: scale(1);
            box-shadow:
                0 0 30px rgba(25, 118, 210, 0.6),
                0 0 60px rgba(25, 118, 210, 0.4),
                0 8px 25px rgba(0, 0, 0, 0.15);
        }

        50% {
            transform: scale(1.08);
            box-shadow:
                0 0 40px rgba(25, 118, 210, 0.8),
                0 0 80px rgba(25, 118, 210, 0.5),
                0 12px 35px rgba(0, 0, 0, 0.2);
        }
    }

    .n-center i {
        font-size: 1.8rem !important;
        /* Larger brain icon */
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    }

    .n-center span {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
    }

    /* Show connectors on mobile with simplified styling */
    .connector {
        display: block !important;
        /* Show instead of hide */
        width: 2px !important;
        /* Thinner line for mobile */
        height: 120px !important;
        /* Shorter for mobile */
        background: linear-gradient(to bottom,
                rgba(25, 118, 210, 0.4),
                rgba(25, 118, 210, 0)) !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform-origin: top !important;
        animation: rotate-connector 15s linear infinite !important;
        /* Slower for mobile */
    }

    /* Ensure node text is strictly visible */
    .msp-node {
        color: #333 !important;
        /* Force dark text */
        z-index: 20 !important;
        /* Ensure above everything */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    /* AI Packets on mobile - smaller and visible */
    .ai-packet {
        width: 8px !important;
        /* Smaller for mobile */
        height: 8px !important;
        background: var(--primary) !important;
        border-radius: 50% !important;
        position: absolute !important;
        bottom: 0 !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        animation: packet-pulse 1.5s ease-in-out infinite !important;
        box-shadow: 0 0 10px rgba(25, 118, 210, 0.6) !important;
    }

    /* Packet pulse animation for mobile */
    @keyframes packet-pulse {

        0%,
        100% {
            opacity: 0.6;
            transform: translateX(-50%) scale(1);
        }

        50% {
            opacity: 1;
            transform: translateX(-50%) scale(1.3);
        }
    }

    /* Fix SOAP Notes Grid on Mobile to be 4 smaller boxes */
    .consultation-stage[data-stage="3"]>div:nth-of-type(2) {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
    }

    .soap-item {
        padding: 6px !important;
        min-height: auto !important;
        border-radius: 6px !important;
    }

    .soap-item strong {
        font-size: 0.7rem !important;
        display: block !important;
        margin-bottom: 2px !important;
    }

    .soap-item p {
        font-size: 0.6rem !important;
        line-height: 1.1 !important;
        margin: 0 !important;
    }

    /* Ensure node text is strictly visible, readable, and aligned */
    .msp-node {
        color: #000 !important;
        font-weight: 700 !important;
        z-index: 999 !important;
        opacity: 1 !important;

        /* ALIGNMENT FIXES */
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;

        /* Sizing Fixes */
        width: auto !important;
        height: auto !important;
        min-width: 80px !important;
        /* Minimum width for consistency */
        padding: 8px 14px !important;
        /* Balanced padding */

        white-space: nowrap !important;
        overflow: visible !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        border-radius: 50px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        border-radius: 50px !important;
        /* Pill shape checks text overflows better */
    }

    /* Restore Center Node to Round & Column */
    .msp-node.n-center {
        width: 90px !important;
        height: 90px !important;
        border-radius: 50% !important;
        flex-direction: column !important;
        padding: 0 !important;
        justify-content: center !important;
    }

    /* Ensure children inherit color */
    .msp-node * {
        color: inherit !important;
        opacity: 1 !important;
    }

    /* Except icon which should be primary color usually, but let's keep it visible */
    .msp-node i {
        color: var(--primary) !important;
        margin-right: 5px !important;
    }

    /* Fix n5 (Connectivity) positioning to prevent cutoff on mobile */
    .msp-node.n5 {
        left: 88% !important;
        transform: translate(-17%, 26%) !important;
    }

    .msp-node.n4 {
        left: 88% !important;
        transform: translate(-145%, 2%) !important;
    }

    .msp-node.n3 {
        left: 88% !important;
        transform: translate(-340%, -125%) !important;
    }

    .msp-node.n1 {
        left: 88% !important;
        transform: translate(-300%, -160%) !important;
    }
}

.n-center i {
    font-size: 1.6rem !important;
}

/* Slow down and enhance float animation for better mobile visibility */
.msp-node {
    animation-duration: 10s !important;
}

/* Sections */
.section {
    padding: 50px 3%;
}

.section-title {
    font-size: 1.6rem !important;
    margin-bottom: 15px;
}

.section-subtitle {
    font-size: 0.9rem !important;
    margin-bottom: 40px;
}

.tech-showcase {
    padding: 50px 3%;
}

/* Cards */
.card {
    padding: 25px 20px;
}

.card h3 {
    font-size: 1.1rem;
}

.card p {
    font-size: 0.9rem;
}

.icon-box {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

/* Feature Rows */
.feature-row,
.feature-row.reverse {
    margin-bottom: 50px;
    gap: 30px;
}

.feature-text h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.feature-text p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Data to Insights - Mobile optimized */
.data-decision-flow {
    gap: 20px;
    padding: 20px 5px;
}

.dd-icon-box {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.dd-icon-box i {
    font-size: 0.9rem;
}

.dd-core {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

.dd-core-container p {
    font-size: 0.85rem;
}

.dd-core-container small {
    font-size: 0.7rem;
}

.dd-arrow {
    font-size: 1.2rem;
}

/* Queue Management */
.queue-visual-tree {
    padding: 15px;
}

.q-node-header {
    font-size: 0.65rem;
    padding: 3px 10px;
}

.q-track-main {
    gap: 8px;
}

.q-dot {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
}

.q-branch {
    padding: 12px;
}

.branch-label {
    font-size: 0.7rem;
}

.branch-desc {
    font-size: 0.65rem;
}

/* Queue branch mobile improvements */
.queue-branches {
    flex-direction: row;
    gap: 8px;
}

.branch-visual {
    height: 45px;
}

.visual-token {
    width: 26px;
    height: 26px;
    font-size: 0.65rem;
}

.wait-time-badge-tree {
    font-size: 0.55rem;
    padding: 2px 5px;
}

/* Consultation Animation */
.consultation-animation-container {
    min-height: 250px;
    padding: 20px 15px;
}

.consultation-animation-container button {
    padding: 10px 22px;
    font-size: 0.9rem;
}

.soap-item {
    padding: 8px;
}

.soap-item strong {
    font-size: 0.8rem;
}

.soap-item p {
    font-size: 0.7rem;
}

/* Ensure consultation stage elements are properly sized */
.consultation-stage>div {
    width: 100%;
    max-width: 100%;
}

.consultation-stage button {
    max-width: 90%;
    white-space: nowrap;
}

.consultation-stage .recording-indicator {
    font-size: 0.8rem;
    padding: 8px 15px;
}

/* Triage Animation */
.calendar-ai {
    height: 320px;
    padding: 15px;
}

/* BSP Toolkit */
.bsp-tool-grid {
    gap: 15px;
}

/* Vision Section */
.vision-section {
    padding: 60px 3%;
}

.vision-header h2 {
    font-size: 1.6rem;
}

.vision-header p {
    font-size: 0.95rem;
}

.vision-eyebrow {
    font-size: 0.75rem;
    padding: 6px 15px;
}

.vision-card {
    padding: 30px 20px;
}

.vision-icon-wrap {
    width: 65px;
    height: 65px;
    margin-bottom: 20px;
}

.vision-icon-wrap i {
    font-size: 1.6rem;
}

.vision-card h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.vision-card p {
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Forms - Mobile Optimized */
.form-container {
    padding: 25px 15px;
    margin: 30px 3%;
}

.form-container h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.demo-card {
    padding: 25px 15px;
}

.demo-card h2 {
    font-size: 1.5rem;
}

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

label {
    font-size: 0.9rem;
    margin-bottom: 6px;
}

input,
select,
textarea {
    padding: 14px 12px;
    /* Increased for touch-friendly sizing */
    font-size: 16px;
    /* Prevent zoom on iOS */
    min-height: 44px;
    /* Touch-friendly minimum */
}

button[type="submit"] {
    padding: 16px;
    font-size: 1rem;
    min-height: 50px;
    /* Touch-friendly */
}

/* Footer */
footer {
    padding: 50px 3%;
}

.footer-grid {
    gap: 30px;
    text-align: center;
}

.footer-col h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.footer-col a {
    font-size: 0.9rem;
}




/* ============================================
   LANDSCAPE MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 896px) and (max-height: 480px) and (orientation: landscape) {

    .hero {
        padding: 100px 5% 40px;
    }

    .hero-text {
        margin-bottom: 30px;
    }

    .msp-mesh {
        width: 200px;
        height: 200px;
    }

    .section {
        padding: 40px 5%;
    }
}

/* ============================================
   TOUCH-FRIENDLY IMPROVEMENTS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* This targets touch devices */

    /* Increase tap targets */
    .btn {
        min-height: 44px;
        padding: 14px 30px;
    }

    .nav-links a {
        padding: 10px 15px;
    }

    /* Disable hover effects on touch devices */
    .card:hover {
        transform: none;
    }

    /* Simplify animations for better touch performance */
    * {
        animation-duration: 5s !important;
    }
}

/* ============================================
   SLOWER MOBILE ANIMATIONS FOR BETTER VIEWING
   ============================================ */

/* Apply slower animations on mobile devices for better user experience */
@media (max-width: 768px) {

    /* Slow down menu transitions slightly */
    .mobile-nav-overlay,
    .mobile-nav {
        transition-duration: 0.4s;
    }

    .mobile-menu-toggle span,
    .mobile-nav-link {
        transition-duration: 0.4s;
    }
}

@media (max-width: 480px) {

    /* Hero mesh animations - Slower float */
    .msp-node {
        animation-duration: 9s !important;
        /* Was 6s, now 1.5x slower */
    }

    /* Fade-in entrance animations */
    .fade-in-entrance {
        animation-duration: 1.5s !important;
        /* Was 1s */
    }

    /* Consultation stage animation */
    .consultation-stage {
        transition-duration: 0.8s !important;
        /* Was 0.6s */
    }

    /* SOAP item build animation */
    .soap-item {
        animation-duration: 0.8s !important;
        /* Was 0.5s */
    }

    /* Data to Insights Flow - Slower transitions */
    .d1,
    .d2,
    .d3 {
        animation-duration: 12s !important;
        /* Was 8s, now 1.5x slower */
    }

    .o1,
    .o2,
    .o3 {
        animation-duration: 12s !important;
        /* Was 8s, now 1.5x slower */
    }

    .dd-core {
        animation-duration: 3s !important;
        /* Was 2s, now 1.5x slower */
    }

    /* Queue/Triage animations - Much slower for comprehension */
    .triage-step {
        animation-duration: 16s !important;
        /* Was 12s, now ~1.33x slower */
    }

    .step-1 {
        animation: show-step-1 16s infinite !important;
    }

    .step-2 {
        animation: show-step-2 16s infinite !important;
    }

    .step-3 {
        animation: show-step-3 16s infinite !important;
    }

    /* Queue branch animations */
    .visual-token {
        animation-duration: 6s !important;
        /* Was 4s, now 1.5x slower */
    }

    .emergency-token {
        animation-duration: 6s !important;
    }

    /* Pulse and shimmer effects - Slightly slower */
    .live-pulse {
        animation-duration: 2.2s !important;
        /* Was 1.5s */
    }

    .pulse-dot {
        animation-duration: 2.2s !important;
    }

    .recording-dot {
        animation-duration: 2.2s !important;
    }

    /* Vision card entrance */
    .vision-card {
        animation-duration: 0.9s !important;
        /* Was 0.6s, now 1.5x slower */
    }

    /* Card hover/transform effects - Gentler */
    .card,
    .vision-card,
    .bsp-tool-card {
        transition-duration: 0.5s !important;
        /* Was ~0.3s, slower hover */
    }

    /* Fade-up scroll animations */
    .fade-up {
        transition-duration: 0.9s !important;
        /* Was 0.6s */
    }

    /* AI brain pulse */
    .dd-pulse,
    .pulseBrain,
    .pulse-brain {
        animation-duration: 3s !important;
        /* Was 2s, now 1.5x slower */
    }

    /* Model/AI processing animations */
    .model-core,
    .ai-scanner {
        animation-duration: 1.5s !important;
        /* Slower spin */
    }

    /* Reduce overall animation intensity for smoother performance */
    * {
        animation-timing-function: ease-in-out !important;
    }
}

/* Extra slow for very small devices or low-end phones */
@media (max-width: 375px) {

    /* Further slow down complex animations */
    .d1,
    .d2,
    .d3,
    .o1,
    .o2,
    .o3 {
        animation-duration: 14s !important;
        /* Even slower for small screens */
    }

    .triage-step,
    .step-1,
    .step-2,
    .step-3 {
        animation-duration: 18s !important;
        /* Slower triage cycle */
    }

    /* Mesh nodes */
    .msp-node {
        animation-duration: 10s !important;
        /* Very slow float */
    }
}

/* Print styles */
@media print {

    .mobile-menu-toggle,
    .mobile-nav-overlay,
    .msp-mesh,
    .data-decision-flow,
    .queue-visual-tree {
        display: none;
    }

    header {
        position: static;
    }

    body {
        background: white;
    }

    /* SOAP Notes scrollable on mobile only */
    .consultation-stage[data-stage="3"] {
        overflow-y: auto;
        max-height: 420px;
        /* Match container height */
    }

    /* Optimize Vision Section for Mobile */
    .vision-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 10px !important;
    }

    .vision-card {
        padding: 25px 20px !important;
        /* Smaller padding */
        border-radius: 16px !important;
    }

    .vision-icon-wrap {
        width: 60px !important;
        /* Smaller icon circle */
        height: 60px !important;
        margin-bottom: 15px !important;
    }

    .vision-icon-wrap i {
        font-size: 1.5rem !important;
        /* Smaller icon */
    }

    .vision-card h3 {
        font-size: 1.25rem !important;
        /* Smaller title */
        margin-bottom: 10px !important;
    }

    .vision-card p {
        font-size: 0.9rem !important;
        /* Smaller text */
        line-height: 1.6 !important;
    }

    /* AI Tagline Section Mobile */
    .ai-tagline-section {
        padding: 30px 0 !important;
    }

    .ai-tagline-text {
        font-size: 1rem !important;
        /* Smaller text on mobile */
        padding: 0 10px !important;
    }
}

/* Mobile-only fixes for Queue Management and Consultation sections */
@media (max-width: 768px) {

    .feature-row.queue-row,
    .feature-row.consultation-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 18px !important;
        margin: 40px 4% !important;
    }

    .feature-row.queue-row .feature-text,
    .feature-row.consultation-row .feature-text,
    .feature-row.queue-row .feature-visual,
    .feature-row.consultation-row .feature-visual {
        width: 100% !important;
        max-width: none !important;
    }

    /* Ensure visual boxes center nicely and appear after text on mobile */
    .feature-row.queue-row .feature-text,
    .feature-row.consultation-row .feature-text {
        order: 1;
    }

    .feature-row.queue-row .feature-visual,
    .feature-row.consultation-row .feature-visual {
        order: 2;
        display: flex;
        justify-content: center;
    }

    /* Tidy up large internal white cards inside visuals */
    .feature-row .feature-visual>div {
        width: 100% !important;
        box-sizing: border-box;
    }
}

/* Strong mobile overrides to ensure SOAP notes render as a 2x2 grid and are scroll-friendly
   Only affect the active SOAP stage on small screens to avoid changing desktop animations. */
@media (max-width: 768px) {
    .consultation-stage.active[data-stage="3"] {
        position: static !important;
        inset: auto !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        overflow-y: auto !important;
        max-height: 420px !important;
        padding-top: 10px !important;
    }

    .consultation-stage.active[data-stage="3"]>div:nth-of-type(2) {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .consultation-stage.active[data-stage="3"] .soap-item {
        padding: 10px !important;
        min-height: auto !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }

    /* Slightly reduce animation delay on small screens for snappier feel */
    .consultation-stage.active[data-stage="3"] .soap-item:nth-child(1) {
        animation-delay: 0.12s !important;
    }

    .consultation-stage.active[data-stage="3"] .soap-item:nth-child(2) {
        animation-delay: 0.24s !important;
    }

    .consultation-stage.active[data-stage="3"] .soap-item:nth-child(3) {
        animation-delay: 0.36s !important;
    }

    .consultation-stage.active[data-stage="3"] .soap-item:nth-child(4) {
        animation-delay: 0.48s !important;
    }
}