/**
 * Kolo s duší – AI Chat Widget Styles
 * Stylizováno do barev značky: tmavý luxusní Dark UI (#0a0c10 / #151921), zlatý akcent (#e5a100).
 */

:root {
  --kolo-chat-gold: #e5a100;
  --kolo-chat-gold-hover: #f5b316;
  --kolo-chat-bg: #10141b;
  --kolo-chat-card-bg: #161c26;
  --kolo-chat-card-border: rgba(229, 161, 0, 0.25);
  --kolo-chat-text: #f0f3f8;
  --kolo-chat-text-muted: #9aa4b2;
  --kolo-chat-bubble-user: linear-gradient(135deg, #e5a100 0%, #c48700 100%);
  --kolo-chat-bubble-user-text: #0b0e14;
  --kolo-chat-bubble-bot: #1c2331;
  --kolo-chat-bubble-bot-border: rgba(255, 255, 255, 0.08);
}

/* Floating Action Button (FAB) */
.kolo-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(145deg, #181e29, #0f131a);
  border: 2px solid var(--kolo-chat-gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(229, 161, 0, 0.35);
  cursor: pointer;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kolo-chat-gold);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  outline: none;
  padding: 0;
}

.kolo-chat-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.7), 0 0 28px rgba(229, 161, 0, 0.55);
}

.kolo-chat-fab:active {
  transform: scale(0.96);
}

.kolo-chat-fab-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.kolo-chat-fab-close {
  display: none;
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
}

.kolo-chat-fab.open .kolo-chat-fab-icon {
  display: none;
}

.kolo-chat-fab.open .kolo-chat-fab-close {
  display: block;
}

/* Tooltip / Prompt bubble nad FABem */
.kolo-chat-tooltip {
  position: fixed;
  bottom: 94px;
  right: 24px;
  background: #181d26;
  color: #fff;
  border: 1px solid var(--kolo-chat-gold);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 99989;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  animation: koloTooltipFadeIn 0.4s ease-out;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.kolo-chat-tooltip:hover {
  transform: translateY(-2px);
}

.kolo-chat-tooltip-sparkle {
  color: var(--kolo-chat-gold);
  font-size: 1rem;
}

@keyframes koloTooltipFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chat Window Container */
.kolo-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--kolo-chat-bg);
  border: 1px solid var(--kolo-chat-card-border);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(229, 161, 0, 0.2);
  display: none;
  flex-direction: column;
  z-index: 99990;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.kolo-chat-window.open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Header */
