/* WhatsApp-like Interface with RedTip Color Scheme */
:root {
    /* RedTip Color Palette */
    --primary-red: #dc2626;
    --primary-red-dark: #b91c1c;
    --primary-red-light: #ef4444;
    --secondary-blue: #1e40af;
    --secondary-blue-dark: #1e3a8a;
    --accent-orange: #ea580c;
    --accent-green: #16a34a;
    
    /* WhatsApp-like Colors with RedTip Twist */
    --wa-primary: var(--primary-red);
    --wa-primary-dark: var(--primary-red-dark);
    --wa-bg-main: #0c0c0c;
    --wa-bg-secondary: #1f1f1f;
    --wa-bg-tertiary: #2a2a2a;
    --wa-text-primary: #ffffff;
    --wa-text-secondary: #aaaaaa;
    --wa-text-muted: #666666;
    --wa-border: #333333;
    --wa-hover: #3a3a3a;
    
    /* Message Colors */
    --wa-message-sent: var(--primary-red);
    --wa-message-received: #2a2a2a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--wa-bg-main);
    height: 100vh;
    overflow: hidden;
    color: var(--wa-text-primary);
}

/* Login Styles */
.login-body {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo h1 {
    color: var(--primary-red);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo svg path {
    fill: var(--primary-red);
}

.login-header p {
    color: #555;
    margin-bottom: 35px;
    font-size: 15px;
}

.form-group {
    position: relative;
    margin-bottom: 25px;
}

.form-group input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    font-size: 16px;
    background: #fafafa;
    color: #333;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-red);
    background: white;
    color: #333;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group input::placeholder {
    color: #888;
    opacity: 1;
}

.form-icon {
    display: none;
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.login-btn:hover {
    background: var(--primary-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background: #fee2e2;
    color: var(--primary-red);
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 14px;
    border-left: 4px solid var(--primary-red);
}

.login-footer p {
    color: #666;
    font-size: 14px;
    margin-top: 20px;
}

/* Main Chat Interface */
.chat-container {
    display: flex;
    height: 100vh;
    background: var(--wa-bg-main);
}

/* Sidebar - Exact WhatsApp Layout */
.sidebar {
    width: 405px;
    background: var(--wa-bg-secondary);
    border-right: 1px solid var(--wa-border);
    display: flex;
    flex-direction: column;
    position: relative;
}

.sidebar-header {
    background: var(--wa-bg-tertiary);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 59px;
    border-bottom: 1px solid var(--wa-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 13px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--wa-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

.avatar:hover {
    background: var(--wa-primary-dark);
}

#userInitial {
    font-size: 16px;
}

#currentUser {
    color: var(--wa-text-primary);
    font-size: 16px;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--wa-text-secondary);
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--wa-hover);
    color: var(--wa-text-primary);
}

#newChatBtn,
#settingsBtn,
#logoutBtn {
    font-size: 20px;
}

/* Search Container */
.search-container {
    padding: 9px 12px 19px 12px;
    background: var(--wa-bg-secondary);
    position: relative;
}

.new-chat-floating-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--wa-primary);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.new-chat-floating-btn:hover {
    background: var(--wa-primary-dark);
    transform: translateY(-50%) scale(1.1);
}

.search-box {
    position: relative;
    background: var(--wa-bg-main);
    border-radius: 8px;
    overflow: hidden;
    height: 35px;
}

.search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wa-text-muted);
    z-index: 1;
    font-size: 15px;
}

#searchContacts {
    width: 100%;
    padding: 8px 15px 8px 45px;
    background: transparent;
    border: none;
    color: var(--wa-text-primary);
    font-size: 14px;
    height: 100%;
}

#searchContacts::placeholder {
    color: var(--wa-text-muted);
}

#searchContacts:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--wa-primary);
}

/* Contacts List */
#contactsList {
    flex: 1;
    overflow-y: auto;
    background: var(--wa-bg-secondary);
}

.contact-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--wa-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 13px;
    height: 72px;
    animation: fadeIn 0.3s ease-out;
}

