body, html { margin: 0; padding: 0; height: 100%; font-family: -apple-system, sans-serif; background-color: #e5ddd5; overflow: hidden; }
#app-container { display: flex; flex-direction: row; height: 100vh; height: 100dvh; width: 100vw; position: relative; }
#sidebar { width: 340px; background-color: white; border-right: 1px solid #ddd; display: flex; flex-direction: column; z-index: 10; }
.sidebar-header { background-color: #f0f2f5; padding: 10px 15px; height: 50px; display: flex; justify-content: space-between; align-items: center; }
.sidebar-icons { display: flex; gap: 10px; }
.sidebar-icons button { position: relative; background: none; border: none; font-size: 1.3em; cursor: pointer; color: #54656f; padding: 0; transition: color 0.2s;}
.sidebar-icons button:hover { color: #111; }
.icon-badge { background: #e53935; color: white; border-radius: 10px; font-size: 0.55em; padding: 2px 5px; position: absolute; top: -6px; right: -8px; font-weight: bold; pointer-events: none;}
.chat-filters { display: flex; gap: 8px; padding: 10px 15px; background: white; border-bottom: 1px solid #ddd; overflow-x: auto; flex-wrap: wrap; }
.filter-btn { flex-shrink: 0; background: #f0f2f5; border: none; padding: 6px 12px; border-radius: 15px; color: #54656f; cursor: pointer; font-size: 0.9em; white-space: nowrap; }
.filter-btn.active { background: #dcf8c6; color: #111; font-weight: bold; }
#contact-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
.contact { display: flex; align-items: center; padding: 12px 15px; cursor: pointer; border-bottom: 1px solid #f2f2f2; position: relative; }
.contact:hover { background-color: #f5f6f6; }
.contact.active { background-color: #f0f2f5; }
.contact-info { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; overflow: hidden;}
.contact-name { font-weight: bold; font-size: 1.1em; display: flex; align-items: center; margin: 0; }
.fav-star { color: #f5b400; margin-left: 5px; font-size: 0.8em; }
.unread-badge { background-color: #25d366; color: white; border-radius: 12px; padding: 2px 7px; font-size: 0.8em; font-weight: bold; min-width: 12px; text-align: center; margin-left: auto; display: inline-block; }
.avatar-img { width: 45px; height: 45px; border-radius: 50%; background-size: cover; background-position: center; display: flex; justify-content: center; align-items: center; font-weight: bold; color: white; margin-right: 12px; font-size: 1.2em; flex-shrink: 0; }
#chat-area { flex: 1; display: flex; flex-direction: column; background-color: #e5ddd5; width: 100%; }
#chat-header { background-color: #f0f2f5; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; height: 50px; border-bottom: 1px solid #ddd; }
.user-info { display: flex; align-items: center; }
.user-details { display: flex; flex-direction: column; }
.chat-name { font-weight: bold; font-size: 1.1em; color: #111; }
.chat-status { font-size: 0.8em; color: #667781; transition: color 0.3s; }
.chat-status.active-typing { color: #00a884; font-weight: bold; }
.chat-status.active-recording { color: #e53935; font-weight: bold; }
.private-badge { font-size: 0.7em; background: #e0e0e0; padding: 2px 5px; border-radius: 5px; margin-left: 8px; color: #555;}
.header-icons { display: flex; gap: 15px; font-size: 1.4em; cursor: pointer; color: #54656f; font-weight: bold;}
.header-icons span { transition: color 0.2s; }
.header-icons span:hover { color: #00a884; }
#messages-container { flex: 1; overflow-y: scroll; padding: 20px; display: flex; flex-direction: column-reverse; }
#messages { list-style-type: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
#messages li { padding: 8px 12px; margin-bottom: 8px; border-radius: 8px; max-width: 70%; word-wrap: break-word; display: flex; flex-direction: column; box-shadow: 0 1px 1px rgba(0,0,0,0.1); position: relative; }
.message-user { font-size: 0.75em; font-weight: bold; margin-bottom: 3px; }
.message-content { font-size: 0.95em; }
.message-content img { max-width: 100%; max-height: 300px; border-radius: 8px; margin-top: 5px; display: block; }
.message-content audio { max-width: 100%; margin-top: 5px; height: 40px; outline: none; }
.message-content a { color: #0275d8; text-decoration: none; font-weight: bold; display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.message-content a:hover { text-decoration: underline; }
#messages li.incoming { align-self: flex-start; background-color: white; border-top-left-radius: 0; }
#messages li.incoming .message-user { color: #e53935; }
#messages li.outgoing { align-self: flex-end; background-color: #dcf8c6; border-top-right-radius: 0; }
#form { background-color: #f0f0f0; padding: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; min-height: 50px; gap: 8px; position: relative; z-index: 10;}
#attachment-btn, #record-btn { background-color: transparent; color: #54656f; border: none; font-size: 1.4em; cursor: pointer; padding: 5px; transition: color 0.2s, transform 0.2s; }
#gif-btn { background-color: transparent; color: #54656f; border: none; font-size: 1.1em; font-weight: bold; font-family: sans-serif; cursor: pointer; padding: 5px; transition: color 0.2s; }
#attachment-btn:hover, #record-btn:hover, #gif-btn:hover { color: #111; }
#record-btn.recording { color: #e53935; animation: micPulse 1.5s infinite; }
@keyframes micPulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
#gif-results { display: flex; flex-wrap: wrap; gap: 5px; height: 300px; overflow-y: auto; justify-content: space-between; }
.gif-item { width: 32%; height: 90px; object-fit: cover; cursor: pointer; border-radius: 5px; background-color: #f0f0f0; transition: transform 0.1s; }
.gif-item:hover { transform: scale(1.05); }
.input-wrapper { background-color: white; border-radius: 8px; flex: 1; display: flex; align-items: center; padding: 0 10px; height: 40px; }
#input { border: none; padding: 10px; flex: 1; font-size: 1em; outline: none; }
#input:disabled { background: #f0f0f0; color: #888; }
#send-btn { background-color: white; color: #54656f; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 1.3em; cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,0.1); flex-shrink: 0; }
#recording-ui { flex: 1; justify-content: center; align-items: center; gap: 15px; background-color: white; border-radius: 8px; padding: 0 15px; height: 40px; box-sizing: border-box; box-shadow: inset 0 0 5px rgba(0,0,0,0.05); }
#recording-dot { color: #e53935; font-size: 1.2em; font-weight: bold; animation: blink 1s infinite; }
#record-time { color: #54656f; font-weight: bold; font-variant-numeric: tabular-nums; min-width: 45px; }
#record-canvas { height: 26px; width: 150px; }
@keyframes blink { 50% { opacity: 0; } }
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 200; }
.modal-content { background: white; padding: 20px; border-radius: 10px; width: 340px; max-height: 80%; display: flex; flex-direction: column; box-shadow: 0 5px 20px rgba(0,0,0,0.2); }
.small-modal { width: 250px; }
.modal-content h3 { margin-top: 0; border-bottom: 1px solid #eee; padding-bottom: 10px; text-align: center;}
.menu-btn { width: 100%; padding: 15px; margin-bottom: 10px; border: none; background: #f0f2f5; font-size: 1em; cursor: pointer; border-radius: 8px; text-align: left; font-weight: bold;}
.menu-btn:hover { background: #e0e0e0; }
.primary-btn { padding: 10px; background: #00a884; color: white; border: none; border-radius: 5px; font-weight: bold; cursor: pointer; width: 100%; }
.close-btn { padding: 10px; border: none; background: transparent; color: #e53935; cursor: pointer; width: 100%; margin-top: 5px; font-weight: bold;}
.modal-content input[type="text"] { width: 90%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; }
.settings-toggles { text-align: left; margin: 10px 0; font-size: 0.9em; }
.settings-toggles label { display: block; margin-bottom: 8px; cursor: pointer; }
#group-member-selection { list-style: none; padding: 0; max-height: 200px; overflow-y: auto; text-align: left; margin-bottom: 15px;}
#group-member-selection li { padding: 5px 0; display: flex; align-items: center; gap: 10px;}
#auth-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #0a0a0a; display: flex; justify-content: center; align-items: center; z-index: 300; overflow: hidden; }
#login-bg-pattern { position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background-image: url('unichat-login-bild-final.png'); background-repeat: repeat; background-size: 120px 120px; opacity: 0.4; transform: rotate(-12deg); animation: scrollRecRoom 5s linear infinite; z-index: 0; }
@keyframes scrollRecRoom { 0% { background-position: 0 0; } 100% { background-position: -120px 120px; } }
.auth-box { background-color: rgba(255, 255, 255, 0.95); padding: 30px; border-radius: 10px; text-align: center; width: 300px; box-sizing: border-box; position: relative; z-index: 10; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.auth-box input { width: 100%; padding: 10px; margin-bottom: 15px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; }
.auth-buttons button { padding: 10px; width: 100%; margin-bottom: 5px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
#login-btn { background-color: #00a884; color: white; }
#register-btn { background-color: #f0f2f5; color: #111; }
#mobile-menu-btn { display: none; font-size: 1.5em; cursor: pointer; color: #54656f; margin-right: 15px; }
#mobile-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 100; }
#disconnect-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; z-index: 9999; color: white; text-align: center; flex-direction: column; justify-content: center; align-items: center; opacity: 0; transition: opacity 2s ease-in-out; }
#disconnect-overlay.active { display: flex; opacity: 1; animation: bluePulse 4s infinite alternate; }
@keyframes bluePulse { 0% { background-color: #000000; } 100% { background-color: #0d2942; } }
@media (max-width: 768px) { #mobile-menu-btn { display: block; } #sidebar { position: absolute; left: -100%; top: 0; height: 100%; width: 85%; max-width: 320px; transition: left 0.3s ease; z-index: 105; box-shadow: 2px 0 10px rgba(0,0,0,0.3); } #sidebar.open { left: 0; } }
#active-link-preview, #active-reply-preview { background-color: #f0f2f5; padding: 10px; display: flex; align-items: center; border-top-left-radius: 10px; border-top-right-radius: 10px; border-top: 1px solid #ccc; gap: 10px; font-size: 0.9em; position: relative; max-height: 80px; }
#active-link-preview img { height: 60px; width: 60px; object-fit: cover; border-radius: 5px; }
#active-link-preview strong { display: block; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;}
#active-link-preview p { margin: 2px 0 0 0; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;}
#lp-close-btn, #reply-close-btn { background: none; border: none; color: #888; font-size: 1.2em; cursor: pointer; position: absolute; top: 5px; right: 5px;}
.msg-reply-box { background-color: rgba(0,0,0,0.05); border-left: 3px solid #00a884; padding: 6px 10px; border-radius: 5px; margin-bottom: 5px; font-size: 0.85em; cursor: pointer; opacity: 0.8; }
.msg-reply-box strong { color: #00a884; display: block; margin-bottom: 2px; }
.msg-reply-box p { margin: 0; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-link-preview { background-color: rgba(0,0,0,0.05); border-left: 3px solid #00a884; padding: 8px; border-radius: 5px; margin-top: 5px; display: flex; flex-direction: column; text-decoration: none; color: inherit; font-size: 0.9em; }
.msg-link-preview img { width: 100%; max-height: 150px; object-fit: cover; border-radius: 5px; margin-bottom: 5px; }
.msg-link-preview strong { color: #111; margin-bottom: 3px;}
.msg-link-preview p { margin: 0; color: #555; font-size: 0.9em;}
.msg-meta { display: flex; justify-content: flex-end; align-items: center; font-size: 0.7em; color: #888; margin-top: 3px; gap: 6px; }
.ticks { font-family: sans-serif; font-size: 1.2em; letter-spacing: -2px; }
.ticks.read { color: #34b7f1; }
.reply-btn, .edit-btn, .delete-btn { cursor: pointer; opacity: 0.3; transition: opacity 0.2s; font-size: 1.3em; background: none; border: none; padding: 0; }
#messages li:hover .reply-btn, #messages li:hover .edit-btn, #messages li:hover .delete-btn { opacity: 1; }
.edited-tag { font-size: 0.9em; color: #888; font-style: italic; margin-right: 5px; }
#active-call-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #0a0a0a; z-index: 10000; flex-direction: column; }
#remote-video { width: 100%; height: 100%; object-fit: contain; position: absolute; top: 0; left: 0; }
#local-video { width: 120px; height: 160px; object-fit: cover; position: absolute; bottom: 90px; right: 20px; border-radius: 10px; border: 2px solid #555; box-shadow: 0 5px 15px rgba(0,0,0,0.5); transform: scaleX(-1); }
#call-status-text { position: absolute; top: 30px; left: 50%; transform: translateX(-50%); color: white; z-index: 10001; text-shadow: 0 2px 4px rgba(0,0,0,0.8); margin: 0; font-size: 1.5em; }
#call-controls { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; gap: 20px; z-index: 10001; background: rgba(0,0,0,0.6); padding: 10px 20px; border-radius: 30px; }
#call-controls button { background: #444; color: white; border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 1.2em; cursor: pointer; transition: background 0.3s; }
#call-controls button:hover { background: #555; }
#btn-end-call { background: #e53935 !important; font-size: 1.5em !important; }
#btn-end-call:hover { background: #d32f2f !important; }