/* WhatsApp Chat Interface Styles */
/* ============================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #00a884 0%, #1a2b3c 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* WhatsApp Container */
.whatsapp-container {
    width: 100%;
    max-width: 500px;
    height: 90vh;
    background: #0c1317;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* Chat Header (Green bar) */
.chat-header {
    background: #202c33;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a3942;
}

.contact-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #00a884, #25d366);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.contact-details h2 {
    color: #e9edef;
    font-size: 18px;
    font-weight: 500;
}

.status {
    color: #8696a0;
    font-size: 13px;
    margin-top: 3px;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #aebac1;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #0c1317;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%231d2b2e' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #374045;
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    margin-bottom: 20px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.sent {
    margin-left: auto;
}

.message.received {
    margin-right: auto;
}

.message-content {
    padding: 12px 16px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
}

.message.sent .message-content {
    background: #005c4b;
    color: #e9edef;
    border-top-right-radius: 0;
}

.message.received .message-content {
    background: #202c33;
    color: #e9edef;
    border-top-left-radius: 0;
}

.message-content p {
    margin-bottom: 5px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    margin-top: 5px;
    text-align: right;
}

.message.received .message-time {
    text-align: left;
}

/* Message Input Area */
.message-input-area {
    background: #202c33;
    padding: 15px 20px;
    border-top: 1px solid #2a3942;
}

.input-container {
    display: flex;
    align-items: center;
    background: #2a3942;
    border-radius: 25px;
    padding: 5px 15px;
}

.input-container input {
    flex: 1;
    background: transparent;
    border: none;
    color: #e9edef;
    font-size: 16px;
    padding: 12px;
    outline: none;
}

.input-container input::placeholder {
    color: #8696a0;
}

.emoji-btn {
    margin-right: 5px;
}

.send-btn {
    background: #00a884;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 10px;
}

.send-btn:hover {
    background: #06cf9c;
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Chat Footer */
.chat-footer {
    background: #202c33;
    padding: 10px 20px;
    text-align: center;
    border-top: 1px solid #2a3942;
    font-size: 12px;
    color: #8696a0;
}

.chat-footer p {
    margin: 3px 0;
}

#connectionStatus {
    color: #25d366;
    font-weight: bold;
}

#portNumber {
    color: #00a884;
    font-weight: bold;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    background: #202c33;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #2a3942;
    border-top: 4px solid #00a884;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 15px;
    background: #202c33;
    border-radius: 8px;
    width: fit-content;
    margin-bottom: 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #8696a0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Responsive Design */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .whatsapp-container {
        height: 95vh;
        border-radius: 10px;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .message-input-area {
        padding: 12px 15px;
    }
    
    .message {
        max-width: 90%;
    }
}

@media (max-width: 400px) {
    .contact-details h2 {
        font-size: 16px;
    }
    
    .status {
        font-size: 11px;
    }
    
    .input-container input {
        font-size: 14px;
        padding: 10px;
    }
}s