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

/* --- RESET & BASIC --- */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }

body, html {
    width: 100%; height: 100%; 
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: #f8fafc; color: #1e293b;
    overflow: hidden; /* Mencegah scroll halaman global */
}

/* Helper Class */
.hidden { display: none !important; }

/* --- LOGIN PAGE (PREMIUM DESIGN) --- */
#auth-page {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    z-index: 999; padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    width: 100%; max-width: 400px;
    padding: 40px 30px; border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

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

.login-header i { font-size: 3.5rem; color: #6366f1; display: inline-block; margin-bottom: 10px; }
.login-header h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 5px; color: #1e293b; }
.login-header p { color: #64748b; margin-bottom: 30px; font-size: 0.95rem; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 8px; margin-left: 5px; }
.input-box {
    width: 100%; padding: 14px 16px; border: 2px solid #e2e8f0;
    border-radius: 12px; font-size: 1rem; transition: all 0.3s;
    background: #f8fafc; color: #334155;
}
.input-box:focus { border-color: #6366f1; background: #fff; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }

.domain-badge {
    display: block; text-align: right; font-size: 0.8rem; 
    color: #6366f1; font-weight: 600; margin-top: 5px; margin-right: 5px;
}

.btn-auth {
    width: 100%; padding: 16px; border: none; border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white; font-weight: 700; font-size: 1rem; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}
.btn-auth:active { transform: scale(0.98); }

.toggle-text { margin-top: 20px; font-size: 0.9rem; color: #64748b; cursor: pointer; }
.toggle-text span { color: #6366f1; font-weight: 600; text-decoration: underline; }

/* --- APP LAYOUT (MAIN) --- */
#app-layout {
    display: flex; width: 100%; height: 100%;
    background: #fff; overflow: hidden; position: relative;
}

/* SIDEBAR (Contacts) */
.sidebar {
    width: 350px; height: 100%; background: #fff; border-right: 1px solid #e2e8f0;
    display: flex; flex-direction: column; z-index: 10;
}
.app-header {
    height: 70px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
    background: #fff; border-bottom: 1px solid #f1f5f9; flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

.contact-list { flex: 1; overflow-y: auto; padding: 10px; }
.contact-item {
    display: flex; align-items: center; padding: 12px; border-radius: 12px;
    cursor: pointer; transition: 0.2s; gap: 12px; border-bottom: 1px solid transparent;
}
.contact-item:hover { background: #f8fafc; }
.contact-item:active { background: #eff6ff; }
.c-details { flex: 1; min-width: 0; }
.c-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.c-name { font-weight: 600; font-size: 0.95rem; color: #1e293b; }
.c-time { font-size: 0.75rem; color: #94a3b8; }
.c-email { font-size: 0.8rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fab-add {
    width: 100%; margin: 10px 0; padding: 12px; background: #eff6ff; color: #6366f1;
    border: 1px dashed #6366f1; border-radius: 12px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* CHAT AREA (RESPONSIVE MAGIC) */
.chat-view {
    flex: 1; display: flex; flex-direction: column; background: #f1f5f9;
    position: relative; height: 100%;
}

.chat-header {
    height: 70px; background: #fff; border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; padding: 0 15px; gap: 10px; flex-shrink: 0; z-index: 20;
}

.messages-area {
    flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px); background-size: 20px 20px;
}

/* Pesan */
.msg { display: flex; flex-direction: column; max-width: 75%; animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.msg.sent { align-self: flex-end; align-items: flex-end; }
.msg.received { align-self: flex-start; align-items: flex-start; }

.bubble {
    padding: 10px 16px; border-radius: 18px; font-size: 0.95rem; line-height: 1.5;
    position: relative; box-shadow: 0 2px 4px rgba(0,0,0,0.05); word-wrap: break-word;
}
.sent .bubble { background: #6366f1; color: white; border-bottom-right-radius: 4px; }
.received .bubble { background: #fff; color: #1e293b; border-bottom-left-radius: 4px; }
.msg-time { font-size: 0.7rem; margin-top: 4px; opacity: 0.7; padding: 0 4px; }
.msg-img { max-width: 200px; border-radius: 10px; border: 2px solid white; margin-top: 5px; cursor: pointer; }

/* INPUT AREA (Fix Bottom) */
.input-area {
    background: #fff; padding: 10px 15px; border-top: 1px solid #e2e8f0;
    display: flex; flex-direction: column; gap: 10px; flex-shrink: 0;
}
.preview-box { height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; }
.preview-box img { height: 40px; border-radius: 4px; }

.input-row { display: flex; align-items: center; gap: 10px; }
.chat-input {
    flex: 1; padding: 12px 15px; border-radius: 24px; border: 1px solid #e2e8f0;
    background: #f8fafc; font-size: 0.95rem;
}
.chat-input:focus { border-color: #6366f1; background: #fff; }
.btn-icon { background: none; border: none; font-size: 1.3rem; color: #64748b; cursor: pointer; padding: 5px; }
.btn-send {
    width: 45px; height: 45px; border-radius: 50%; background: #6366f1; color: white;
    border: none; display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
    cursor: pointer; box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3); transition: 0.2s;
}
.btn-send:active { transform: scale(0.9); }

/* --- RESPONSIVE LOGIC (MOBILE) --- */
.btn-back { display: none; margin-right: 5px; font-size: 1.4rem; color: #1e293b; background: none; border: none; cursor: pointer; }

@media (max-width: 768px) {
    .sidebar { width: 100%; position: absolute; z-index: 1; }
    
    /* Chat View tersembunyi di kanan (default) */
    .chat-view {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 50;
        transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: #f1f5f9;
    }
    
    /* Saat chat aktif, geser masuk */
    .chat-view.active { transform: translateX(0); }
    
    .btn-back { display: block; }
}
/* Tambahkan di bagian Login Page Style atau paling bawah */

.stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff; /* Biru sangat muda */
    color: #6366f1;       /* Warna Primary */
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 25px;
    border: 1px solid #e0e7ff;
    animation: fadeIn 1s ease;
}

.stats-badge i {
    font-size: 1rem !important;
    margin: 0 !important; /* Reset margin icon header */
    color: #6366f1 !important;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
