/* === Полный style.css для Rprogram === */
:root{
  --bg:#0e1621;
  --panel:#15202b;
  --accent:#2a9df4;
  --me:#2a9df4;
  --other:#1f2933;
  --bubble-other:#24303a;
  --text:#e6eef8;
  --muted:#9aa6b2;
  --error:#ff4d4d;
}
*{box-sizing:border-box}
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ============ Maintenance screen ============ */
.maintenance-screen {
  position: fixed;
  inset: 0;
  background: #ffffff; /* белый фон */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.maintenance-box {
  text-align: center;
}
.maintenance-box .logo {
  font-size: 32px;
  font-weight: 800;
  color: #111;
  margin-bottom: 12px;
}
.maintenance-box .maintenance-text {
  color: #c62828; /* красный */
  font-size: 28px;
  font-weight: 800;
}

/* ================= Регистрация ================= */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.25), transparent 40%);
  z-index: 50;
}
.auth-screen .box {
  background: #0f1a23;
  padding: 26px;
  border-radius: 12px;
  width: 320px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.02);
}
.auth-screen h2 { margin: 0 0 14px 0; color: var(--accent); font-size: 18px; }
.auth-screen input[type="text"],
.auth-screen input[type="password"]{
  width:100%;
  padding:10px;
  margin:8px 0;
  border-radius:8px;
  border: none;
  background:#0b1318;
  color:var(--text);
  outline: 1px solid rgba(255,255,255,0.02);
}
.upload {
  display:inline-block;
  margin:8px 0;
  padding:8px 12px;
  background:#0b1720;
  border-radius:8px;
  cursor:pointer;
  color:var(--text);
  border:1px solid rgba(255,255,255,0.02);
}
.upload input{ display:none; }
.auth-screen button {
  width:100%;
  margin-top:8px;
  padding:10px;
  background:var(--accent);
  color:white;
  border:none;
  border-radius:8px;
  font-weight:600;
  cursor:pointer;
}
.auth-screen button:hover { filter:brightness(0.95); }

/* ================= Основной интерфейс ================= */
.hidden { display:none; }

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  background: var(--panel);
  border-right: 1px solid rgba(255,255,255,0.02);
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:18px 12px;
}
.sidebar header {
  font-size:18px;
  color:var(--accent);
  font-weight:700;
  margin-bottom:12px;
}
.profile { text-align:center; margin-bottom:12px; }
.profile img {
  width:78px; height:78px; border-radius:50%;
  object-fit:cover;
  border:3px solid var(--accent);
  display:block;
  margin: 0 auto 8px auto;
}
.profile #userName { font-weight:600; color:var(--text); }

/* Logout button */
.logout {
  margin-top:auto;
  margin-bottom:12px;
  padding:10px 14px;
  background:#e03b3b;
  border:none;
  color:white;
  border-radius:8px;
  cursor:pointer;
  font-weight:600;
}
.logout:hover { filter:brightness(0.95); }

/* Chat area */
.chat {
  margin-left:220px;
  height:100vh;
  display:flex;
  flex-direction:column;
  background: linear-gradient(180deg, #071018 0%, #08121a 100%);
}

/* Topbar / indicator */
.topbar {
  height:44px;
  display:flex;
  align-items:center;
  padding:8px 16px;
  border-bottom:1px solid rgba(255,255,255,0.02);
}
.update-indicator {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  padding:6px 10px;
  border-radius:8px;
  font-size:13px;
}
.update-indicator.hidden { display:none; }

/* Messages container */
.messages {
  flex:1;
  padding:16px;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* Message row wrapper to align left/right */
.message-row {
  display:flex;
  flex-direction:column;
  max-width:75%;
}

/* From others (left) */
.message-row.from-others { align-self:flex-start; }

/* From me (right) */
.message-row.from-me { align-self:flex-end; }

/* sender name for other users */
.msg-sender {
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
  margin-left:6px;
}

/* bubble styling */
.bubble {
  padding:10px 12px;
  border-radius:12px;
  display:flex;
  flex-direction:column;
  gap:6px;
  position:relative;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

/* left bubble */
.bubble-other {
  background: var(--bubble-other);
  color: var(--text);
  border-top-left-radius:4px;
}

/* right bubble */
.bubble-me {
  background: var(--me);
  color: white;
  border-top-right-radius:4px;
}

/* message text and time */
.msg-text { font-size:15px; line-height:1.3; }
.msg-time {
  font-size:11px;
  color: rgba(255,255,255,0.65);
  text-align:right;
}

/* image in message */
.msg-image {
  display:block;
  max-width:320px;
  max-height:360px;
  border-radius:10px;
  object-fit:cover;
}

/* composer */
.composer {
  display:flex;
  gap:8px;
  align-items:center;
  padding:12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-top:1px solid rgba(255,255,255,0.02);
}
.composer input[type="text"],
.composer input[type="search"],
.composer input[type="email"]{
  flex:1;
  padding:10px 12px;
  border-radius:10px;
  border:none;
  outline:none;
  background:#0b1216;
  color:var(--text);
}
.photoUpload {
  padding:8px;
  border-radius:8px;
  background:#0b1720;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(255,255,255,0.02);
}
.photoUpload input { display:none; }
.composer button {
  background:var(--accent);
  border:none;
  color:white;
  padding:10px 14px;
  border-radius:8px;
  cursor:pointer;
  font-weight:700;
}

/* error popup centered */
.error-popup {
  position: fixed;
  left:50%;
  top:50%;
  transform: translate(-50%,-50%);
  background: rgba(255,77,77,0.95);
  color:white;
  padding:14px 20px;
  border-radius:10px;
  font-weight:700;
  z-index:9999;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.error-popup.hidden { display:none; }

/* scrollbar */
.messages::-webkit-scrollbar { width:8px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.04); border-radius:6px; }
