/* ================================================================
   MOBILE-ONLY STYLES FOR QUESTS PAGE (< 768px)
   Forum-style quest board optimized for mobile
   ================================================================ */

@media (max-width: 768px) {
    /* ===== HEADER COMPACT ===== */
    header {
        padding: 0 !important;
        min-height: 48px;
    }

    header .container {
        padding-top: 0.25rem !important;
        padding-bottom: 0.25rem !important;
    }

    header h1 {
        font-size: 0.95rem !important;
    }

    header .w-10.h-10 {
        width: 1.6rem !important;
        height: 1.6rem !important;
    }

    header .w-10.h-10 i {
        font-size: 0.7rem !important;
    }

    /* ===== MAIN CONTENT SPACING ===== */
    main {
        padding: 0.5rem 0 !important;
    }

    section.mb-12 {
        margin-bottom: 0.5rem !important;
    }

    /* ===== LAYOUT: Stack sidebar + main ===== */
    .forum-layout {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    /* ===== SIDEBAR → CHANNEL CHIPS ===== */
    .forum-sidebar {
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0.4rem 0.75rem !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .forum-sidebar > div:first-child {
        display: none !important; /* Hide "Quest Channels" label */
    }

    .forum-channel {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        padding: 0.35rem 0.65rem !important;
        border-radius: 1.2rem !important;
        font-size: 0.7rem !important;
        font-weight: 500 !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        opacity: 0.8 !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        margin-bottom: 0 !important;
        transition: all 0.15s ease !important;
    }

    .forum-channel i {
        font-size: 0.6rem !important;
    }

    .forum-channel.active {
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2)) !important;
        border-color: rgba(139, 92, 246, 0.4) !important;
        color: #c4b5fd !important;
        opacity: 1 !important;
    }

    .forum-channel:active {
        transform: scale(0.95) !important;
    }

    /* Make channels container scrollable */
    .forum-sidebar {
        display: flex !important;
        overflow-x: auto !important;
        gap: 0.35rem !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.3rem !important;
    }

    .forum-sidebar::-webkit-scrollbar {
        display: none;
    }

    .forum-channel {
        scroll-snap-align: start !important;
    }

    /* ===== FORUM MAIN AREA ===== */
    .forum-main {
        padding: 0.5rem !important;
        border-radius: 0.75rem !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        min-height: auto !important;
    }

    /* ===== FORUM HEADER ===== */
    .forum-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0.75rem !important;
    }

    #forumHeaderTitle {
        margin-bottom: 0.25rem !important;
    }

    #forumHeaderTitle i {
        font-size: 1rem !important;
    }

    #forumHeaderTitle span {
        font-size: 1rem !important;
    }

    /* Header actions row */
    .forum-header .flex.items-center.gap-3 {
        flex-direction: column !important;
        gap: 0.4rem !important;
        width: 100% !important;
    }

    /* ===== SEARCH BAR ===== */
    .forum-search {
        width: 100% !important;
        padding: 0.6rem 1rem !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        min-height: 40px !important;
        border-radius: 0.6rem !important;
    }

    /* ===== NEW QUEST BUTTON ===== */
    .forum-new-btn {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 0.55rem 1rem !important;
        font-size: 0.8rem !important;
        border-radius: 0.6rem !important;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2)) !important;
        border: 1px solid rgba(139, 92, 246, 0.3) !important;
        color: #c4b5fd !important;
    }

    .forum-new-btn:active {
        transform: scale(0.97) !important;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(139, 92, 246, 0.35)) !important;
    }

    /* ===== FORUM THREADS ===== */
    .forum-thread {
        margin-bottom: 0.75rem !important;
        gap: 0 !important;
    }

    /* Avatar - compact */
    .forum-avatar {
        width: 2.25rem !important;
        height: 2.25rem !important;
        font-size: 0.9rem !important;
        border-width: 2px !important;
        margin-right: -0.5rem !important;
        border-radius: 50% !important;
    }

    /* Message card */
    .forum-message {
        padding: 0.6rem 0.75rem !important;
        border-radius: 0.75rem !important;
        background: rgba(35, 41, 70, 0.6) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
    }

    .forum-message:hover {
        background: rgba(45, 51, 80, 0.7) !important;
    }

    /* Meta info */
    .forum-message .forum-meta {
        font-size: 0.68rem !important;
        margin-bottom: 0.15rem !important;
    }

    .forum-message .forum-time {
        font-size: 0.6rem !important;
        margin-left: 0.4rem !important;
    }

    /* Title */
    .forum-message .forum-title {
        font-size: 0.85rem !important;
        margin-bottom: 0.25rem !important;
    }

    /* Content */
    .forum-message .forum-content {
        font-size: 0.75rem !important;
        line-height: 1.45 !important;
        margin-bottom: 0.4rem !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3 !important;
        line-clamp: 3 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    /* Reactions */
    .forum-message .forum-reactions {
        flex-wrap: wrap !important;
        gap: 0.35rem !important;
    }

    .forum-message .forum-reaction {
        padding: 0.2rem 0.55rem !important;
        font-size: 0.68rem !important;
        border-radius: 1rem !important;
        min-height: 28px !important;
    }

    .forum-message .forum-reaction i {
        font-size: 0.55rem !important;
    }

    .forum-message .forum-reaction:active {
        transform: scale(0.93) !important;
    }

    /* ===== NEW QUEST MODAL - BOTTOM SHEET ===== */
    #newQuestModal {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    #newQuestModal > div {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        height: auto !important;
        border-radius: 1.25rem 1.25rem 0 0 !important;
        padding: 1.25rem 1rem !important;
        margin: 0 !important;
        background: linear-gradient(180deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.99) 100%) !important;
        border-top: 1px solid rgba(139, 92, 246, 0.15) !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5) !important;
        transform: translateY(100%) !important;
        opacity: 0 !important;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #newQuestModal[style*="display: flex"] > div {
        transform: translateY(0) !important;
        opacity: 1 !important;
    }

    /* Modal backdrop */
    #newQuestModal {
        background-color: rgba(0, 0, 0, 0.6) !important;
    }

    /* Modal close button */
    #closeNewQuest {
        width: 2rem !important;
        height: 2rem !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.06) !important;
    }

    #closeNewQuest:active {
        background: rgba(239, 68, 68, 0.2) !important;
        color: #f87171 !important;
    }

    /* Modal title */
    #newQuestModal h2 {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0.75rem !important;
        border-bottom: 1px solid rgba(139, 92, 246, 0.1) !important;
    }

    /* Form inputs */
    #newQuestForm label {
        font-size: 0.75rem !important;
        color: rgba(248, 250, 252, 0.6) !important;
    }

    #newQuestForm input,
    #newQuestForm textarea {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 0.65rem 0.85rem !important;
        border-radius: 0.6rem !important;
        background: rgba(15, 23, 42, 0.6) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    #newQuestForm input:focus,
    #newQuestForm textarea:focus {
        border-color: rgba(139, 92, 246, 0.5) !important;
        box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15) !important;
    }

    /* Submit button */
    #newQuestForm .forum-new-btn {
        position: sticky !important;
        bottom: 0 !important;
        margin: 0 !important;
        padding: 0.75rem !important;
        font-size: 0.85rem !important;
        border-radius: 0.75rem !important;
        background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
        color: #fff !important;
        border: none !important;
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3) !important;
    }

    #newQuestForm .forum-new-btn:active {
        transform: scale(0.97) !important;
    }

    /* ===== FOOTER MOBILE ===== */
    footer .grid {
        display: block !important;
        text-align: center !important;
    }

    footer .grid > div {
        display: none !important;
    }

    footer .grid > div:first-child {
        display: block !important;
    }

    footer .border-t {
        padding-top: 0.75rem !important;
    }

    footer .border-t .text-sm {
        font-size: 0.6rem !important;
    }

    /* ===== EMPTY STATE ===== */
    #forumThreads .text-center {
        font-size: 0.8rem !important;
        padding: 1.5rem !important;
    }

    /* ===== LIGHT MODE ADJUSTMENTS ===== */
    body.light-mode .forum-channel {
        background: rgba(0, 0, 0, 0.04) !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        color: #475569 !important;
    }

    body.light-mode .forum-channel.active {
        background: rgba(59, 130, 246, 0.12) !important;
        border-color: rgba(59, 130, 246, 0.3) !important;
        color: #1d4ed8 !important;
    }

    body.light-mode .forum-message {
        background: rgba(226, 232, 240, 0.8) !important;
    }

    body.light-mode .forum-search {
        background: #e2e8f0 !important;
        color: #1e293b !important;
        border-color: #cbd5e1 !important;
    }

    body.light-mode #newQuestModal > div {
        background: linear-gradient(180deg, rgba(241, 245, 249, 0.98) 0%, rgba(226, 232, 240, 0.99) 100%) !important;
    }

    body.light-mode #newQuestForm input,
    body.light-mode #newQuestForm textarea {
        background: #f8fafc !important;
        border-color: #cbd5e1 !important;
        color: #1e293b !important;
    }
}