.contact-item:hover {
    background: var(--wa-hover);
}

.contact-item:hover .contact-avatar {
    transform: scale(1.05);
}

.contact-item.active {
    background: var(--wa-bg-tertiary);
}

.contact-avatar {
    width: 49px;
    height: 49px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.contact-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.contact-name {
    color: var(--wa-text-primary);
    font-size: 17px;
    font-weight: 400;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 21px;
}

.contact-last-message {
    color: var(--wa-text-secondary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 20px;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    min-width: 55px;
}

.contact-time {
    color: var(--wa-text-muted);
    font-size: 12px;
    line-height: 15px;
}

.unread-count {
    background: var(--wa-primary);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    padding: 0 6px;
}

.archived-option {
    border-top: 1px solid var(--wa-border);
    background: var(--wa-bg-main);
}

.archived-option:hover {
    background: var(--wa-hover);
}

.archived-option .contact-avatar {
    background: var(--wa-text-muted);
}

/* Connection Status */
.connection-status {
    padding: 15px 16px;
    background: var(--wa-bg-tertiary);
    border-top: 1px solid var(--wa-border);
    display: flex;
    align-items: center;
    gap: 10px;
    height: 49px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-red);
}

.status-indicator.online {
    background: #00a884; /* WhatsApp green for online */
    box-shadow: 0 0 3px rgba(0, 168, 132, 0.5);
}

.status-indicator.connecting {
    background: var(--accent-orange);
    animation: pulse 2s infinite;
}

.status-text {
    color: var(--wa-text-secondary);
    font-size: 13px;
    line-height: 15px;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--wa-bg-main);
}

/* Welcome Screen */
#chatWelcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wa-bg-main);
    padding: 40px;
}

.welcome-content {
    text-align: center;
    max-width: 500px;
}

.welcome-logo {
    margin-bottom: 30px;
    opacity: 0.7;
}

.welcome-content h2 {
    color: var(--wa-text-primary);
    font-size: 32px;
    font-weight: 300;
    margin-bottom: 15px;
}

.welcome-content p {
    color: var(--wa-text-secondary);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.new-chat-btn {
    background: var(--wa-primary);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.new-chat-btn:hover {
    background: var(--wa-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.new-chat-btn span {
    color: white;
    font-size: 18px;
}

/* Chat Window */
#chatWindow {
    flex: 1;
    display: none;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    background: var(--wa-bg-tertiary);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid var(--wa-border);
    height: 59px;
}

#mobileBackBtn {
    display: none;
    background: none;
    border: none;
    color: var(--wa-text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    margin-right: 5px;
    border-radius: 50%;
}

#mobileBackBtn:hover {
    background: var(--wa-hover);
}

.contact-info {
    display: flex;
    align-items: center;
    gap: 13px;
    flex: 1;
    cursor: pointer;
    padding: 5px 0;
    border-radius: 8px;
}

.contact-info:hover {
    background: var(--wa-hover);
}

#contactAvatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

#contactName {
    color: var(--wa-text-primary);
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 1px;
    line-height: 21px;
}

#contactStatus {
    color: var(--wa-text-secondary);
    font-size: 13px;
    line-height: 15px;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

/* Messages Container */
#messagesContainer {
    flex: 1;
    overflow-y: auto;
    padding: 10px 80px 10px 80px;
    background: var(--wa-bg-main);
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(220, 38, 38, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(30, 64, 175, 0.03) 0%, transparent 50%);
}

/* Messages */
.message {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 65%;
    animation: messageSlideIn 0.3s ease-out;
}

.message.sent {
    justify-content: flex-end;
    margin-left: auto;
    flex-direction: row-reverse;
}

.message.received .message-bubble {
    border-top-left-radius: 7.5px;
    border-bottom-left-radius: 2px;
}

.message.sent .message-bubble {
    background: var(--wa-message-sent);
    color: white;
    border-top-right-radius: 7.5px;
    border-bottom-right-radius: 2px;
}

