/* mobile-app.css – полноэкранный мобильный режим мессенджера (desktop не затрагивается) */

@media (max-width: 768px) {
    body:not(.auth-page) {
        overflow: hidden;
        height: 100dvh;
    }

    #chat-page {
        height: 100dvh;
    }

    #chat-app.mobile-enabled {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    #chat-app.mobile-enabled .sidebar {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: none;
        border-right: none;
        flex: 1;
    }

    #chat-app.mobile-enabled .chat-area {
        display: none;
        width: 100%;
        height: 100%;
        flex: 1;
        min-height: 0;
    }

    #chat-app.mobile-enabled.chat-open .sidebar {
        display: none;
    }

    #chat-app.mobile-enabled.chat-open .chat-area {
        display: flex;
        flex-direction: column;
    }

    .sidebar-header {
        padding: 12px 14px;
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .search-area {
        padding: 8px 12px;
    }

    #search-input {
        padding: 12px 14px;
        font-size: 16px;
    }

    .chat-item {
        padding: 12px 16px;
        min-height: 72px;
    }

    .chat-avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    /* Шапка чата */
    .chat-header {
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
        gap: 8px;
    }

    .chat-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin: 0 -4px 0 0;
        padding: 0;
        background: none;
        border: none;
        border-radius: 10px;
        color: var(--lumina-accent);
        cursor: pointer;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .chat-back-btn:active {
        background: var(--lumina-accent-soft);
    }

    .chat-back-btn svg {
        width: 24px;
        height: 24px;
    }

    #chat-name {
        flex: 1;
        min-width: 0;
        font-size: 16px;
    }

    .chat-header-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    #messages-container {
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .message-bubble {
        max-width: 82%;
        font-size: 15px;
        padding: 10px 14px;
    }

    .chat-composer {
        padding-bottom: max(0, env(safe-area-inset-bottom));
    }

    .chat-input-row {
        padding: 10px 12px;
    }

    .chat-composer #message-input {
        font-size: 16px;
        height: 44px;
        line-height: 44px;
        padding: 0 14px;
        border-radius: 10px;
    }

    .chat-composer #send-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    .chat-placeholder {
        padding: 24px;
    }

    .placeholder-text {
        font-size: 16px;
        text-align: center;
    }

    /* Боковое меню: фиксированная панель поверх затемнения */
    body.side-menu-open {
        overflow: hidden;
    }

    .context-menu {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: min(300px, 88vw) !important;
        height: 100dvh !important;
        max-height: none !important;
        transform: translateX(-100%) !important;
        z-index: 10001 !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .context-menu.open {
        transform: translateX(0) !important;
    }

    .context-overlay {
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        height: 100dvh !important;
        z-index: 10000 !important;
    }

    .context-overlay.show {
        background: var(--lumina-overlay-menu) !important;
        pointer-events: auto;
    }

    .context-menu.context-menu--portaled {
        z-index: 10001 !important;
    }

    .chat-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin: 0;
        padding: 0;
        border-radius: 10px;
        color: var(--lumina-accent);
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .chat-menu-btn:active {
        background: var(--lumina-accent-soft);
    }

    .sidebar.menu-open {
        z-index: auto;
    }

    /* Модалки – bottom sheet */
    .lumina-modal-overlay,
    .profile-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .lumina-modal,
    .profile-modal {
        max-width: 100%;
        width: 100%;
        max-height: min(92dvh, 100%);
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        transform: translateY(100%);
    }

    .lumina-modal-overlay.show .lumina-modal,
    .profile-modal-overlay.show .profile-modal {
        transform: translateY(0);
    }

    .lumina-modal-header {
        padding: 14px 16px;
    }

    .lumina-modal-body {
        padding: 16px;
    }

    .lumina-modal--profile .lumina-modal-body {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    /* Меню сообщений — уже bottom sheet через .msg-menu--sheet */

    .composer-reply-bar.show {
        padding: 0 8px;
    }

    .lumina-modal--edit {
        max-height: 94dvh;
    }

    .lumina-modal--edit .lumina-modal-body {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    /* Уведомление квеста */
    .quest-notification {
        left: 12px;
        right: 12px;
        bottom: max(16px, env(safe-area-inset-bottom));
        width: auto;
    }
}

@media (min-width: 769px) {
    .chat-back-btn {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .gift-item {
        width: 100px;
    }

    .gift-image {
        width: 58px;
        height: 58px;
    }

    .quest-item {
        flex-wrap: wrap;
    }

    .quest-reward {
        width: 100%;
        flex-direction: row;
        justify-content: flex-end;
        margin-top: 4px;
    }
}
