/* css/messages.css - WhatsApp Style FULL WIDTH */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; }

.messages-app {
    display: flex;
    height: calc(100vh - 60px);
    width: 100%;
    max-width: 100vw;
}

.chat-sidebar {
    width: 380px;
    min-width: 300px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.chat-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ece5dd;
    background-image: url('data:image/svg+xml,...'); /* Opzionale */
}

.chat-header, .chat-detail-header {
    padding: 15px;
    background: #075e54;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 0.9em;
}

.folder-list {
    padding: 10px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-bottom: 1px solid #eee;
}

.folder-btn {
    padding: 6px 12px;
    background: #eee;
    border-radius: 20px;
    font-size: 0.8em;
    cursor: pointer;
    white-space: nowrap;
}

.folder-btn.active { background: #075e54; color: white; }

.chat-list { flex: 1; overflow-y: auto; }
.chat-item {
    position: relative;
    padding-left: 50px !important;
}


.chat-item:hover { background: #f9f9f9; }
.chat-item.unread { font-weight: bold; }

.chat-item input[type=checkbox] {
    position: absolute !important;
    left: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10 !important;
    pointer-events: auto !important;
}

.chat-item button[title="Rimuovi da questa cartella"] {
    opacity: 0.6;
    transition: opacity 0.2s;
}
.chat-item:hover button[title="Rimuovi da questa cartella"] {
    opacity: 1;
}

.message-input {
    display: flex;
    padding: 10px;
    background: white;
    gap: 10px;
    border-top: 1px solid #ddd;
}
.message-input input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 1em;
}
.message-input button {
    background: #075e54;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message {
    max-width: 65%;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.4;
    position: relative;
}
.message.sent {
    background: #dcf8c6;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.message.received {
    background: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.message .time {
    font-size: 0.7em;
    color: #666;
    margin-top: 4px;
    text-align: right;
}

.new-chat-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.user-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 10px 0;
}
.user-result {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}
.user-result:hover { background: #f0f0f0; }

.btn-primary { background: #075e54; color: white; padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; }
.btn-secondary { background: #ccc; color: #333; padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; }

.bulk-actions {
    padding: 10px;
    background: #f8f8f8;
    display: flex;
    gap: 8px;
    font-size: 0.85em;
    border-top: 1px solid #eee;
}
.bulk-actions button {
    background: #ddd;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.resize-handle {
    width: 5px;
    background: #ddd;
    cursor: col-resize;
    z-index: 100;
    position: relative;
}

.resize-handle:hover {
    background: #075e54;
}

.filter-btn {
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}

.filter-btn.active {
    background: #075e54;
    color: white;
    border-color: #075e54;
}

.folder-option {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.folder-option:hover {
    background: #f8f8f8;
}

.unread-count {
    background: #075e54;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7em;
    min-width: 18px;
    text-align: center;
}