.message-bubble {
    background: var(--wa-message-received);
    color: var(--wa-text-primary);
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    max-width: 100%;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    cursor: pointer;
}

.message-bubble:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.message.selected .message-bubble {
    background: #1a472a !important;
    box-shadow: 0 0 0 2px var(--accent-green);
}

.message-text {
    font-size: 14.2px;
    line-height: 19px;
    margin-bottom: 2px;
    word-break: break-word;
    white-space: pre-wrap;
    text-align: left;
    direction: ltr;
    user-select: text;
    -webkit-user-select: text;
}

.message.sent .message-text {
    color: rgba(255, 255, 255, 0.95);
}

.message.received .message-text {
    color: var(--wa-text-primary);
}

.message-time {
    font-size: 11px;
    color: rgba(241, 241, 242, 0.63);
    display: flex;
    align-items: center;
    gap: 3px;
    justify-content: flex-end;
    margin-top: 4px;
    float: right;
    margin-left: 4px;
}

.message.received .message-time {
    color: var(--wa-text-muted);
}

.message-status {
    font-size: 16px;
    line-height: 15px;
    margin-left: 1px;
}

.message-status.sending {
    color: rgba(241, 241, 242, 0.63);
    animation: pulse 1.5s infinite;
}

.message-status.sent {
    color: rgba(241, 241, 242, 0.63);
}

.message-status.delivered {
    color: #53bdeb;
}

.message-status.read {
    color: #53bdeb;
}

.message-status.failed {
    color: #ff5722;
}

/* Media Messages */
.message-media {
    max-width: 100%;
    border-radius: 7.5px;
    overflow: hidden;
    margin-bottom: 4px;
}

.message-media img {
    max-width: 100%;
    max-height: 350px;
    width: auto;
    height: auto;
    border-radius: 7.5px;
    display: block;
    cursor: pointer;
}

.message-media img:hover {
    transform: scale(1.02);
}

.message-document {
    background: rgba(255, 255, 255, 0.08);
    padding: 12px;
    border-radius: 7.5px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    cursor: pointer;
}

.message-document:hover {
    background: rgba(255, 255, 255, 0.12);
}

.document-icon {
    width: 40px;
    height: 40px;
    background: var(--wa-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.document-info {
    flex: 1;
}

.document-name {
    color: var(--wa-text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    line-height: 18px;
}

.document-size {
    color: var(--wa-text-secondary);
    font-size: 12px;
    line-height: 16px;
}

/* Message Input */
.message-input-container {
    background: var(--wa-bg-tertiary);
    padding: 5px 20px 5px 16px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border-top: 1px solid var(--wa-border);
    min-height: 62px;
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-bottom: 11px;
}

#attachBtn {
    background: none;
    border: none;
    color: var(--wa-text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}

#attachBtn:hover {
    background: var(--wa-hover);
}

.message-input-wrapper {
    flex: 1;
    background: var(--wa-bg-main);
    border-radius: 21px;
    display: flex;
    align-items: flex-end;
    padding: 5px 12px 5px 16px;
    min-height: 42px;
    max-height: 144px;
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--wa-text-primary);
    font-size: 15px;
    padding: 9px 0;
    line-height: 20px;
    resize: none;
    max-height: 126px;
    overflow-y: auto;
}

#messageInput::placeholder {
    color: var(--wa-text-muted);
}

#messageInput:focus {
    outline: none;
}

.send-btn, .voice-btn {
    background: var(--wa-primary);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    margin-bottom: 3px;
}

.send-btn:hover, .voice-btn:hover {
    background: var(--wa-primary-dark);
    transform: scale(1.05);
}

.voice-btn {
    background: var(--wa-text-muted);
}

.voice-btn:hover {
    background: var(--wa-text-secondary);
}

#fileInput {
    display: none;
}

/* Context Menu */
#messageContextMenu {
    background: var(--wa-bg-tertiary);
    border: 1px solid var(--wa-border);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
    min-width: 140px;
    padding: 8px 0;
    z-index: 10000;
}