/* ===== EXTRA SMALL SCREENS (<=420px) ===== */
@media (max-width: 420px) {
    .forum-avatar {
        width: 1.85rem !important;
        height: 1.85rem !important;
        font-size: 0.75rem !important;
    }

    .forum-message {
        padding: 0.5rem 0.6rem !important;
    }

    .forum-message .forum-title {
        font-size: 0.78rem !important;
    }

    .forum-message .forum-content {
        font-size: 0.7rem !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
    }

    .forum-message .forum-reaction {
        padding: 0.15rem 0.45rem !important;
        font-size: 0.6rem !important;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-height: 500px) and (orientation: landscape) {
    #newQuestModal > div {
        max-height: 95vh !important;
    }
}

/* ===== FAB NAVIGATION ===== */
#fabNavContainer {
    display: flex !important;
    position: fixed !important;
    bottom: calc(env(safe-area-inset-bottom, 0.5rem) + 1.5rem) !important;
    left: calc(env(safe-area-inset-left, 0.5rem) + 1.5rem) !important;
    z-index: 999 !important;
}

#fabNavBtn {
    display: flex !important;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    min-height: 3rem;
    border-radius: 1.5rem;
    background: rgba(16, 185, 129, 0.2) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.25), 0 1px 3px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    color: #6ee7b7 !important;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

