* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-main: #090d16;
  --bg-card: #0f172a;
  --bg-input: #1e293b;
  --border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bubble-me: #2563eb;
  --bubble-other: #1e293b;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

#app-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.hidden {
  display: none !important;
}

/* ========================================================================= */
/* Login Screen */
/* ========================================================================= */
.login-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
  margin-bottom: 12px;
}

.login-brand h1 {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.login-brand p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
}

.btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:active {
  background: var(--primary-hover);
}

.login-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 14px;
  text-align: center;
}

.quick-login {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.quick-title {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.quick-chips button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
}

.quick-chips button:active {
  background: var(--primary);
  border-color: var(--primary);
}

/* ========================================================================= */
/* Header & Navigation */
/* ========================================================================= */
.mobile-header {
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.header-subtitle {
  font-size: 11px;
  color: var(--accent-green);
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
}

.icon-btn:active {
  background: var(--bg-input);
}

/* Category Tabs */
.mobile-tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 4px 8px;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
}

/* Search bar */
.search-bar {
  padding: 8px 14px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-bar input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

/* Rooms List */
.rooms-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 60px;
}

.room-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  cursor: pointer;
  transition: background 0.15s ease;
}

.room-item:active {
  background: rgba(37, 99, 235, 0.15);
}

.room-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 12px;
  flex-shrink: 0;
}

.room-body {
  flex: 1;
  min-width: 0;
}

.room-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.room-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 8px;
}

.room-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-snippet {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.room-badge {
  background: var(--primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Bottom Nav */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 56px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
  flex: 1;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 18px;
}

.nav-label {
  font-size: 10px;
  margin-top: 2px;
}

.nav-badge {
  position: absolute;
  top: 0;
  right: 25%;
  background: #ef4444;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
}

/* ========================================================================= */
/* Active Chat View */
/* ========================================================================= */
.chat-header {
  gap: 10px;
}

.back-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--primary);
  cursor: pointer;
  padding: 0 6px;
}

.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.chat-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Bubbles */
.chat-bubble-container {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.chat-bubble-container.me {
  align-self: flex-end;
}

.chat-bubble-container.other {
  align-self: flex-start;
}

.chat-sender-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 3px;
  margin-left: 4px;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.chat-bubble-container.me .chat-bubble {
  background: var(--bubble-me);
  color: #ffffff;
  border-bottom-right-radius: 3px;
}

.chat-bubble-container.other .chat-bubble {
  background: var(--bubble-other);
  color: var(--text-main);
  border-bottom-left-radius: 3px;
}

.bubble-meta {
  font-size: 10px;
  opacity: 0.7;
  text-align: right;
  margin-top: 4px;
}

/* System cards in stream */
.system-card {
  align-self: center;
  width: 95%;
  max-width: 440px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.5;
}

.system-card-header {
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
  margin-bottom: 4px;
}

.system-btn {
  display: inline-block;
  margin-top: 8px;
  background: #2563eb;
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

/* Chat Footer / Input */
.chat-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-action-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  padding: 6px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
}

.chat-action-btn:active {
  color: var(--primary);
  background: var(--bg-input);
}

.chat-footer textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 9px 14px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  resize: none;
  max-height: 100px;
  line-height: 1.3;
}

.chat-footer textarea:focus {
  border-color: var(--primary);
}

.send-btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.send-btn:active {
  background: var(--primary-hover);
}

/* Modals */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-height: 80vh;
  background: var(--bg-card);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 20px;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.colleagues-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.colleague-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: 10px;
  cursor: pointer;
}

.colleague-item:active {
  background: var(--primary);
}

.loading-spinner {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
