/* ===================================
   Chat Widget
   Konzistentní s projektem - využívá
   CSS proměnné ze styles.css
   =================================== */

/* --- Tlačítko (FAB) --- */
.chat-widget-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  z-index: 1000;
}

.chat-widget-fab:hover {
  background: var(--accent-light);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.chat-widget-fab svg {
  width: 26px;
  height: 26px;
  transition: opacity 0.15s ease;
}

/* Křížek je v hlavičce panelu — FAB zobrazuje vždy jen ikonu chatu */

/* --- Panel --- */
.chat-widget-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 360px;
  max-height: 520px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  z-index: 999;
  overflow: hidden;

  /* Animace */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.chat-widget-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* --- Hlavička panelu --- */
.chat-widget-header {
  background: var(--accent);
  color: white;
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

.chat-widget-header-icon {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-widget-header-icon svg {
  width: 16px;
  height: 16px;
}

.chat-widget-header-text {
  display: flex;
  flex-direction: column;
}

.chat-widget-header-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.chat-widget-header-subtitle {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* --- Zavírací tlačítko v hlavičce --- */
.chat-widget-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  transition: color 0.2s ease;
}

.chat-widget-close:hover {
  color: white;
}

/* --- Zprávy --- */
.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  scroll-behavior: smooth;
}

.chat-widget-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-widget-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Zpráva */
.chat-msg {
  max-width: 85%;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: break-word;
}

.chat-msg.bot {
  background: var(--bg-secondary, #f5f0e8);
  color: var(--text-dark);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.error {
  background: #fef2f2;
  color: #b91c1c;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg.bot a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}

.chat-msg.bot a:hover {
  color: var(--accent-light);
}

/* Typing indicator */
.chat-msg.typing {
  background: var(--bg-secondary, #f5f0e8);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  padding: var(--spacing-sm) var(--spacing-md);
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 18px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-light);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

/* --- Input area --- */
.chat-widget-input-area {
  padding: var(--spacing-sm) var(--spacing-md);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--spacing-sm);
  align-items: flex-end;
  flex-shrink: 0;
  background: white;
}

.chat-widget-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px var(--spacing-sm);
  font-size: 0.9rem;
  font-family: var(--font-body);
  color: var(--text-dark);
  resize: none;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.4;
}

.chat-widget-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.chat-widget-input::placeholder {
  color: var(--text-light);
  opacity: 0.7;
}

.chat-widget-send {
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
}

.chat-widget-send:hover:not(:disabled) {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.chat-widget-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-widget-send svg {
  width: 16px;
  height: 16px;
}

/* --- Mobilní optimalizace --- */
@media (max-width: 480px) {
  .chat-widget-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 75vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .chat-widget-fab {
    bottom: 20px;
    right: 20px;
  }
}

/* =====================================================
   CHAT WIDGET – Quick Replies (předpřipravené otázky)
   Přidat do: chat-widget.css
   ===================================================== */

.chat-quick-replies {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding: 0 2px;
}

.chat-quick-reply {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  border: 1.5px solid #d0dbe8;
  border-radius: 10px;
  color: #2c5282;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  line-height: 1.3;
}

.chat-quick-reply:hover {
  background: #ebf2fb;
  border-color: #4a90d9;
  transform: translateX(2px);
}

.chat-quick-reply:active {
  background: #d6e8f7;
  transform: translateX(2px);
}