/* =====================================================
   COMPONENTES ESPECÍFICOS - MOBILE RESPONSIVE
   Melhorias adicionais para componentes FlouttPlow
   ===================================================== */

/* =====================================================
   FEED RESPONSIVO
   ===================================================== */

@media (max-width: 479px) {
    .feed-container, .feed-wrapper, .main-feed {
        padding: 60px 0 60px 0 !important;
    }

    .post-item, .postagem-item, .post, .postagem {
        margin: 0 !important;
        border-radius: 0 !important;
        border-bottom: 1px solid var(--cinza-claro);
        padding: 12px !important;
    }

    .post-header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }

    .post-user-info {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .post-user-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .post-user-details {
        flex: 1;
        min-width: 0;
    }

    .post-username {
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .post-time {
        font-size: 11px;
        color: var(--cinza);
    }

    .post-menu-btn {
        background: none;
        border: none;
        color: var(--cinza);
        cursor: pointer;
        padding: 4px;
        font-size: 16px;
    }

    .post-content-text {
        font-size: 14px;
        line-height: 1.4;
        margin: 8px 0;
        word-wrap: break-word;
        word-break: break-word;
    }

    .post-image-container, .post-video-container {
        width: calc(100% + 24px);
        margin: 8px -12px;
        border-radius: 0;
    }

    .post-image, .post-video {
        width: 100%;
        height: auto;
        max-height: 400px;
        object-fit: cover;
        border-radius: 0;
    }

    .post-stats {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        margin: 8px 0;
        font-size: 12px;
        color: var(--cinza);
        border-top: 1px solid var(--cinza-claro);
    }

    .post-actions-bar {
        display: flex;
        justify-content: space-around;
        padding: 8px 0;
        border-top: 1px solid var(--cinza-claro);
        border-bottom: 1px solid var(--cinza-claro);
    }

    .post-action-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px;
        background: none;
        border: none;
        color: var(--cinza);
        cursor: pointer;
        font-size: 12px;
        gap: 4px;
        min-height: 44px;
    }

    .post-action-btn i {
        font-size: 18px;
    }

    .post-action-btn.active {
        color: var(--cor-primary);
    }

    .post-action-btn:active {
        opacity: 0.7;
        background: rgba(0, 0, 0, 0.05);
    }
}

/* =====================================================
   COMENTÁRIOS RESPONSIVOS
   ===================================================== */

