* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { background: #f0f2f5; height: 100vh; display: flex; flex-direction: column; }
#app { display: flex; flex: 1; height: 100vh; overflow: hidden; }

#sidebar { width: 340px; background: #ffffff; border-right: 1px solid #ddd; display: flex; flex-direction: column; }
.sidebar-header { padding: 15px; background: #ededed; font-weight: bold; font-size: 0.9rem; color: #555; }
.room-setup { padding: 15px; border-bottom: 1px solid #eee; display: flex; gap: 8px; flex-direction: column; }
.room-setup input { padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 1rem; }

.btn { padding: 10px; background: #008069; color: #ffffff; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; transition: opacity 0.15s ease; }
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: #54656f; }
.btn-danger { background: #dc3545; }

#main { flex: 1; display: flex; flex-direction: column; background: #efeae2; }
.chat-header { height: 60px; background: #ededed; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #ddd; }

.badge { font-size: 0.75rem; padding: 3px 8px; border-radius: 12px; background: #bbb; color: #ffffff; font-weight: bold; }
.badge.active { background: #25d366; }

#chatMessages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.msg-bubble { max-width: 65%; padding: 8px 12px; border-radius: 8px; font-size: 0.95rem; word-break: break-word; box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13); }
.msg-bubble.mine { align-self: flex-end; background: #d9fdd3; }
.msg-bubble.theirs { align-self: flex-start; background: #ffffff; }
.msg-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: #888; margin-top: 4px; gap: 8px; }
.unsend-btn { border: none; background: transparent; cursor: pointer; color: #d33; font-weight: bold; }

.chat-controls { background: #f0f2f5; padding: 10px 15px; display: flex; align-items: center; gap: 10px; }
.chat-controls input[type="text"] { flex: 1; padding: 12px; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; }

#progressContainer { display: none; padding: 10px 20px; background: #ffffff; border-top: 1px solid #ddd; }
progress { width: 100%; height: 14px; accent-color: #008069; }

#callOverlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.92); z-index: 100; flex-direction: column; justify-content: center; align-items: center; }
.video-grid { display: flex; width: 100%; height: 80%; justify-content: center; align-items: center; gap: 20px; }
video { max-width: 45%; max-height: 90%; background: #111; border-radius: 8px; object-fit: cover; }
.call-controls { margin-top: 20px; display: flex; gap: 15px; }

@media (max-width: 768px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; height: auto; }
  .msg-bubble { max-width: 85%; }
  .video-grid { flex-direction: column; }
  video { max-width: 90%; max-height: 40%; }
}
