* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: opacity 0.3s, transform 0.3s;
    display: block;
}

header.hidden {
    display: none !important;
    visibility: hidden;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #667eea;
    font-size: 28px;
}

header h1.hidden {
    display: none;
}

nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu span {
    font-weight: 600;
    color: #667eea;
    font-size: 16px;
}

.user-avatar-container {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
    display: block;
}

.user-avatar-fallback {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    border: 2px solid #667eea;
}

.user-menu-dropdown {
    position: relative;
    z-index: 10002;
}

.btn-menu-toggle {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #667eea;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.2s;
    line-height: 1;
    font-weight: bold;
    position: relative;
    z-index: 10005;
    flex-shrink: 0;
    min-width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.btn-menu-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    display: none;
    z-index: 10003;
    overflow: visible;
    pointer-events: auto;
}

.user-dropdown.show {
    display: block !important;
    animation: slideDownDropdown 0.2s ease;
    pointer-events: auto !important;
}

@keyframes slideDownDropdown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
    position: relative;
    z-index: 10004;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item span {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.dropdown-item.logout {
    color: #e74c3c;
}

.dropdown-item.logout:hover {
    background: #fee;
    color: #c0392b;
}

.dropdown-item.danger {
    color: #e74c3c;
}

.dropdown-item.danger:hover {
    background: #fee;
    color: #c0392b;
}

.dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

.foto-preview-container {
    text-align: center;
    margin-bottom: 20px;
}

.foto-preview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #667eea;
    margin: 0 auto;
    display: block;
}

#inputFoto {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 5px;
}

