@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 120px);
    background: #f1f5f9;
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.5;
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    background: #f8fafc;
}

.country-code {
    padding: 12px 16px;
    background: #e2e8f0;
    color: #334155;
    font-weight: 600;
    border-right: 1px solid #cbd5e1;
}

.input-group input {
    flex: 1;
    border: none;
    padding: 12px 16px;
    font-size: 16px;
    outline: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    width: 100%;
    background: #6A2F85;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #57266e;
}

/* Chat App Layout */
.chat-app-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: calc(100vh - 150px);
    margin: 24px auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* Sidebar */
.chat-sidebar {
    width: 320px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.sidebar-header {
    padding: 16px;
    background: #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.my-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.my-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6A2F85;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.my-number {
    font-weight: 600;
    color: #334155;
}

.sidebar-search {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-search input {
    width: 100%;
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: white;
    outline: none;
    font-size: 14px;
}

.contact-list {
    flex: 1;
    overflow-y: auto;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.contact-item:hover {
    background: #e2e8f0;
}

.contact-item.active {
    background: #e2e8f0;
}

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

.contact-info {
    flex: 1;
    overflow: hidden;
}

.contact-name {
    font-weight: 600;
    color: #0f172a;
    font-size: 15px;
    margin-bottom: 4px;
}

.contact-last-msg {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e2e8f0;
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23cbd5e1" fill-opacity="0.2"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    text-align: center;
}

.empty-state h3 {
    margin: 16px 0 8px;
    color: #334155;
}

.active-chat-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    gap: 16px;
}

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

.chat-header-info h3 {
    margin: 0 0 4px;
    font-size: 16px;
    color: #0f172a;
}

.chat-header-info p {
    margin: 0;
    font-size: 13px;
    color: #22c55e; /* Online green */
}

/* Messages */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg-row {
    display: flex;
    max-width: 75%;
}

.msg-row.sent {
    align-self: flex-end;
}

.msg-row.received {
    align-self: flex-start;
}

.msg-bubble {
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.msg-row.sent .msg-bubble {
    background: #dcf8c6; /* WhatsApp sent green */
    color: #0f172a;
    border-top-right-radius: 4px;
}

.msg-row.received .msg-bubble {
    background: white;
    color: #0f172a;
    border-top-left-radius: 4px;
}

.msg-time {
    display: block;
    font-size: 11px;
    color: #64748b;
    text-align: right;
    margin-top: 4px;
}

/* Chat Input */
.chat-input-area {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    background: #f1f5f9;
    gap: 12px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #e2e8f0;
}

#message-input {
    flex: 1;
    padding: 12px 20px;
    border-radius: 24px;
    border: none;
    outline: none;
    font-size: 15px;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.send-btn {
    background: #6A2F85;
    color: white;
}

.send-btn:hover {
    background: #57266e;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .chat-app-container {
        flex-direction: column;
        height: calc(100vh - 120px);
        margin: 10px;
        width: calc(100% - 20px);
    }
    .chat-sidebar {
        width: 100%;
        max-height: 40%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    .chat-main {
        max-height: 60%;
    }
    .auth-card {
        padding: 24px;
        margin: 0 16px;
    }
}

@media (max-width: 480px) {
    .sidebar-header {
        flex-direction: column;
        gap: 10px;
    }
    .chat-header {
        padding: 8px 12px;
    }
    .chat-input-area {
        padding: 8px 12px;
        flex-direction: column;
    }
    .msg-bubble {
        font-size: 13px;
    }
    #message-input {
        width: 100%;
    }
    .btn-icon {
        padding: 6px;
    }
}
