*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #eceef8;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Wrapper (centruje a zaobluje celý app) ─────────────────────────────────── */

#app-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  padding: 20px;
}

#app {
  display: flex;
  flex: 1;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  background: #fff;
  min-height: 0;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */

#sidebar {
  width: 260px;
  min-width: 260px;
  background: #fff;
  border-right: 1px solid #ebebf0;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}

#sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid #ebebf0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

#sidebar-logo strong { display: block; font-size: 16px; font-weight: 700; color: #1a1a2e; }
#sidebar-logo small  { font-size: 12px; color: #9999aa; }

#sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #b0b0c0;
  padding: 4px 8px 8px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: transparent;
  color: #444456;
  border: none;
  border-radius: 10px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s, color .15s;
  line-height: 1.4;
}

.nav-btn:hover {
  background: #f4f4ff;
  color: #e65c00;
}

.district-list {
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.nav-btn-district {
  font-size: 12.5px;
  color: #888;
  padding: 6px 12px;
}

.nav-btn-district:hover {
  color: #e65c00;
  background: #f4f4ff;
}

#sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid #ebebf0;
}

#new-chat-btn {
  width: 100%;
  padding: 10px;
  background: #e65c00;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

#new-chat-btn:hover { background: #cf5200; }

#app-version {
  margin-top: 8px;
  font-size: 11px;
  color: #b0b0c0;
  text-align: center;
}

#header-version {
  font-size: 11px;
  color: #aaa;
  margin-left: auto;
  display: none;
}

/* ── Chat hlavní ────────────────────────────────────────────────────────────── */

#chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fafafa;
  overflow: hidden;
}

#chat-header {
  background: #fff;
  border-bottom: 1px solid #ebebf0;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  color: #1a1a2e;
}

#sidebar-toggle {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
  display: none;
  padding: 0 4px;
  line-height: 1;
}

/* Messages */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message { display: flex; align-items: flex-end; gap: 8px; }
.message.user { justify-content: flex-end; }
.message.bot  { justify-content: flex-start; }

.bot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  align-self: flex-end;
}

.bubble {
  max-width: 68%;
  padding: 11px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.65;
  transition: opacity 0.15s;
}

.message.user .bubble {
  background: #e65c00;
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 2px 8px rgba(230,92,0,.25);
}

.message.bot .bubble {
  background: #fff;
  color: #1a1a2e;
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  position: relative;
  overflow: hidden;
}


.generating-overlay {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  background: rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  transition: opacity 0.35s ease;
  z-index: 2;
}

.generating-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.generating-label {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  white-space: nowrap;
}

/* Odkaz na detail restaurace v bublině */
.restaurant-link {
  color: #e65c00;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(230,92,0,.3);
}
.restaurant-link:hover { border-bottom-color: #e65c00; }
.message.user .bubble .restaurant-link { color: #ffd0b0; border-bottom-color: rgba(255,208,176,.4); }

/* Čas generování */
.message-meta {
  font-size: 11px;
  color: #c0c0cc;
  padding: 0 4px 2px;
}

/* Quick reply tlačítka */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 6px;
}

.quick-reply-btn {
  padding: 7px 15px;
  background: #fff;
  color: #e65c00;
  border: 1.5px solid #e8c4b0;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.quick-reply-btn:hover {
  background: #e65c00;
  color: #fff;
  border-color: #e65c00;
}

/* Typing dots */
.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: #ccc;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* Input row */
#chat-input-row {
  display: flex;
  padding: 14px 18px;
  gap: 10px;
  background: #fff;
  border-top: 1px solid #ebebf0;
}

#chat-input {
  flex: 1;
  padding: 12px 18px;
  border: 1.5px solid #e8e8f0;
  border-radius: 14px;
  font-size: 14px;
  background: #f7f7fc;
  outline: none;
  transition: border-color .2s, background .2s;
  color: #1a1a2e;
}

#chat-input::placeholder { color: #b0b0c0; }
#chat-input:focus { border-color: #e65c00; background: #fff; }

#chat-send {
  padding: 12px 22px;
  background: #e65c00;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}

#chat-send:hover    { background: #cf5200; }
#chat-send:disabled { background: #e0dede; cursor: default; }

/* ── Mobilní layout ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  #app-wrap {
    padding: 0;
    height: 100vh;
    height: 100dvh;
  }
  #app {
    border-radius: 0;
    height: 100%;
  }

  #sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }

  #sidebar.open { transform: translateX(0); }

  #sidebar-toggle { display: block; }

  #header-version { display: block; }

  .bubble { max-width: 85%; }
}