.close-foto {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-foto:hover {
    color: #000;
}

.close-editar-nome {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-editar-nome:hover {
    color: #000;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-icon {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 21;
    flex-shrink: 0;
}

/* Main Content */
main {
    padding: 40px 20px;
}

.filtros {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    justify-content: center;
}

.filtro-btn {
    padding: 10px 20px;
    border: 2px solid white;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.filtro-btn:hover, .filtro-btn.active {
    background: white;
    color: #667eea;
}

/* Produtos Grid */
.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.produto-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.produto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.produto-imagem {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: #f5f5f5;
}

.produto-info {
    padding: 20px;
}

.produto-nome {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.produto-descricao {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.produto-preco {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-modal {
    max-width: 900px;
    height: 80vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-content label {
    font-weight: 600;
    color: #333;
}

.modal-content input {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.modal-content input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-content a {
    color: #667eea;
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

/* Modal de Tela Cheia para Mídia */
.modal-fullscreen {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    overflow: auto;
    animation: fadeIn 0.3s;
}

.modal-fullscreen.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: color 0.3s;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-fullscreen:hover,
.close-fullscreen:focus {
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
}

#fullscreenImage,
#fullscreenVideo {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#fullscreenVideo {
    width: auto;
    height: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Mobile - ajustes para tela cheia */
@media (max-width: 768px) {
    .close-fullscreen {
        top: 10px;
        right: 15px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    #fullscreenImage,
    #fullscreenVideo {
        max-width: 95%;
        max-height: 95%;
    }
}

/* Chat Fullscreen (WhatsApp Style) */
.chat-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f0f2f5;
    z-index: 100;
    overflow: hidden;
}

/* Header já é escondido completamente quando logado via JavaScript */

.chat-container-full {
    display: flex;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.chat-container-full .chat-sidebar {
    width: 350px;
    background: var(--contatos-fundo, #f0f2f5);
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.chat-container-full .chat-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--contatos-fundo-imagem, none);
    background-size: cover;
    background-position: center;
    opacity: var(--contatos-fundo-opacidade, 0.1);
    pointer-events: none;
    z-index: 0;
}

.chat-container-full .chat-sidebar > * {
    position: relative;
    z-index: 1;
}

.chat-container-full .chat-sidebar .chat-header {
    z-index: 2;
    overflow: visible;
}

.chat-container-full .chat-sidebar .user-menu-dropdown {
    z-index: 10002;
    position: relative;
    overflow: visible;
}

.chat-container-full .chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-fundo, #f0f2f5);
    height: 100%;
    position: relative;
}

.chat-container-full .chat-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--chat-fundo-imagem, none);
    background-size: cover;
    background-position: center;
    opacity: var(--chat-fundo-opacidade, 0.1);
    pointer-events: none;
    z-index: 0;
}

.chat-container-full .chat-main > * {
    position: relative;
    z-index: 1;
}

/* Chat */
.chat-container {
    display: flex;
    height: 100%;
}

.chat-sidebar {
    width: 300px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 5;
    background: white;
}

.chat-header h3 {
    color: #667eea;
    margin: 0;
    flex: 1;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 10;
}

.busca-amigo {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.busca-amigo input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.resultados-busca {
    margin-top: 10px;
}

.usuario-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.usuario-item:hover {
    background: #f5f5f5;
}

.lista-amigos {
    flex: 1;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.lista-amigos.has-dropdown-open .amigo-item {
    pointer-events: none;
}

.lista-amigos.has-dropdown-open {
    z-index: 1;
}

.amigo-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
    position: relative;
    z-index: 1;
}

.amigo-item:hover, .amigo-item.active {
    background: var(--contatos-item-hover, #f5f5f5);
}

.amigo-nome {
    color: var(--contatos-texto, #333);
}

.amigo-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.amigo-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.amigo-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.amigo-info {
    flex: 1;
}

.amigo-nome {
    font-weight: 600;
    color: #333;
}

.amigo-status {
    font-size: 12px;
    color: #666;
}

.badge-nao-lidas {
    background: #667eea;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--chat-fundo, #ece5dd);
    min-height: 0;
    background-image: var(--chat-fundo-imagem-url, url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='chatPattern' x='0' y='0' width='100' height='100' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='20' cy='20' r='1' fill='%23d4d4d4' opacity='0.3'/%3E%3Ccircle cx='80' cy='40' r='1' fill='%23d4d4d4' opacity='0.3'/%3E%3Ccircle cx='40' cy='80' r='1' fill='%23d4d4d4' opacity='0.3'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100' height='100' fill='url(%23chatPattern)'/%3E%3C/svg%3E")), var(--chat-fundo-imagem, none);
    background-size: 200px 200px, cover;
    background-position: center, center;
    background-blend-mode: normal;
    position: relative;
}

.messages-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--chat-fundo-imagem, none);
    background-size: cover;
    background-position: center;
    opacity: var(--chat-fundo-opacidade, 0.1);
    pointer-events: none;
    z-index: 0;
}

.messages-container > * {
    position: relative;
    z-index: 1;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.message.own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.message-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-content {
    max-width: 70%;
    background: var(--mensagem-recebida-fundo, white);
    color: var(--mensagem-recebida-texto, #000);
    padding: 12px 15px 8px 15px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
}

.message.own .message-content {
    background: var(--mensagem-enviada-fundo, #dcf8c6);
    color: var(--mensagem-enviada-texto, #000);
}

.message-info {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    line-height: 1.2;
}

.message.own .message-info {
    color: rgba(0,0,0,0.6);
}

.message-status {
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    min-width: 16px;
    font-family: 'Segoe UI', sans-serif;
}

.message-status.sent {
    color: rgba(0,0,0,0.5);
    opacity: 0.7;
}

.message-status.read {
    color: #34b7f1;
    opacity: 1;
}

.message-media {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.message-media:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.message-media img {
    cursor: pointer;
}

.message-media video {
    max-width: 100%;
    max-height: 400px;
}

.message.selected .message-content {
    background: rgba(0, 123, 255, 0.2) !important;
    border-left: 3px solid #007bff;
}

.message.swiping {
    opacity: 0.8;
}

.reply-preview {
    display: none;
    background: #f0f0f0;
    border-left: 3px solid #007bff;
    padding: 8px 12px;
    margin: 0;
    border-radius: 0;
    width: 100%;
    box-sizing: border-box;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.reply-preview-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reply-preview-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reply-preview-label {
    font-size: 12px;
    font-weight: 600;
    color: #007bff;
}

.reply-preview-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reply-preview-close:hover {
    color: #333;
}

.reply-preview-text {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.message-input {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    background: white;
    align-items: center;
}

.btn-anexar {
    background: #075e54;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    flex-shrink: 0;
}

.btn-anexar:hover {
    background: #064e46;
}

.message-input input[type="text"] {
    flex: 1;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.message-input button.btn-primary {
    padding: 12px 25px;
}

.preview-container {
    padding: 10px 15px;
    background: #f0f0f0;
    border-top: 1px solid #e0e0e0;
}

.preview-item {
    position: relative;
    display: inline-block;
}

.preview-item img,
.preview-item video {
    border-radius: 8px;
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
}

.btn-remover-preview {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-remover-preview:hover {
    background: #c82333;
}

/* Chat Messages Header */
.chat-messages-header {
    display: none;
    padding: 10px 15px;
    background: #075e54;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    justify-content: space-between;
    flex-wrap: nowrap;
}

.chat-messages-header-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-messages-menu-dropdown {
    position: relative;
    z-index: 22;
}

.chat-messages-header .btn-menu-toggle {
    color: white;
    font-size: 20px;
}

.chat-messages-header .btn-menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.chat-messages-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.chat-messages-header .user-dropdown {
    right: 0;
    left: auto;
}

.chat-messages-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.btn-voltar {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: background 0.2s;
    display: none;
}

.btn-voltar:hover {
    background: rgba(255,255,255,0.1);
}

.chat-messages-header .amigo-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-messages-header .amigo-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chat-messages-header .amigo-nome {
    color: white;
    font-size: 16px;
}

.chat-messages-header .amigo-status {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container-full {
        flex-direction: column;
        max-width: 100%;
    }
    
    .chat-container-full .chat-sidebar {
        width: 100%;
        height: 100%;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 20;
        transition: transform 0.3s ease;
        background: var(--contatos-fundo, #f0f2f5);
    }
    
    .chat-container-full .chat-sidebar.hidden-mobile {
        transform: translateX(-100%);
    }
    
    .chat-container-full .chat-main {
        width: 100%;
        height: 100%;
        position: relative;
    }
    
    .chat-messages-header {
        display: flex;
        padding: 10px 12px;
    }
    
    .btn-voltar {
        display: block;
    }
    
    .chat-messages {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .messages-container {
        flex: 1;
        padding: 15px 10px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }
    
    .message {
        margin-bottom: 12px;
    }
    
    .message-content {
        max-width: 75%;
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .message-input {
        padding: 10px;
        border-top: 1px solid #e0e0e0;
    }
    
    .message-input input {
        font-size: 14px;
        padding: 10px;
    }
    
    .message-input button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .chat-header {
        padding: 15px;
        position: relative;
        z-index: 10;
    }
    
    .chat-header h3 {
        font-size: 18px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100% - 100px);
    }
    
    .chat-header-actions {
        gap: 8px;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .btn-menu-toggle {
        min-width: 32px;
        height: 32px;
        font-size: 20px;
        padding: 4px 8px;
    }
    
    .amigo-item {
        padding: 12px 15px;
    }
    
    .amigo-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .amigo-nome {
        font-size: 15px;
    }
    
    .amigo-status {
        font-size: 12px;
    }
    
    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
    
    header h1 {
        font-size: 22px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 80%;
        font-size: 13px;
        padding: 8px 10px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .chat-messages-header {
        padding: 8px 10px;
        min-height: 56px;
    }
    
    .chat-messages-header .amigo-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .chat-messages-header .amigo-nome {
        font-size: 15px;
    }
    
    .chat-messages-header .amigo-status {
        font-size: 12px;
    }
    
    .btn-voltar {
        font-size: 22px;
        padding: 4px 8px;
    }
    
    .user-info {
        gap: 8px;
    }
    
    .user-menu span {
        font-size: 14px;
    }
    
    .user-dropdown {
        right: -10px;
        min-width: 180px;
    }
    
    .message-input {
        padding: 8px;
    }
    
    .message-input input {
        padding: 8px;
        font-size: 13px;
    }
    
    .message-input button {
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* Modal de Tema */
.modal-tema-content {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.tema-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.tema-section h3 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 18px;
}

.tema-group {
    margin-bottom: 20px;
}

.tema-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}

.color-input-group input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: monospace;
}

.file-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.file-input-group input[type="file"] {
    flex: 1;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.btn-remover-fundo {
    padding: 8px 15px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-remover-fundo:hover {
    background: #c82333;
}

.preview-fundo {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    max-height: 200px;
    display: none;
}

.preview-fundo img {
    width: 100%;
    height: auto;
    display: block;
}

.preview-fundo.show {
    display: block;
}

.tema-group input[type="range"] {
    width: 100%;
    margin: 10px 0;
}

#opacidadeFundoValue {
    display: inline-block;
    margin-left: 10px;
    font-weight: 600;
    color: #667eea;
}

.tema-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.close-tema {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

/* Modal de Recorte de Imagem */
.modal-crop-content {
    max-width: 90%;
    width: 600px;
    padding: 20px;
}

.crop-container {
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    margin: 20px 0;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.crop-container img {
    max-width: 100%;
    max-height: 70vh;
    display: block;
}

.crop-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.crop-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.close-crop {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    z-index: 10;
}

.close-crop:hover {
    color: #000;
}

/* Responsividade para modal de recorte */
@media (max-width: 768px) {
    .modal-crop-content {
        width: 95%;
        padding: 15px;
        margin: 10% auto;
    }
    
    .crop-container {
        max-height: 60vh;
    }
    
    .crop-actions {
        flex-direction: column;
    }
    
    .crop-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .modal-crop-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        height: 100vh;
        padding: 10px;
    }
    
    .crop-container {
        max-height: 70vh;
        margin: 10px 0;
    }
    
    .close-crop {
        right: 10px;
        top: 10px;
        font-size: 24px;
    }
}

/* Menu de Contexto de Mensagens */
.message-context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 200px;
    padding: 8px 0;
    display: none;
    animation: slideDown 0.2s;
}

.context-menu-item {
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: #f5f5f5;
}

.context-menu-item span {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.context-menu-item:active {
    background: #e0e0e0;
}

/* Modal de Encaminhar */
.amigo-item-encaminhar:hover {
    background: #f5f5f5;
}

.amigo-item-encaminhar:active {
    background: #e0e0e0;
}

.close-encaminhar {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-encaminhar:hover {
    color: #000;
}

.close-tema:hover {
    color: #000;
}
