:root {
    --whatsapp-green: #25D366;
    --whatsapp-light-green: #DCF8C6;
    --whatsapp-header: #075E54;
    --whatsapp-light-bg: #E5DDD5;
    --whatsapp-chat-bg: #ECE5DD;
    --msg-out: #DCF8C6;
    --msg-in: #FFFFFF;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: #d9dbd5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600' viewBox='0 0 600 600'%3E%3Cpath fill='%23e2e2e2' d='M600 325.1v-170.2l-228.9-78.8-371.1 78.8v170.2l228.9 78.7z'/%3E%3Cpath fill='%23ebebeb' d='M600 325.1v-170.2l-228.9-78.8-371.1 78.8v170.2l228.9 78.7z'/%3E%3Cpath fill='%23e2e2e2' d='M341.7 191.7l-228.9-78.8-341.1 78.8 228.9 78.8z'/%3E%3Cpath fill='%23ebebeb' d='M341.7 191.7l-228.9-78.8-341.1 78.8 228.9 78.8z'/%3E%3Cpath fill='%23e8e8e8' d='M0 154.9v170.2l228.9-78.7-228.9-170.2z'/%3E%3C/svg%3E");
    background-position: center;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
}

.chat-header {
    background-color: var(--whatsapp-header);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.chat-header-info {
    display: flex;
    align-items: center;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ccc;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    background-image: linear-gradient(120deg, #00b09b, #096b5e);
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.online-status {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 20px;
}

.header-actions a {
    color: white;
    text-decoration: none;
    font-size: 20px;
    transition: opacity 0.2s;
}

.header-actions a:hover {
    opacity: 0.8;
}

.chat-messages-container {
    flex-grow: 1;
    background-color: var(--whatsapp-chat-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='100' viewBox='0 0 600 100'%3E%3Cg stroke='%23eee' stroke-width='0' stroke-miterlimit='10' fill='%23DCE1DE'%3E%3Ccircle cx='30' cy='50' r='20'/%3E%3Ccircle cx='290' cy='50' r='20'/%3E%3Ccircle cx='550' cy='50' r='20'/%3E%3C/g%3E%3C/svg%3E");
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

#chat-messages {
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

.message {
    position: relative;
    max-width: 65%;
    padding: 8px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    word-wrap: break-word;
    transform-origin: bottom;
    transition: all 0.2s ease;
}

.message.sent {
    align-self: flex-end;
    background-color: var(--msg-out);
    border-top-right-radius: 0;
}

.message.received {
    align-self: flex-start;
    background-color: var(--msg-in);
    border-top-left-radius: 0;
}

.message strong {
    font-size: 14px;
    color: #075E54;
    font-weight: 600;
    display: block;
    margin-bottom: 3px;
}

.message-text {
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: #000 !important;
}

.message-time {
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-top: 3px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
}

.read-receipt {
    display: inline-block;
    margin-left: 3px;
    transition: color 0.3s ease;
}

.message-image {
    max-width: 100% !important;
    border-radius: 5px !important;
    margin: 5px 0 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

.message-image:hover {
    opacity: 0.9;
}

.typing-indicator {
    padding: 8px 15px;
    background-color: rgba(255,255,255,0.8);
    border-radius: 18px;
    font-style: italic;
    color: #555;
    margin-bottom: 10px;
    align-self: flex-start;
    display: flex;
    align-items: center;
    font-size: 13px;
    animation: fadeIn 0.3s;
    z-index: 5;
}

.typing-animation {
    display: inline-flex;
    margin-left: 8px;
}

.typing-dot {
    height: 6px;
    width: 6px;
    margin: 0 2px;
    background-color: #888;
    border-radius: 50%;
    animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0.2s; }
.typing-dot:nth-child(2) { animation-delay: 0.4s; }
.typing-dot:nth-child(3) { animation-delay: 0.6s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
}

.chat-input-container {
    background-color: #f0f0f0;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid #e5e5e5;
    position: relative;
    z-index: 10;
}

.chat-actions {
    display: flex;
    gap: 16px;
    color: #777;
    font-size: 20px;
}

.chat-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #777;
    font-size: 20px;
    transition: color 0.2s;
}

.chat-action-btn:hover {
    color: var(--whatsapp-header);
}

.message-input-wrapper {
    flex-grow: 1;
    background-color: white;
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

#message-input {
    flex-grow: 1;
    height: 40px;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-family: 'Open Sans', sans-serif;
}

#message-input:focus {
    outline: none;
}

.send-btn {
    background-color: var(--whatsapp-green);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.send-btn:hover {
    background-color: #1da856;
}

/* File Upload Styling */
.file-upload {
    position: relative;
}

#file-input {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Animation for new messages */
@keyframes fadeInMessage {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.new-message {
    animation: fadeInMessage 0.3s ease forwards !important;
}

.message.sent.new-message {
    animation: slideIn 0.3s ease;
}

.message.sending {
    opacity: 0.8;
}

.message.sent-success {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.message.sent-error {
    background-color: rgba(255, 200, 200, 0.2);
    border-left: 3px solid #f44336;
}

/* Image Preview */
.image-preview {
    display: none;
    margin: 10px 16px 0;
    position: relative;
    max-width: 200px;
}

.preview-image {
    max-width: 100%;
    border-radius: 8px;
    border: 2px solid var(--whatsapp-green);
}

.remove-preview {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #f44336;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    cursor: pointer;
    font-size: 12px;
}

/* Lightbox for images */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

/* Emoji Picker Styling */
.emoji-picker-container {
    position: absolute;
    bottom: 70px;
    right: 20px;
    z-index: 100;
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    overflow: hidden;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s ease;
}

.emoji-picker-container.active {
    transform: translateY(0);
    opacity: 1;
}

emoji-picker {
    height: 300px;
    width: 300px;
}

/* Loading indicator */
.loading-indicator {
    text-align: center;
    padding: 10px;
    color: #777;
    display: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--whatsapp-header);
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar styling */
.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.2);
    border-radius: 10px;
}

/* Upload feedback */
.upload-progress {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--whatsapp-header);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-progress.active {
    opacity: 1;
}

.upload-progress .spinner {
    border-top-color: white;
    margin-right: 10px;
    width: 16px;
    height: 16px;
}

/* Message status indicators */
.status-indicator {
    font-size: 12px;
    margin-left: 5px;
    transition: all 0.3s ease;
}

.status-sending {
    color: #aaa;
}

.status-sent {
    color: #999;
}

.status-delivered {
    color: #777;
}

.status-read {
    color: var(--whatsapp-green);
}

/* Notification for new messages */
.new-messages-notification {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--whatsapp-header);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    display: none;
    opacity: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 5;
}

.new-messages-notification.active {
    opacity: 1;
    transform: translate(-50%, -10px);
}

.new-messages-notification:hover {
    background-color: #064740;
}

/* Error message retry button */
.retry-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 5px;
    transition: background-color 0.2s;
}

.retry-btn:hover {
    background-color: #d32f2f;
}

/* Debug info */
.debug-info {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    display: none;
    z-index: 9999;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .message {
        max-width: 80%;
    }
    
    .emoji-picker-container {
        right: 10px;
        bottom: 65px;
    }
    
    emoji-picker {
        height: 250px;
        width: 250px;
    }

    /* Add these to your chat.css file */

/* Message animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Apply animations to new messages */
.message {
    position: relative !important;
    max-width: 65% !important;
    padding: 8px 15px !important;
    border-radius: 8px !important;
    margin-bottom: 10px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
    word-wrap: break-word !important;
    transform-origin: bottom !important;
    transition: all 0.2s ease !important;
    display: block !important;
}

.message.sent {
    align-self: flex-end !important;
    background-color: #DCF8C6 !important;
    border-top-right-radius: 0 !important;
    color: #000 !important;
}

.message.received {
    align-self: flex-start !important;
    background-color: #FFFFFF !important;
    border-top-left-radius: 0 !important;
    color: #000 !important;
}

.message.sent:before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    right: -8px !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 8px solid #DCF8C6 !important;
    border-top: 8px solid transparent !important;
}

.message.received:before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: -8px !important;
    width: 0 !important;
    height: 0 !important;
    border-right: 8px solid #FFFFFF !important;
    border-top: 8px solid transparent !important;
}

/* Ensure flex container for messages */
#chat-messages {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

}