@media (max-width: 479px) {
    .comments-section, .secao-comentarios {
        padding: 12px 0;
        border-top: 1px solid var(--cinza-claro);
    }

    .comment, .comentario {
        display: flex;
        gap: 8px;
        padding: 8px 0;
        align-items: flex-start;
    }

    .comment-avatar, .avatar-comentario {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .comment-content, .conteudo-comentario {
        flex: 1;
        min-width: 0;
    }

    .comment-header, .cabecalho-comentario {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 4px;
        margin-bottom: 2px;
    }

    .comment-author, .autor-comentario {
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .comment-time, .tempo-comentario {
        font-size: 11px;
        color: var(--cinza);
        white-space: nowrap;
    }

    .comment-text, .texto-comentario {
        font-size: 13px;
        background: var(--cinza-claro);
        padding: 6px 8px;
        border-radius: 4px;
        word-wrap: break-word;
        margin-bottom: 4px;
    }

    .comment-actions, .acoes-comentario {
        display: flex;
        gap: 8px;
        font-size: 11px;
        color: var(--cinza);
    }

    .comment-action-link, .link-acao-comentario {
        background: none;
        border: none;
        color: var(--cinza);
        cursor: pointer;
        padding: 4px 0;
        font-size: 11px;
    }

    .comment-form, .formulario-comentario {
        display: flex;
        gap: 8px;
        padding: 12px 0 0;
        border-top: 1px solid var(--cinza-claro);
        align-items: flex-end;
    }

    .comment-input, .entrada-comentario {
        flex: 1;
        padding: 8px 10px;
        border: 1px solid var(--cinza-claro);
        border-radius: 4px;
        font-size: 13px;
        resize: none;
        max-height: 80px;
        font-family: inherit;
    }

    .comment-submit, .enviar-comentario {
        flex-shrink: 0;
        background: var(--cor-primary);
        color: white;
        border: none;
        border-radius: 4px;
        padding: 8px 12px;
        cursor: pointer;
        font-size: 13px;
        min-height: 36px;
    }
}

/* =====================================================
   MARKETPLACE RESPONSIVO
   ===================================================== */

@media (max-width: 479px) {
    .marketplace-container, .produtos-container {
        padding: 60px 8px 60px;
    }

    .products-grid, .produtos-grid, .marketplace-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .product-card, .card-produto {
        border-radius: 6px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .product-image, .imagem-produto {
        width: 100%;
        height: 140px;
        object-fit: cover;
        background: var(--cinza-claro);
    }

    .product-info, .info-produto {
        padding: 8px;
    }

    .product-name, .nome-produto {
        font-size: 12px;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .product-seller, .vendedor-produto {
        font-size: 11px;
        color: var(--cinza);
        margin-bottom: 4px;
    }

    .product-price, .preco-produto {
        font-size: 13px;
        font-weight: 700;
        color: var(--cor-primary);
        margin-bottom: 6px;
    }

    .product-rating, .avaliacao-produto {
        font-size: 10px;
        color: var(--cinza);
    }

    .product-buy-btn, .btn-comprar-produto {
        width: 100%;
        padding: 6px;
        margin-top: 6px;
        background: var(--cor-primary);
        color: white;
        border: none;
        border-radius: 4px;
        font-size: 11px;
        cursor: pointer;
        min-height: 32px;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    .products-grid, .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* =====================================================
   STORIES RESPONSIVO
   ===================================================== */

@media (max-width: 479px) {
    .stories-section, .secao-stories {
        padding: 8px;
        margin-bottom: 8px;
        background: var(--branco);
        border-bottom: 1px solid var(--cinza-claro);
    }

    .stories-scroll, .scroll-stories {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 0;
    }

    .story-item, .story {
        flex-shrink: 0;
        width: 56px;
        height: 90px;
        border-radius: 6px;
        overflow: hidden;
        position: relative;
        cursor: pointer;
        background: var(--cinza-claro);
    }

    .story-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .story-add-btn, .btn-adicionar-story {
        flex-shrink: 0;
        width: 56px;
        height: 90px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--cinza-claro);
        border: 2px dashed var(--cinza);
        cursor: pointer;
        font-size: 20px;
    }
}

/* =====================================================
   CHAT RESPONSIVO
   ===================================================== */

@media (max-width: 479px) {
    .chat-container, .container-chat {
        display: grid;
        grid-template-rows: 1fr auto;
        height: 100vh;
        padding-top: 60px;
        padding-bottom: 60px;
    }

    .conversations-list, .lista-conversas {
        display: none;
    }

    .chat-messages, .mensagens-chat {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px;
        gap: 8px;
    }

    .message, .mensagem {
        display: flex;
        max-width: 85%;
        word-wrap: break-word;
    }

    .message.sent, .mensagem.enviada {
        align-self: flex-end;
    }

    .message.received, .mensagem.recebida {
        align-self: flex-start;
    }

    .message-bubble, .bolha-mensagem {
        padding: 8px 10px;
        border-radius: 12px;
        font-size: 13px;
        line-height: 1.4;
    }

    .message.sent .message-bubble, .mensagem.enviada .bolha-mensagem {
        background: var(--cor-primary);
        color: white;
    }

    .message.received .message-bubble, .mensagem.recebida .bolha-mensagem {
        background: var(--cinza-claro);
        color: var(--preto);
    }

    .chat-input-area, .area-entrada-chat {
        display: flex;
        gap: 8px;
        padding: 8px;
        background: var(--branco);
        border-top: 1px solid var(--cinza-claro);
        align-items: flex-end;
    }

    .chat-input, .entrada-chat {
        flex: 1;
        padding: 8px 10px;
        border: 1px solid var(--cinza-claro);
        border-radius: 4px;
        font-size: 13px;
        resize: none;
        max-height: 80px;
        font-family: inherit;
    }

    .chat-send-btn, .btn-enviar-chat {
        flex-shrink: 0;
        background: var(--cor-primary);
        color: white;
        border: none;
        border-radius: 4px;
        padding: 8px 12px;
        cursor: pointer;
        font-size: 16px;
        min-height: 36px;
        width: 36px;
    }
}

/* =====================================================
   NAVIGATION BOTTOM
   ===================================================== */

@media (max-width: 767px) {
    .bottom-navigation, .navbar-bottom, .tab-navigation {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-around;
        background: var(--branco);
        border-top: 1px solid var(--cinza-claro);
        z-index: 999;
        padding-bottom: max(0, env(safe-area-inset-bottom));
    }

    .nav-item-bottom, .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 0;
        color: var(--cinza);
        text-decoration: none;
        font-size: 11px;
        gap: 2px;
        min-height: 44px;
    }

    .nav-item-bottom i, .bottom-nav-item i {
        font-size: 20px;
    }

    .nav-item-bottom.active, .bottom-nav-item.active {
        color: var(--cor-primary);
    }

    .nav-item-bottom:active, .bottom-nav-item:active {
        background: rgba(0, 0, 0, 0.05);
    }
}

/* =====================================================
   MODALS MOBILE
   ===================================================== */

@media (max-width: 479px) {
    .modal, .modal-dialog, .dialog {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2000;
        display: none;
        align-items: flex-end;
        background: rgba(0, 0, 0, 0.5);
    }

    .modal.show, .modal-dialog.show, .dialog.show {
        display: flex;
    }

    .modal-content, .dialog-content {
        width: 100%;
        background: var(--branco);
        border-radius: 12px 12px 0 0;
        padding: 16px;
        max-height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .modal-header, .cabecalho-modal {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--cinza-claro);
    }

    .modal-title, .titulo-modal {
        font-size: 16px;
        font-weight: 600;
    }

    .modal-close, .fechar-modal {
        background: none;
        border: none;
        color: var(--cinza);
        cursor: pointer;
        font-size: 20px;
        padding: 0;
    }

    .modal-body, .corpo-modal {
        margin: 12px 0;
    }

    .modal-footer, .rodape-modal {
        display: flex;
        gap: 8px;
        margin-top: 16px;
        padding-top: 12px;
        border-top: 1px solid var(--cinza-claro);
    }

    .modal-footer button, .rodape-modal button {
        flex: 1;
    }
}

/* =====================================================
   UTILITÁRIOS ADICIONAIS
   ===================================================== */

/* Esconder scrollbar mantendo scroll funcional */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Text truncate mobile */
.truncate-2 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.truncate-3 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Safe touch targets */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Responsive spacing */
@media (max-width: 479px) {
    .p-sm-mobile { padding: 8px; }
    .p-md-mobile { padding: 12px; }
    .m-sm-mobile { margin: 8px; }
    .m-md-mobile { margin: 12px; }
}
