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

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden; /* 🔒 LOCK PAGE SCROLL */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e5ddd5;
}


.chat-container {
    max-width: 400px;
    height: 100dvh; /* ✅ FIXES ANDROID KEYBOARD ISSUE */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.chat-header {
    background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
    color: white;
    flex-shrink: 0;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#menu-btn, #profile-btn {
    font-size: 24px;
    color: white;
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    cursor: pointer;
}

#menu-btn:hover, #profile-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.partner-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
}

#status-container {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.status-text {
    font-weight: 500;
    font-size: 13px;
}

.status-text.online { color: #00d4aa !important; }
.status-text.offline { color: #667781 !important; }
.status-time { color: #667781; font-size: 12px; }

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain; /* ✅ no bounce */
    background: #e5ddd5;
    padding: 15px;
    display: flex;
    flex-direction: column;
}


.message {
    max-width: 75%;
    margin-bottom: 12px;
    position: relative;
    animation: messageSlide 0.3s ease;
    word-wrap: break-word;
}

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

/* ✅ DELETE ANIMATION */
@keyframes deleteMessage {
    0% { opacity: 1; transform: translateX(0) scale(1); }
    30% { opacity: 0.7; transform: translateX(-20px) scale(0.95); }
    100% { opacity: 0; transform: translateX(-50px) scale(0.8); }
}

.message.me { align-self: flex-end; }
.message.partner { align-self: flex-start; }

/* ✅ PERFECT MESSAGE BUBBLE STRUCTURE */
.message-time {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
}

.message-time.me {
    background: linear-gradient(135deg, #dcf8c6 0%, #d4f2c6 100%);
    padding: 8px 12px 6px 12px;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.message-time.partner {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 8px 12px 8px 12px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-content {
    word-wrap: break-word;
    margin-bottom: 2px;
    font-size: 16px;
    color: #111b21;
    line-height: 1.4;
}

.message img {
    max-width: 250px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 2px;
}

/* ✅ PERFECT WHATSAPP BLUE TICKS SYSTEM */
.tick-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1px;
    margin-top: 1px;
    padding-right: 6px;
    min-height: 14px;
}

.tick {
    font-size: 12px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    margin: 0 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-block;
}

.tick:not(.seen) {
    color: #919191 !important;
}

.tick.seen {
    color: #4fc3f7 !important;
    text-shadow: 0 1px 1px rgba(79, 195, 247, 0.3);
}

.time-text {
    font-size: 11px;
    color: #667781;
    opacity: 0.8;
    line-height: 1;
    margin-right: 2px;
}

/* 🚀 ENHANCED DELETE BUTTON WITH HOVER EFFECT */
.delete-btn {
    position: absolute !important;
    top: -10px !important;
    right: -10px !important;
    background: #ff4d4f !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 26px !important;
    height: 26px !important;
    font-size: 15px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    opacity: 0 !important;
    transform: scale(0.7) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 20 !important;
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ✅ HOVER EFFECT - Shows on hover only */
.message-time:hover .delete-btn,
.message-time.me:hover .delete-btn {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* Delete button hover */
.delete-btn:hover {
    background: #ff3742 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.6) !important;
}

/* Deleting animation state */
.message.deleting .message-time {
    animation: deleteMessage 0.4s ease-out forwards !important;
}

.chat-input {
    background: #f0f0f0;
    flex-shrink: 0;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.chat-container {
    overscroll-behavior: none;
}

 .chat-container {
    max-width: 400px;
    height: 100vh;   /* fallback */
    height: 100dvh;  /* modern */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: white;
}


#msg {
    border-radius: 25px;
    border: none;
    padding: 12px 20px;
    outline: none;
    flex: 1;
    font-size: 16px;
    background: white;
         /* ✅ Same as WhatsApp */
    line-height: 1.4;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;

    white-space: pre-wrap;
    word-break: break-word;
}
.message-time.me,
.message-time.partner {
    padding: 10px 14px;   /* WhatsApp feel */
}



.chat-input button {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}
.time-text {
    font-size: 11px;
}

.tick {
    font-size: 12px;
}


#send-btn {
    background: #075e54 !important;
    color: white !important;
}

#send-btn:hover:not(:disabled) {
    background: #128c7e !important;
    transform: scale(1.05);
}

#send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* PERFECT TYPING INDICATOR */
#typing-indicator {
    padding: 8px 12px;
    margin: 8px 0;
    background: rgba(0,0,0,0.05);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #667781;
    max-width: 75%;
    align-self: flex-start;
    animation: messageSlide 0.3s ease;
}

.typing-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.typing-dots {
    display: flex;
    gap: 2px;
    height: 6px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #667781;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast-success { background: #28a745 !important; }
.toast-error { background: #dc3545 !important; }
.toast-warning { background: #ffc107 !important; color: #000 !important; }
.toast-info { background: #17a2b8 !important; }

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.4);
}

/* Document link styling */
.document-link {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.document-link:hover {
    text-decoration: underline;
}

.chat-container.disabled {
    pointer-events: none;
    filter: blur(4px);
}

.reply-box {
    background: #e9f5f3;
    border-left: 4px solid #075e54;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.reply-content small {
    color: #075e54;
    font-size: 12px;
}

.reply-content div {
    font-size: 14px;
    color: #111b21;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

#cancel-reply {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #555;
}

.reply-preview {
    font-size: 13px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: rgba(0,0,0,0.05);
    border-left: 3px solid #075e54;
    border-radius: 6px;
    color: #333;
}
/* Add to your existing style.css */
.reply-box {
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reply-content {
    flex: 1;
    padding: 4px 8px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #25D366;
}

.reply-content small {
    color: #666;
    font-weight: 500;
}

.reply-text {
    font-size: 14px;
    margin-top: 2px;
    color: #000;
    word-break: break-word;
}

.reply-preview {
    background: #f1f1f1;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    border-left: 3px solid #25D366;
}

.reply-sender {
    font-weight: 600;
    color: #25D366;
    font-size: 12px;
}

.reply-text {
    font-size: 13px;
    color: #333;
    line-height: 1.3;
}

.delete-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #ff4444;
    color: white;
}

.message.me .reply-preview {
    background: #e3f2fd;
    border-left-color: #2196F3;
}

.message.partner .reply-preview {
    background: #f1f4f6;
    border-left-color: #25D366;
}

.tick.seen {
    color: #4fc3f7 !important;
}

.tick.pending {
    color: #999;
}

/* Responsive */

    @media (max-width: 480px) {
    .chat-container 
    {
        max-width: 100%;
        height: 100dvh; /* ✅ ANDROID SAFE */
        box-shadow: none;
    }
}
