/* style.css — styl dla index.html (ChainChat) */
/* Dark, clean UI with responsive layout and chat bubbles */

/* Root kolory i podstawowy reset */
:root{
  --bg-0: #0b1220;
  --bg-1: #0f1724;
  --card: #0f172a;
  --panel: #111827;
  --muted: #9aa4b2;
  --accent: #2563eb;
  --accent-2: #06b6d4;
  --sent: #d2f8d8;
  --recv: #ffffff;
  --glass: rgba(255,255,255,0.03);
  --shadow: 0 8px 30px rgba(2,6,23,0.6);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html,body { height: 100%; background: linear-gradient(180deg,var(--bg-0),var(--bg-1)); color: #e6eef8; -webkit-font-smoothing:antialiased; }

/* Górny navbar */
.navbar {
  width: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-bottom: 1px solid rgba(255,255,255,0.03);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(6px);
}
.navbar-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo { font-size: 20px; letter-spacing: 1px; font-weight: 600; color: #f8fafc; }

/* Informacja o użytkowniku w navbarze */
.user-info { display:flex; align-items:center; gap:10px; }
.user-address {
  font-size:13px;
  color: var(--muted);
  background: var(--glass);
  padding:6px 10px;
  border-radius:8px;
  max-width:280px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.logout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: #e6eef8;
  padding:8px 12px;
  border-radius:8px;
  cursor: pointer;
}
.logout-btn:hover { transform: translateY(-1px); }

/* Główny układ czatu */
.chat-container {
  max-width: 1100px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 12px;
}

/* Lewa kolumna (kontakty / panele) */
.left-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  min-height: 64vh;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.02);
}
.panel-title { font-weight:600; margin-bottom:8px; color:#fff; }

/* Prawa kolumna — obszar czatu */
.chat-area {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-radius: 12px;
  height: 64vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.02);
  overflow: hidden;
}


/* Obszar przewijania wiadomości */
.messages {
  flex: 1 1 auto;
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-image: linear-gradient(180deg, rgba(255,255,255,0.002), transparent);
}

/* Pojedyncza linia wiadomości */
.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.msg-row.right { justify-content: flex-end; }
.msg-row.left { justify-content: flex-start; }

/* Bąbelek wiadomości */
.msg {
  max-width: 72%;
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(2,6,23,0.35);
  word-break: break-word;
  line-height: 1.3;
  color: #0b1620;
  font-size: 14px;
}
.msg.self {
  background: linear-gradient(180deg, var(--sent), #bff0c8);
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}
.msg.other {
  background: var(--recv);
  color: #0b1724;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}

/* Metawiersz poniżej bąbelka */
.meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* Obszar skład wiadomości */
.message-input {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.02);
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.00));
  flex-shrink: 0;
}
.message-input > div {
  display: flex;
  gap: 8px;
}
#messageInput {
  width: 100%;
  min-height: 48px;
  max-height: 160px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.02);
  color: #e6eef8;
  resize: none;
  outline: none;
  font-size: 14px;
  flex-shrink: 0;
}
#messageInput:focus { box-shadow: 0 0 0 3px rgba(37,99,235,0.08); border-color: var(--accent); }

/* Przyciski akcji - dopasowane do stylu send-btn */
.btn {
  background: linear-gradient(180deg, var(--accent), #1e40af);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(37,99,235,0.14);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
  width: auto;
}
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.loading {
  pointer-events: none;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.btn-full { width: 100%; }
.btn-flex { flex: 1; }
.btn-secondary {
  background: linear-gradient(180deg, #4a5568, #2d3748);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.btn-secondary:hover { transform: translateY(-2px); }

/* Send button */
.send-btn {
  background: linear-gradient(180deg, var(--accent), #1e40af);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(37,99,235,0.14);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
  width: auto;
}
.send-btn:hover { transform: translateY(-2px); }

/* Stopka */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 18px;
  opacity: 0.9;
}

/* Small helpers */
.small { font-size: 13px; color: var(--muted); }
.card { background: var(--panel); padding: 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.02); }

/* Elementy listy rozmów (jeśli lewa kolumna zawiera rozmowy) */
.convo-item {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.02);
  margin-bottom: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
}
.convo-item.active { background: linear-gradient(180deg, rgba(37,99,235,0.08), rgba(37,99,235,0.03)); outline: 1px solid rgba(37,99,235,0.12); }

/* Dostosowania responsive */
@media (max-width: 920px) {
  .chat-container { grid-template-columns: 1fr; padding: 10px; }
  .left-panel { order: 2; }
  .chat-area { order: 1; min-height: 64vh; }
  .navbar-container { padding: 10px; }
  .user-address { display: none; }
}

/* Modal aliasu */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: #1a1f2e;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  border: 1px solid #3a4052;
}
.modal-content h3 {
  margin: 0 0 16px 0;
  color: #fff;
}
.modal-content input {
  background: var(--panel);
  color: #e6eef8;
}