.kolo-chat-header {
  background: linear-gradient(160deg, #191f2c 0%, #11151d 100%);
  padding: 16px 18px;
  border-bottom: 1px solid rgba(229, 161, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.kolo-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kolo-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #11141b;
  border: 1.5px solid var(--kolo-chat-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.kolo-chat-avatar img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.kolo-chat-titles h3 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kolo-chat-titles span {
  font-size: 0.75rem;
  color: var(--kolo-chat-gold);
  font-weight: 500;
  display: block;
}

.kolo-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kolo-chat-btn-icon {
  background: transparent;
  border: none;
  color: var(--kolo-chat-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 16px;
}

.kolo-chat-btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Body / Messages */
.kolo-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(circle at top right, rgba(229, 161, 0, 0.04) 0%, transparent 60%);
  scroll-behavior: smooth;
}

.kolo-chat-body::-webkit-scrollbar {
  width: 5px;
}
.kolo-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Quick Prompts Chips */
.kolo-chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.kolo-chat-suggestion-chip {
  background: #171d28;
  border: 1px solid rgba(229, 161, 0, 0.25);
  border-radius: 12px;
  padding: 8px 12px;
  color: #dbe2ed;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.kolo-chat-suggestion-chip:hover {
  background: #202735;
  border-color: var(--kolo-chat-gold);
  color: #ffffff;
  transform: translateX(3px);
}

/* Message Bubbles */
.kolo-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: koloMsgFade 0.22s ease-out;
}

@keyframes koloMsgFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.kolo-msg.user {
  align-self: flex-end;
}

.kolo-msg.bot {
  align-self: flex-start;
}

.kolo-msg-content {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.48;
  word-break: break-word;
}

.kolo-msg.user .kolo-msg-content {
  background: var(--kolo-chat-bubble-user);
  color: var(--kolo-chat-bubble-user-text);
  font-weight: 500;
  border-bottom-right-radius: 3px;
  box-shadow: 0 4px 14px rgba(229, 161, 0, 0.25);
}

.kolo-msg.bot .kolo-msg-content {
  background: var(--kolo-chat-bubble-bot);
  color: var(--kolo-chat-text);
  border: 1px solid var(--kolo-chat-bubble-bot-border);
  border-bottom-left-radius: 3px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.kolo-msg-content p {
  margin: 0 0 6px 0;
}
.kolo-msg-content p:last-child {
  margin-bottom: 0;
}

.kolo-msg-content strong {
  color: var(--kolo-chat-gold);
  font-weight: 700;
}
.kolo-msg.user .kolo-msg-content strong {
  color: #000;
}

.kolo-msg-content ul, .kolo-msg-content ol {
  margin: 4px 0 6px 18px;
  padding: 0;
}
.kolo-msg-content li {
  margin-bottom: 3px;
}

.kolo-msg-content a {
  color: var(--kolo-chat-gold);
  text-decoration: underline;
}

.kolo-msg-time {
  font-size: 0.68rem;
  color: var(--kolo-chat-text-muted);
  margin-top: 3px;
  padding: 0 4px;
}
.kolo-msg.user .kolo-msg-time {
  align-self: flex-end;
}

/* Typing Indicator */
.kolo-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--kolo-chat-bubble-bot);
  border: 1px solid var(--kolo-chat-bubble-bot-border);
  border-radius: 14px;
  border-bottom-left-radius: 3px;
  width: fit-content;
  align-self: flex-start;
}

.kolo-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--kolo-chat-gold);
  border-radius: 50%;
  animation: koloDotPulse 1.4s infinite ease-in-out;
}
.kolo-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.kolo-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes koloDotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Footer & Input */
.kolo-chat-footer {
  padding: 12px 14px;
  background: #131720;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kolo-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1b212c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 6px 8px 6px 12px;
  transition: border-color 0.2s ease;
}

.kolo-chat-input-row:focus-within {
  border-color: var(--kolo-chat-gold);
  box-shadow: 0 0 10px rgba(229, 161, 0, 0.2);
}

.kolo-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 16px !important; /* DŮLEŽITÉ: 16px zabraňuje nechtěnému iOS Safari auto-zoomu při kliknutí */
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 80px;
  touch-action: manipulation;
  -webkit-appearance: none;
}

.kolo-chat-input::placeholder {
  color: #7b8594;
  font-size: 0.9rem;
}

.kolo-chat-send-btn {
  background: #252e3e;
  border: none;
  color: var(--kolo-chat-text-muted);
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
  flex-shrink: 0;
}

.kolo-chat-send-btn.active {
  background: var(--kolo-chat-gold);
  color: #0b0e14;
}

.kolo-chat-send-btn.active:hover {
  background: var(--kolo-chat-gold-hover);
  transform: scale(1.05);
}

.kolo-chat-subinfo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #6d7785;
  padding: 0 2px;
}

.kolo-chat-char-counter.limit-near {
  color: #e5a100;
  font-weight: 600;
}
.kolo-chat-char-counter.limit-reached {
  color: #ff5252;
  font-weight: 700;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .kolo-chat-fab {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  .kolo-chat-tooltip {
    bottom: 80px;
    right: 16px;
    font-size: 0.8rem;
  }
  .kolo-chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    z-index: 9999999;
  }
  .kolo-chat-header {
    padding: 12px 16px;
    flex-shrink: 0;
  }
  .kolo-chat-body {
    flex: 1 1 auto;
    padding: 14px;
    -webkit-overflow-scrolling: touch;
  }
  .kolo-chat-footer {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) 12px;
    flex-shrink: 0;
    background: #11151e;
  }
  .kolo-chat-input-row {
    padding: 6px 8px 6px 12px;
  }
  .kolo-chat-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
}
