
* { box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
  background: #f5f7fb;
  color: #222;
}

h1 {
  text-align: center;
  margin: 12px 0 20px;
}

.box {
  border: 1px solid #d9e0ea;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

input, button {
  padding: 12px;
  margin: 4px 0;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 16px;
}

input {
  width: 100%;
  max-width: 100%;
}

button {
  cursor: pointer;
  border: none;
  background: #2563eb;
  color: white;
  font-weight: 600;
  min-height: 44px;
}

button:hover {
  opacity: 0.95;
}

.messages {
  border: 1px solid #e2e8f0;
  background: #fafafa;
  height: 300px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 12px;
  margin: 8px 0 12px;
}

.chatimg {
  max-width: 100%;
  width: auto;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 6px;
}

.emoji {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.emoji button {
  background: #eef2ff;
  color: #111827;
  border: 1px solid #c7d2fe;
  min-width: 44px;
  padding: 8px;
  font-size: 22px;
}

#onlineUsers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#onlineUsers button {
  background: #10b981;
  padding: 8px 12px;
}

#chat {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Tablet */
@media (min-width: 768px) {
  body {
    padding: 20px;
  }

  #chat {
    grid-template-columns: 1fr 1fr;
  }

  #chat .box:first-child {
    grid-column: 1 / -1;
  }

  #chat .box:nth-child(2) {
    grid-column: 1 / -1;
  }

  .messages {
    height: 360px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  #chat {
    grid-template-columns: 280px 1fr 1fr;
    align-items: start;
  }

  /* Prihlásený ako */
  #chat .box:first-child {
    grid-column: 1 / -1;
  }

  /* Online používatelia */
  #chat .box:nth-child(2) {
    grid-column: 1 / 2;
  }

  /* Verejný chat */
  #chat .box:nth-child(3) {
    grid-column: 2 / 3;
  }

  /* Súkromný chat */
  #chat .box:nth-child(4) {
    grid-column: 3 / 4;
  }

  .messages {
    height: 420px;
  }
}

/* Mobil */
@media (max-width: 767px) {
  body {
    padding: 8px;
  }

  .box {
    padding: 12px;
    border-radius: 12px;
  }

  button {
    width: 100%;
    margin-top: 6px;
  }

  .emoji button {
    width: auto;
    flex: 0 0 auto;
  }

  .messages {
    height: 240px;
  }
}


.typing {
  font-style: italic;
  color: #666;
  min-height: 20px;
  margin: 4px 0 8px;
}


:root {
  --bg: #f5f7fb;
  --text: #222;
  --card: #ffffff;
  --border: #d9e0ea;
  --messages: #fafafa;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --text: #e5e7eb;
  --card: #1e293b;
  --border: #334155;
  --messages: #111827;
}

body {
  background: var(--bg);
  color: var(--text);
}

.box {
  background: var(--card);
  border-color: var(--border);
}

.messages {
  background: var(--messages);
  border-color: var(--border);
}

input {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.emoji-toolbar {
  position: relative;
  margin-bottom: 8px;
}

.emoji-picker {
  position: absolute;
  z-index: 1000;
  top: 48px;
  left: 0;
  max-width: min(100%, 360px);
}

.hidden {
  display: none;
}
