:root {
    --primary: #075e54;
    --secondary: #128c7e;
    --accent: #25d366;
    --bg: #e5ddd5;
    --chat-bg: #efeae2;
    --white: #ffffff;
    --text: #111b21;
    --gray: #667781;
    --sent: #dcf8c6;
    --received: #ffffff;
}

[data-theme="dark"] {
    --primary: #1f2c34;
    --secondary: #2a3942;
    --accent: #00a884;
    --bg: #0b141a;
    --chat-bg: #0b141a;
    --white: #1f2c34;
    --text: #e9edef;
    --gray: #8696a0;
    --sent: #005c4b;
    --received: #1f2c34;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
html, body { height: 100%; overflow: hidden; }
.hidden { display: none !important; }

#splash-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--primary); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; color: white;
}
.splash-icon { font-size: 100px; margin-bottom: 20px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.loading-bar { width: 200px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; margin-top: 30px; }
.progress { width: 30%; height: 100%; background: white; animation: slide 2s infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

#auth-screen { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--white); padding: 20px; }
.auth-box { text-align: center; width: 100%; max-width: 400px; }
.auth-logo { font-size: 80px; color: var(--accent); margin-bottom: 20px; }
.auth-tabs { display: flex; gap: 10px; margin: 30px 0; justify-content: center; }
.tab-btn { padding: 10px 30px; border: none; background: transparent; color: var(--gray); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--accent); }
input { width: 100%; padding: 15px; margin: 10px 0; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; }
.btn-primary { width: 100%; padding: 15px; background: var(--accent); color: white; border: none; border-radius: 25px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 20px; }

#main-app { height: 100vh; display: flex; flex-direction: column; background: var(--white); }
.app-header { background: var(--primary); color: white; padding: 0 15px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.app-title { font-size: 20px; font-weight: 600; }
.header-actions { display: flex; gap: 15px; }
.header-actions button { background: none; border: none; color: white; font-size: 20px; cursor: pointer; width: 40px; height: 40px; }

.search-bar { padding: 10px 15px; background: var(--primary); display: flex; gap: 10px; }
.search-bar input { flex: 1; border: none; border-radius: 20px; padding: 10px 15px; }
.search-bar button { background: none; border: none; color: white; font-size: 20px; }

.tabs { display: flex; background: var(--primary); color: rgba(255,255,255,0.8); }
.tab { flex: 1; padding: 15px; text-align: center; cursor: pointer; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; position: relative; }
.tab.active { color: white; border-bottom-color: var(--accent); }
.badge { position: absolute; top: 10px; right: 30%; background: white; color: var(--primary); font-size: 10px; padding: 2px 6px; border-radius: 10px; }

.content { flex: 1; overflow-y: auto; position: relative; }
.panel { display: none; height: 100%; }
.panel.active { display: block; }

.chat-item { display: flex; padding: 15px; border-bottom: 1px solid #eee; cursor: pointer; align-items: center; }
.chat-item:hover { background: var(--bg); }
.avatar { width: 50px; height: 50px; border-radius: 50%; background: var(--secondary); margin-right: 15px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: white; }
.chat-info { flex: 1; }
.chat-header { display: flex; justify-content: space-between; margin-bottom: 5px; }
.name { font-weight: 600; font-size: 16px; }
.time { font-size: 13px; color: var(--accent); }
.preview { color: var(--gray); font-size: 14px; display: flex; align-items: center; gap: 5px; }
.preview i { font-size: 12px; color: var(--secondary); }

.fab { position: fixed; bottom: 20px; right: 20px; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: white; border: none; font-size: 24px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; z-index: 100; }

.fullscreen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--chat-bg); z-index: 1000; display: flex; flex-direction: column; }
.chat-header { background: var(--primary); color: white; padding: 10px 15px; display: flex; align-items: center; gap: 15px; height: 60px; }
.chat-header button { background: none; border: none; color: white; font-size: 20px; cursor: pointer; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.chat-header .avatar { width: 40px; height: 40px; }
.chat-info { flex: 1; }
.chat-info .name { color: white; font-weight: 600; }
.chat-info .status { font-size: 13px; opacity: 0.8; color: white; }

.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400"><rect fill="%23efeae2" width="400" height="400"/><path fill="%23000" fill-opacity="0.03" d="M0 0h400v400H0z"/></svg>'); }
.encryption-notice { text-align: center; color: var(--gray); font-size: 12px; margin-bottom: 20px; background: rgba(255,255,255,0.8); padding: 5px 12px; border-radius: 4px; align-self: center; }
.message { max-width: 75%; padding: 8px 12px; margin-bottom: 8px; border-radius: 8px; position: relative; word-wrap: break-word; box-shadow: 0 1px 2px rgba(0,0,0,0.1); animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message.sent { background: var(--sent); align-self: flex-end; border-bottom-right-radius: 0; }
.message.received { background: var(--received); align-self: flex-start; border-bottom-left-radius: 0; }
.message-text { font-size: 14px; line-height: 1.4; margin-bottom: 4px; }
.message-time { font-size: 11px; color: var(--gray); text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.message-time i { color: var(--secondary); font-size: 12px; }

.input-area { padding: 10px 15px; background: var(--bg); display: flex; gap: 10px; align-items: center; }
.input-area button { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--secondary); color: white; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.input-area input { flex: 1; padding: 12px 15px; border: none; border-radius: 25px; font-size: 15px; outline: none; }
#send-btn { background: var(--accent); }

.attach-menu { position: absolute; bottom: 80px; left: 20px; background: white; border-radius: 15px; padding: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); display: flex; gap: 20px; z-index: 100; }
.attach-menu div { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--gray); width: 60px; }
.attach-menu div i { width: 50px; height: 50px; border-radius: 50%; background: var(--secondary); color: white; display: flex; align-items: center; justify-content: center; font-size: 20px; }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; display: flex; align-items: flex-end; }
.modal-content { width: 100%; background: var(--white); border-radius: 20px 20px 0 0; max-height: 80vh; overflow-y: auto; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { padding: 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--white); }
.modal-header button { background: none; border: none; font-size: 24px; color: var(--gray); cursor: pointer; }
.settings-list { padding: 10px 0; }
.setting-item { display: flex; align-items: center; padding: 15px 20px; cursor: pointer; gap: 20px; border-bottom: 1px solid #eee; }
.setting-item:hover { background: var(--bg); }
.setting-item i { width: 45px; height: 45px; border-radius: 50%; background: var(--secondary); color: white; display: flex; align-items: center; justify-content: center; font-size: 20px; }

.my-status { display: flex; padding: 20px; border-bottom: 1px solid #eee; cursor: pointer; align-items: center; }
.my-status .camera { position: relative; }
.my-status .camera::after { content: '+'; position: absolute; bottom: 0; right: 0; background: var(--accent); color: white; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; border: 2px solid white; }
.sub { color: var(--gray); font-size: 14px; }

.lock-content { text-align: center; padding: 40px; color: white; margin-top: 100px; }
.lock-content input { width: 200px; padding: 20px; font-size: 32px; text-align: center; letter-spacing: 20px; border: 2px solid white; border-radius: 10px; background: transparent; color: white; margin: 30px 0; outline: none; }
.lock-content button { padding: 15px 40px; background: var(--accent); color: white; border: none; border-radius: 25px; font-size: 16px; cursor: pointer; }

@media (min-width: 768px) { #main-app, .fullscreen { max-width: 450px; margin: 0 auto; box-shadow: 0 0 20px rgba(0,0,0,0.2); } }
