:root {
    --primary: #00a884; /* Hijau WhatsApp */
    --primary-dark: #008069;
    --bg-dark: #0b141a;
    --bg-card: #111b21;
    --text: #e9edef;
    --chat-me: #005c4b;
    --chat-them: #202c33;
    --danger: #f15c5c;
    --gray-text: #8696a0;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100dvh; display: flex; flex-direction: column;
    background-color: var(--bg-dark); color: var(--text); overflow: hidden;
}

/* Header & Tabs */
.app-header { background: var(--bg-card); z-index: 100; border-bottom: 1px solid #222d34; }
.header-top { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 1.2rem; font-weight: 700; color: var(--gray-text); letter-spacing: 0.5px; }

.tab-bar { display: flex; height: 45px; }
.tab-item { 
    flex: 1; display: flex; align-items: center; justify-content: center; 
    font-size: 0.85rem; font-weight: 600; color: var(--gray-text); 
    text-transform: uppercase; cursor: pointer; border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Pages */
main { flex: 1; position: relative; overflow: hidden; }
.page { position: absolute; inset: 0; display: none; flex-direction: column; opacity: 0; transition: opacity 0.3s; }
.page.active { display: flex; opacity: 1; }

/* Contact List */
.contact-scroll { flex: 1; padding: 10px 0; overflow-y: auto; }
.user-card { 
    padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; 
    border-bottom: 1px solid #222d34; transition: background 0.2s;
}
.user-card:active { background: #202c33; }
.user-info { display: flex; align-items: center; gap: 12px; }
.avatar { width: 45px; height: 45px; background: #6a7175; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }

/* Chat UI */
.message-container { 
    flex: 1; padding: 15px; overflow-y: auto; 
    background-color: #0b141a;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-blend-mode: overlay;
    display: flex; flex-direction: column; gap: 4px;
}
.msg { 
    max-width: 85%; padding: 8px 12px; border-radius: 8px; font-size: 0.95rem; 
    line-height: 1.4; position: relative; color: white; word-wrap: break-word;
}
.msg.me { align-self: flex-end; background: var(--chat-me); border-top-right-radius: 0; }
.msg.them { align-self: flex-start; background: var(--chat-them); border-top-left-radius: 0; }

.chat-bar { padding: 10px; background: var(--bg-card); display: flex; gap: 8px; align-items: center; }
.chat-bar input { 
    flex: 1; padding: 10px 15px; border-radius: 20px; border: none; 
    background: #2a3942; color: white; outline: none; font-size: 1rem;
}

/* Video Engine */
.video-wrapper { flex: 1; background: #000; position: relative; overflow: hidden; }
#remote-video { width: 100%; height: 100%; object-fit: cover; }
#local-video { 
    width: 100px; height: 140px; position: absolute; top: 20px; right: 20px; 
    border-radius: 12px; border: 1px solid rgba(255,255,255,0.2); object-fit: cover; z-index: 10;
}

.call-overlay { 
    position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 20px; z-index: 100; padding: 15px 25px;
    background: rgba(0,0,0,0.5); border-radius: 40px; backdrop-filter: blur(10px);
}
.call-overlay button { 
    width: 50px; height: 50px; border-radius: 50%; border: none; 
    color: white; cursor: pointer; font-size: 0.7rem; font-weight: bold;
}
.btn-active { background: #344751; }
.btn-inactive { background: var(--danger); }
.btn-end { background: var(--danger); transform: scale(1.1); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: var(--bg-dark); z-index: 9999; display: none; align-items: center; justify-content: center; }
.modal-card { background: var(--bg-card); padding: 30px; border-radius: 16px; width: 85%; max-width: 350px; text-align: center; }
