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

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.chat-container {
    max-width: 900px;
    width: 100%;
    height: 90vh;
    background: white;
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.header {
    background: #0f172a;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.user-info {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #1e293b;
    padding: 6px 14px;
    border-radius: 40px;
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.message {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px);}
    to { opacity: 1; transform: translateY(0);}
}

.sent {
    align-self: flex-end;
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.received {
    align-self: flex-start;
    background: #e2e8f0;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}

.message-header {
    font-size: 0.7rem;
    font-weight: bold;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    opacity: 0.8;
}

.message-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.message-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    margin-top: 6px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
}

.file-link {
    display: inline-block;
    margin-top: 6px;
    background: rgba(0,0,0,0.08);
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.8rem;
    color: inherit;
}

.sent .file-link {
    background: rgba(255,255,255,0.2);
    color: white;
}

.info {
    text-align: center;
    color: #64748b;
    padding: 20px;
}

.input-area {
    padding: 12px 16px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.file-preview {
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 24px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.cancel-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #64748b;
}

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

#messageInput {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 40px;
    font-size: 0.95rem;
    outline: none;
    transition: border 0.2s;
}

#messageInput:focus {
    border-color: #3b82f6;
}

.file-label {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: transform 0.1s;
}

.file-label:hover {
    transform: scale(1.05);
}

.send-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #2563eb;
}

.upload-progress {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

progress {
    flex: 1;
    height: 6px;
    border-radius: 10px;
}

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 28px;
    border-radius: 28px;
    width: 90%;
    max-width: 320px;
    text-align: center;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin: 16px 0;
    border: 1px solid #cbd5e1;
    border-radius: 40px;
}

.modal-content button {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 40px;
    cursor: pointer;
}

@media (max-width: 640px) {
    .message {
        max-width: 85%;
    }
}
/* Message action buttons (Edit/Delete) */
.message-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.edit-btn, .delete-btn {
    background: none;
    border: none;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 12px;
    transition: background 0.1s;
}

.sent .edit-btn, .sent .delete-btn {
    color: #e0e7ff;
    background: rgba(255,255,255,0.1);
}

.received .edit-btn, .received .delete-btn {
    color: #475569;
    background: rgba(0,0,0,0.05);
}

.edit-btn:hover, .delete-btn:hover {
    background: rgba(0,0,0,0.15);
}

.sent .edit-btn:hover, .sent .delete-btn:hover {
    background: rgba(255,255,255,0.2);
}