.context-menu-item {
    padding: 12px 20px;
    color: var(--wa-text-primary);
    cursor: pointer;
    font-size: 14.2px;
    line-height: 19px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.context-menu-item:hover {
    background: var(--wa-hover);
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(3px);
}

.modal {
    background: var(--wa-bg-secondary);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    border: 1px solid var(--wa-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-header {
    padding: 24px 24px 20px;
    background: var(--wa-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--wa-border);
}

.modal-header h3 {
    color: var(--wa-text-primary);
    font-size: 20px;
    font-weight: 500;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--wa-text-secondary);
    font-size: 22px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    background: var(--wa-hover);
    color: var(--wa-text-primary);
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body p {
    color: var(--wa-text-primary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.modal-body ul {
    list-style: none;
    margin-bottom: 16px;
}

.modal-body li {
    padding: 12px 16px;
    color: var(--wa-text-primary);
    font-size: 14px;
    cursor: pointer;
}

.modal-body li:hover {
    background: var(--wa-hover);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--wa-text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--wa-bg-main);
    border: 1px solid var(--wa-border);
    border-radius: 8px;
    color: var(--wa-text-primary);
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--wa-primary);
    background: var(--wa-bg-main);
    color: var(--wa-text-primary);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--wa-text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

#newChatModal .form-group input,
#settingsModal .form-group input {
    font-size: 14px;
}

.settings-status {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
    display: none;
}

.settings-status.success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(22, 163, 74, 0.3);
    animation: successPulse 0.3s ease-in-out;
}

.settings-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--primary-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-footer {
    padding: 20px 24px 24px;
    background: var(--wa-bg-tertiary);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--wa-border);
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-primary {
    background: var(--wa-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--wa-primary-dark);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--wa-text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--wa-hover);
    color: var(--wa-text-primary);
}

.btn-secondary:hover {
    background: var(--wa-border);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--wa-message-received);
    border-radius: 7.5px;
    border-bottom-left-radius: 2px;
    margin-bottom: 12px;
    max-width: 65%;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--wa-text-secondary);
    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);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .sidebar {
        width: 350px;
    }
    
    #messagesContainer {
        padding: 10px 60px 10px 60px;
    }
}

@media (max-width: 768px) {
    .chat-container {
        flex-direction: row;
    }
    
    .sidebar {
        width: 100vw;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .chat-main {
        width: 100vw;
        height: 100vh;
    }
    
    #mobileBackBtn {
        display: flex;
    }
    
    .chat-header {
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    #messagesContainer {
        padding: 10px 16px 10px 16px;
    }
    
    .message {
        max-width: 80%;
    }
    
    .modal-overlay {
        width: 95%;
        margin: 10px;
    }
    
    .welcome-content h2 {
        font-size: 24px;
    }
    
    .welcome-content p {
        font-size: 14px;
    }
    
    .message-input-container {
        padding: 5px 16px 5px 16px;
    }
}

@media (max-width: 480px) {
    .sidebar-header {
        padding: 10px 16px;
    }
    
    .search-container {
        padding: 9px 12px 19px 12px;
    }
    
    .contact-item {
        padding: 12px 16px;
        height: 68px;
    }
    
    .contact-avatar {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .chat-header {
        padding: 8px 16px;
    }
    
    #contactAvatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    #messagesContainer {
        padding: 10px 12px 10px 12px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .message-input-container {
        padding: 5px 12px 5px 12px;
        min-height: 58px;
    }
    
    .message-input-wrapper {
        min-height: 38px;
    }
    
    .send-btn, .voice-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
    
    .contact-name {
        font-size: 16px;
    }
    
    .contact-last-message {
        font-size: 13px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Accessibility */
.icon-btn:focus,
.send-btn:focus,
.voice-btn:focus,
.btn-primary:focus,
.btn-secondary:focus {
    outline: 2px solid var(--wa-primary);
    outline-offset: 2px;
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}