#fabNavBtn i {
    font-size: 0.8rem !important;
}

#fabNavBtn .fab-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(248, 250, 252, 0.9);
    white-space: nowrap;
}

#fabNavBtn:active {
    transform: scale(0.93) !important;
    background: rgba(16, 185, 129, 0.35) !important;
}

/* FAB Drawer */
#fabNavDrawer {
    display: none !important;
    position: fixed !important;
    bottom: calc(env(safe-area-inset-bottom, 0.5rem) + 5rem) !important;
    left: calc(env(safe-area-inset-left, 0.5rem) + 1.5rem) !important;
    z-index: 998 !important;
    background: linear-gradient(180deg, rgba(20, 20, 35, 0.98) 0%, rgba(13, 13, 20, 0.99) 100%) !important;
    border: 1px solid rgba(139, 92, 246, 0.15) !important;
    border-radius: 1rem !important;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 0.5rem !important;
    min-width: 180px;
    transform: scale(0.75) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#fabNavDrawer.open {
    display: flex !important;
    flex-direction: column !important;
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#fabNavDrawer a {
    display: flex !important;
    align-items: center;
    gap: 0.6rem !important;
    padding: 0.65rem 0.85rem !important;
    border-radius: 0.6rem !important;
    font-size: 0.8rem !important;
    color: rgba(248, 250, 252, 0.7) !important;
    transition: background-color 0.1s ease, transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

#fabNavDrawer a:active {
    transform: scale(0.97);
    background-color: rgba(139, 92, 246, 0.1) !important;
}

#fabNavDrawer a i {
    font-size: 0.85rem !important;
    width: 1.2rem;
    text-align: center;
}

/* FAB overlay backdrop */
#fabNavOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 997;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.25s ease;
}

#fabNavOverlay.open {
    display: block;
    opacity: 1;
}
