* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}
.login-page {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 50%, #075E54 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-box {
    background: white;
    border-radius: 16px;
    padding: 45px 35px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 35px; }
.login-logo i { font-size: 56px; color: #25D366; }
.login-logo h1 { color: #1a1a1a; font-size: 26px; margin-top: 12px; font-weight: 700; }
.login-logo p { color: #888; font-size: 14px; margin-top: 6px; }

.form-group { margin-bottom: 22px; }
.form-group label { display: block; margin-bottom: 8px; color: #555; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input {
    width: 100%; padding: 14px 16px;
    border: 2px solid #e8e8e8; border-radius: 10px;
    font-size: 15px; outline: none;
    transition: all 0.3s ease;
}
.form-group input:focus { border-color: #25D366; box-shadow: 0 0 0 3px rgba(37,211,102,0.1); }
.btn-login {
    width: 100%; padding: 15px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white; border: none; border-radius: 10px;
    font-size: 16px; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37,211,102,0.3);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,211,102,0.4); }
.error-message {
    background: #fff0f0; color: #d32f2f; padding: 12px 16px;
    border-radius: 10px; margin-bottom: 16px; font-size: 14px;
    border-left: 4px solid #d32f2f;
}

.app-container { display: flex; height: 100vh; width: 100vw; }
.sidebar {
    width: 380px; min-width: 380px; max-width: 380px;
    background: white; border-right: 1px solid #e0e0e0;
    display: flex; flex-direction: column; height: 100vh;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}
.sidebar-header {
    display: flex; align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white; gap: 12px;
}
.sidebar-header i { font-size: 26px; }
.sidebar-header span { font-size: 17px; font-weight: 700; flex: 1; letter-spacing: 0.3px; }
.header-actions { display: flex; gap: 4px; }
.header-actions button {
    background: rgba(255,255,255,0.15); border: none;
    color: white; font-size: 14px; cursor: pointer;
    padding: 8px 10px; border-radius: 8px;
    transition: all 0.2s;
}
.header-actions button:hover { background: rgba(255,255,255,0.3); }

.stats-bar {
    display: flex; padding: 8px 15px;
    background: #f8f9fa; border-bottom: 1px solid #e0e0e0;
    gap: 12px;
}
.stat-item {
    font-size: 11px; color: #666;
    display: flex; align-items: center; gap: 4px;
}
.stat-item .stat-dot {
    width: 8px; height: 8px; border-radius: 50%;
}
.stat-dot.green { background: #25D366; }
.stat-dot.orange { background: #FFA726; }
.stat-dot.blue { background: #42A5F5; }
.search-bar {
    display: flex; align-items: center;
    padding: 10px 15px; background: #f6f6f6;
    border-bottom: 1px solid #e0e0e0;
}
.search-bar i { color: #999; margin-right: 10px; }
.search-bar input {
    flex: 1; border: none; background: white;
    padding: 10px 14px; border-radius: 24px;
    font-size: 14px; outline: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.conversation-list { flex: 1; overflow-y: auto; }
.conversation-item {
    display: flex; align-items: center;
    padding: 14px 15px; cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.15s ease;
}
.conversation-item:hover { background: #f0f7f0; }
.conversation-item.active { background: #e8f5e9; border-left: 3px solid #25D366; }
.contact-avatar {
    width: 48px; height: 48px; min-width: 48px;
    border-radius: 50%; background: linear-gradient(135deg, #25D366, #128C7E);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 600; margin-right: 12px;
    box-shadow: 0 2px 8px rgba(37,211,102,0.3);
}
.conversation-info { flex: 1; min-width: 0; }
.conversation-info h4 {
    font-size: 14.5px; color: #1a1a1a; margin-bottom: 3px;
    font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-info p {
    font-size: 13px; color: #8a8a8a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-meta { text-align: right; margin-left: 10px; white-space: nowrap; }
.conversation-meta .time { font-size: 11px; color: #999; white-space: nowrap; }
.loading { text-align: center; padding: 30px; color: #999; }

.chat-area {
    flex: 1; display: flex; flex-direction: column;
    background: #e5ddd5; height: 100vh; overflow: hidden;
}
.no-chat-selected {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 100%; color: #999; background: #f0f2f5;
}
.no-chat-selected i { font-size: 80px; margin-bottom: 20px; color: #d4d4d4; }
.no-chat-selected h2 { font-size: 24px; color: #555; margin-bottom: 8px; font-weight: 300; }
.no-chat-selected p { font-size: 14px; color: #999; }
.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px; background: white;
    border-bottom: 1px solid #e0e0e0; min-height: 64px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.chat-contact-info { display: flex; align-items: center; }
.chat-contact-info .contact-avatar {
    width: 42px; height: 42px; min-width: 42px;
    font-size: 16px; margin-right: 14px;
}
.contact-details h3 { font-size: 15px; color: #1a1a1a; font-weight: 600; }
.contact-details p { font-size: 12px; color: #25D366; }
.chat-header-actions button {
    background: none; border: none;
    font-size: 18px; color: #666; cursor: pointer;
    padding: 8px 10px; border-radius: 8px;
    transition: all 0.2s;
}
.chat-header-actions button:hover { background: #f0f0f0; }

.messages-container { flex: 1; overflow-y: auto; padding: 20px; }
.messages-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.message-bubble {
    max-width: 55%; min-width: 140px;
    padding: 8px 12px 6px 12px; border-radius: 10px;
    font-size: 14.5px; line-height: 1.5;
    word-wrap: break-word; white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.message-bubble.incoming {
    background: white; align-self: flex-start;
    border-top-left-radius: 0;
}
.message-bubble.outgoing {
    background: #d9fdd3; align-self: flex-end;
    border-top-right-radius: 0;
}
.message-text { margin-bottom: 4px; }
.message-time {
    font-size: 11px; color: #999;
    text-align: right; white-space: nowrap;
    display: flex; justify-content: flex-end;
    align-items: center; gap: 4px;
}

.message-input-area {
    padding: 12px 20px; background: white;
    border-top: 1px solid #e0e0e0;
}
.input-container { display: flex; align-items: flex-end; gap: 12px; }
.input-container textarea {
    flex: 1; padding: 12px 18px;
    border: 2px solid #e8e8e8; border-radius: 24px;
    font-size: 15px; resize: none; outline: none;
    max-height: 120px; line-height: 1.4;
    transition: border-color 0.2s;
}
.input-container textarea:focus { border-color: #25D366; }
.input-container button {
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white; border: none; font-size: 18px;
    cursor: pointer; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37,211,102,0.3);
    transition: all 0.2s;
}
.input-container button:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(37,211,102,0.4); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

.sidebar-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}
.user-info {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: #555;
}
.user-info i { font-size: 22px; color: #25D366; }
.sidebar-footer button {
    background: none; border: none; color: #999;
    font-size: 16px; cursor: pointer; padding: 6px 8px;
    border-radius: 6px; transition: all 0.2s;
}
.sidebar-footer button:hover { background: #eee; color: #d32f2f; }

.quick-reply-panel {
    background: white; border-top: 1px solid #e0e0e0;
    max-height: 200px; overflow-y: auto;
}
.qr-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; background: #f8f9fa;
    border-bottom: 1px solid #eee; font-weight: 600; font-size: 14px;
}
.qr-header button {
    background: none; border: none; font-size: 16px;
    color: #999; cursor: pointer;
}
.qr-list { padding: 6px 0; }
.qr-item {
    padding: 10px 16px; cursor: pointer;
    font-size: 14px; color: #333;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}
.qr-item:hover { background: #e8f5e9; }
.qr-item .qr-shortcut {
    font-size: 11px; color: #25D366;
    font-weight: 600; margin-right: 8px;
}
.input-icon-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: #f0f0f0; border: none; color: #666;
    font-size: 16px; cursor: pointer; flex-shrink: 0;
    transition: all 0.2s;
}
.input-icon-btn:hover { background: #e0e0e0; color: #25D366; }

.contact-panel {
    width: 320px; min-width: 320px; max-width: 320px;
    background: white; border-left: 1px solid #e0e0e0;
    display: flex; flex-direction: column; height: 100vh;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
}
.cp-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
}
.cp-header h3 { font-size: 16px; font-weight: 600; }
.cp-header button {
    background: rgba(255,255,255,0.2); border: none;
    color: white; font-size: 14px; cursor: pointer;
    padding: 6px 10px; border-radius: 6px;
}
.cp-body {
    flex: 1; overflow-y: auto; padding: 24px 20px;
    text-align: center;
}
.cp-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 600; margin: 0 auto 12px;
    box-shadow: 0 4px 12px rgba(37,211,102,0.3);
}
.cp-body h3 { font-size: 18px; color: #1a1a1a; margin-bottom: 4px; }
.cp-body > p { font-size: 14px; color: #25D366; margin-bottom: 24px; }

.cp-section {
    text-align: left; margin-bottom: 20px;
    padding: 16px; background: #f8f9fa;
    border-radius: 10px;
}
.cp-section h4 {
    font-size: 13px; color: #25D366; font-weight: 600;
    margin-bottom: 12px; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cp-section h4 i { margin-right: 6px; }
.cp-field {
    display: flex; justify-content: space-between;
    align-items: center; padding: 8px 0;
    border-bottom: 1px solid #eee; font-size: 13px;
}
.cp-field:last-child { border-bottom: none; }
.cp-field span:first-child { color: #888; }
.cp-field span:last-child { color: #333; font-weight: 500; }
.status-badge {
    padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
    background: #FFF3E0; color: #F57C00;
}
.cp-tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: #888; }
.cp-section textarea {
    width: 100%; padding: 10px; border: 1px solid #e0e0e0;
    border-radius: 8px; font-size: 13px; resize: vertical;
    min-height: 60px; outline: none; font-family: inherit;
}
.cp-section textarea:focus { border-color: #25D366; }
