/* Mobile-specific styles for responses page */
@media only screen and (max-width: 767px) {

    /* Prevent scrolling past the top edge */
    html, body {
        overflow-x: hidden;
        position: relative;
        height: 100%;
    }

    body {
        background-image: url('./images/mobile-background.png') !important;
        background-size: cover !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
        background-attachment: fixed !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Position the burger menu properly */
    .mobile-burger-menu {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1000;
    }

    #floating-wall {
        background: transparent;
        height: 65vh;
    }

    /* Make the layout vertical on mobile */
    .responses-main-layout {
        flex-direction: column !important;
        padding: 10px !important;
    }

    /* Adjust sticky notes for mobile - make smaller and simpler */
    .sticky-note {
        width: 70vw !important;
        /* Smaller width for mobile */
        max-width: 250px !important;
        /* Smaller max-width */
        min-height: 90px !important;
        /* Smaller min-height */
        padding: 10px 12px !important;
        /* Reduce padding */
        font-size: 1rem !important;
        /* Smaller font */
        border-width: 2.5px !important;
        /* Thinner border */
        border-radius: 12px !important;
        /* Smaller radius */

        /* Simplified box shadow for better performance */
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;

        /* Remove complex filters for better performance */
        filter: none !important;

        /* Optimize rendering */
        transform: translateZ(0);
        will-change: transform, left, top;

        /* Reduce CSS bloat by overriding complex styles */
        transition: box-shadow 0.2s, z-index 0.2s !important;
    }

    /* Simpler hover effect for mobile */
    .sticky-note:hover, .sticky-note.is-hovered {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2) !important;
    }

    /* Make note numbers smaller */
    .note-number {
        font-size: 2rem !important;
        margin-bottom: 6px !important;
    }

    .note-number-circle {
        width: 1.7em !important;
        height: 1.4em !important;
        border-width: 2px !important;
    }

    /* Make text more compact */
    .sticky-note>div {
        min-height: 1.2em !important;
        line-height: 1.2 !important;
    }

    /* Adjust Arabic text for mobile */
    .sticky-note:lang(ar),
    .sticky-note *:lang(ar),
    .sticky-note>div:has(:lang(ar)),
    .sticky-note>div:has(span:lang(ar)),
    [dir="rtl"] .sticky-note,
    [dir="rtl"] .sticky-note>div {
        font-size: 0.75rem !important;
        line-height: 2.2 !important;
    }

    /* Simplified animation for newly submitted notes */
    .sticky-note.newly-submitted {
        animation: new-note-appear-mobile 1s ease !important;
    }

    @keyframes new-note-appear-mobile {
        0% {
            opacity: 0;
            transform: scale(0.9);
        }

        100% {
            opacity: 1;
            transform: scale(1);
        }
    }

    /* Simplified highlight animation */
    .sticky-note.featured {
        animation: highlight-mobile 0.8s ease !important;
    }

    @keyframes highlight-mobile {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.03);
        }

        100% {
            transform: scale(1);
        }
    }

    /* Hide navigation and submit section on mobile */
    #nav-heading,
    #submit-section,
    .right-panel {
        display: none !important;
    }

    /* Title styling for mobile only - more specific to avoid affecting desktop */
    /* Only apply to title-section-mobile class on mobile */
    .title-section-mobile {
        padding-top: 240px !important;
        /* Increased from 220px to 240px */
        padding-bottom: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 20px !important;
        position: relative !important;
    }

    /* Make the selector more specific to avoid affecting desktop */
    @media only screen and (max-width: 767px) {

        /* Strongest selector to target just the title container on mobile */
        div[style*="width:100%;padding:120px 0 0;margin-bottom:20px;text-align:center;position:relative;"] {
            padding-top: 240px !important;
            /* Increased from 220px to 240px */
            padding-bottom: 0 !important;
            margin-top: 0 !important;
        }
    }

    /* Make the selector even more specific to really force the issue */
    body.mobile-view .title-section-mobile {
        padding-top: 240px !important;
        /* Increased from 220px to 240px */
    }

    /* Title text */
    .title-section-mobile h1 {
        font-size: 2.2rem !important;
        margin-top: 0 !important;
    }

    /* Title background image */
    .title-section-mobile img[src="./images/your_stories-new.png"] {
        width: 280px !important;
    }

    /* Description container */
    .title-section-mobile [style*="width:100%;margin:-25px"] {
        margin-top: 5px !important;
        margin-bottom: 25px !important;
    }

    /* Description image */
    .title-section-mobile img[src="./images/below_yourstories.png"],
    .title-section-mobile img[src="./images/mobile_responses_desc.png"] {
        max-width: 100% !important;
        height: auto !important;
        margin: -30px auto 35px !important;
        display: block !important;
    }

    /* Adjust the wall container */
    #sticky-wall-container {
        min-width: 100% !important;
        padding: 0 !important;
        margin-top: 10px !important;
    }
}

/* This targets mobile only with the .mobile-view class that gets added via JavaScript */
body.mobile-view {
    background-image: url('./images/mobile-background.png') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
}

/* Extracted inline styles for reuse */
@media only screen {

    /* Title section container */
    .title-section {
        width: 100%;
        padding: 120px 0 0;
        margin-bottom: 20px;
        text-align: center;
        position: relative;
    }

    /* Title inner container */
    .title-inner {
        position: relative;
        display: inline-block;
        margin: 0 auto;
    }

    /* Title background image */
    .title-bg-img {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 300px;
        max-width: 100%;
        z-index: 0;
    }

    /* Title text */
    .title-text {
        margin: 0;
        padding: 5px 40px;
        font-family: 'Swanky and Moo Moo', cursive;
        font-size: 44.8px;
        color: #111111;
        font-weight: bold;
        position: relative;
        z-index: 1;
    }

    /* Description container */
    .desc-container {
        width: 100%;
        margin: -25px auto 0;
        padding: 0;
    }

    /* Description image */
    .desc-img {
        max-width: 60%;
        height: auto;
        margin: 0 auto;
        display: block;
    }
}