/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', -apple-system, sans-serif; background: #E5DDD5; height: 100vh; overflow: hidden; }

/* Screens */
.screen { display: none; height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ===== TERMS MODAL (WhatsApp Style) ===== */
.terms-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999; padding: 20px;
}
.terms-modal.hidden { display: none; }
.terms-box {
    background: white; max-width: 450px; width: 100%;
    border-radius: 25px; padding: 30px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.terms-box h2 { color: #075E54; text-align: center; margin-bottom: 15px; }
.terms-content { text-align: left; font-size: 14px; line-height: 1.6; color: #333; margin-bottom: 20px; }
.terms-content ul { padding-left: 20px; margin: 10px 0; }
.terms-content ul li { margin-bottom: 8px; }
.btn-agree {
    width: 100%; padding: 14px; background: #25D366; color: white;
    border: none; border-radius: 25px; font-size: 16px; font-weight: bold;
    cursor: pointer; transition: 0.3s;
}
.btn-agree:hover { background: #1da851; }

/* WhatsApp Login */
.login-screen { background: #075E54; justify-content: center; align-items: center; padding: 20px; }
.login-box { background: #fff; padding: 30px; border-radius: 20px; width: 100%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.login-box h2 { color: #075E54; text-align: center; font-size: 24px; margin-bottom: 20px; }
.login-box input { width: 100%; padding: 15px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 12px; font-size: 16px; outline: none; }
.login-box input:focus { border-color: #25D366; }
.login-btn { width: 100%; padding: 15px; background: #25D366; color: #fff; border: none; border-radius: 12px; font-size: 16px; font-weight: bold; cursor: pointer; }
.login-btn:hover { background: #20b859; }

/* Header */
.header { background: #075E54; color: #fff; padding: 15px; padding-top: 40px; display: flex; align-items: center; gap: 15px; }
.header .back-btn { font-size: 24px; cursor: pointer; }
.header .avatar { width: 40px; height: 40px; border-radius: 50%; background: #128C7E; display: flex; align-items: center; justify-content: center; font-weight: bold; color: white; flex-shrink: 0; }
.header .name { font-weight: 600; font-size: 16px; }
.header .status { font-size: 12px; opacity: 0.8; }

/* Contact List */
.contacts-screen { background: #fff; }
.contacts-list { flex: 1; overflow-y: auto; }
.contact-item { display: flex; align-items: center; padding: 12px 15px; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: 0.2s; }
.contact-item:active { background: #f0f0f0; }
.contact-item .avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; margin-right: 15px; background: #075E54; color: white; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: bold; flex-shrink: 0; }
.contact-item .info { flex: 1; }
.contact-item .name { font-weight: 600; font-size: 16px; }
.contact-item .status { font-size: 13px; color: #888; }

/* Chat Screen */
.chat-screen { background: #E5DDD5; }
.chat-messages { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; }
.msg { max-width: 75%; margin-bottom: 10px; padding: 10px 15px; border-radius: 12px; position: relative; word-wrap: break-word; }
.msg.me { background: #DCF8C6; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.other { background: #fff; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg .time { font-size: 11px; color: #888; margin-top: 4px; display: block; text-align: right; }
.msg .tick { color: #4FC3F7; font-size: 14px; margin-left: 4px; }
.msg .tick.seen { color: #34B7F1; }

/* Input Area */
.input-area { background: #f0f0f0; padding: 10px; display: flex; gap: 10px; align-items: center; border-top: 1px solid #ddd; }
.input-area input { flex: 1; padding: 12px 15px; border-radius: 25px; border: none; outline: none; font-size: 15px; }
.input-area .attach-btn { font-size: 24px; cursor: pointer; padding: 5px; }
.input-area .send-btn { width: 45px; height: 45px; border-radius: 50%; background: #25D366; color: white; border: none; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Permission Modal */
.permission-modal { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: white; padding: 20px; border-radius: 16px; box-shadow: 0 5px 20px rgba(0,0,0,0.2); display: none; max-width: 90%; text-align: center; z-index: 999; }
.permission-modal h3 { color: #075E54; margin-bottom: 10px; }
.permission-modal .btn { padding: 10px 25px; border: none; border-radius: 20px; margin: 5px; cursor: pointer; font-weight: bold; }
.permission-modal .btn-allow { background: #25D366; color: white; }
.permission-modal .btn-deny { background: #e0e0e0; color: #555; }