/* ==========================================================================
   ABC Tiskárna – Chatbot Widget
   Vložte tento soubor na svůj web: <link rel="stylesheet" href="abc-chatbot/widget.css">
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --abc-primary:    #cc0000;
  --abc-primary-dk: #8f0000;
  --abc-accent:     #ff6a00;
  --abc-bg:         #ffffff;
  --abc-bot-bg:     #fff5f5;
  --abc-user-bg:    #cc0000;
  --abc-user-color: #ffffff;
  --abc-text:       #1a1a2e;
  --abc-muted:      #6b7280;
  --abc-border:     #e8d8d8;
  --abc-radius:     14px;
  --abc-shadow:     0 8px 32px rgba(180, 0, 0, 0.18);
  --abc-z:          9999;
}

/* ---- Reset ---- */
#abc-chatbot-widget *,
#abc-chatbot-widget *::before,
#abc-chatbot-widget *::after {
  box-sizing: border-box;
  margin: 0;
}

/* ---- Floating trigger button ---- */
#abc-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--abc-z);
  width: auto;
  height: auto;
  border-radius: 16px;
  background-image: linear-gradient(to bottom right, #8f0000, #cc0000, #e00000);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  padding: 0;
  box-shadow:
    0 0 0 0.5px rgba(0,0,0,0.3) inset,
    0 4px 12px -3px rgba(80,0,0,0.9),
    0 8px 20px 0 rgba(80,0,0,0.25);
  text-shadow: 0 0.5px 0.75px rgba(80,0,0,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  --alternative-gradient-opacity: 0;
}

/* alter gradient overlay – pulsuje přes GSAP */
#abc-chat-trigger::after {
  content: '';
  position: absolute;
  border-radius: inherit;
  inset: 0;
  opacity: var(--alternative-gradient-opacity, 0);
  background-image: linear-gradient(96deg, #cc2222, #5a0000);
  box-shadow: 0 0 0.5px 0.5px rgba(0, 0, 0, 0.3) inset;
  pointer-events: none;
  z-index: 0;
}

/* vnitřní highlight linka */
#abc-chat-trigger::before {
  content: '';
  position: absolute;
  inset: 1px;
  box-shadow: 0 0 0 0.5px rgba(255,255,255,0.55) inset;
  border-radius: 15px;
  pointer-events: none;
  mix-blend-mode: overlay;
  filter: blur(0.25px);
  z-index: 1;
}

#abc-chat-trigger:hover {
  transform: scale(1.03);
  box-shadow:
    0 0 0 0.5px rgba(0,0,0,0.3) inset,
    0 6px 18px -3px rgba(80,0,0,0.95),
    0 12px 28px 0 rgba(80,0,0,0.35);
}

#abc-trigger-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  position: relative;
  z-index: 3;
  border-radius: 16px;
  box-shadow: inset 0 -1.5px 0 rgba(80,0,0,0.5), inset 0 -2.5px 0 rgba(120,0,0,0.6);
  --button-glow-1-scale: 0.6;
  --button-glow-1-opacity: 0;
  --button-glow-1-blur: 0px;
  --button-glow-2-scale: 0.5;
  --button-glow-2-opacity: 0;
  --button-glow-2-blur: 0px;
}

#abc-trigger-inner::before,
#abc-trigger-inner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  mix-blend-mode: multiply;
  z-index: -1;
  pointer-events: none;
}

#abc-trigger-inner::before {
  box-shadow: 0 0 0 6px #8f0000;
  transform: scale(var(--button-glow-1-scale)) translateZ(0);
  opacity: var(--button-glow-1-opacity);
  filter: blur(var(--button-glow-1-blur));
}

#abc-trigger-inner::after {
  box-shadow: 0 0 0 6px #cc0000;
  transform: scale(var(--button-glow-2-scale)) translateZ(0);
  opacity: var(--button-glow-2-opacity);
  filter: blur(var(--button-glow-2-blur));
}

#abc-chat-trigger svg {
  stroke: #fff;
  fill: none;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0.5px 0.75px rgba(80,0,0,0.4));
}

#abc-trigger-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

#abc-trigger-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

#abc-trigger-sub {
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  max-width: 200px;
}

/* Badge s počtem nepřečtených zpráv */
#abc-chat-badge {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--abc-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

#abc-chat-badge.visible {
  display: flex;
}

/* ---- Chat okno ---- */
#abc-chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--abc-z);
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--abc-bg);
  border-radius: var(--abc-radius);
  box-shadow: var(--abc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--abc-text);
  transition: opacity 0.25s, transform 0.25s;
  transform-origin: bottom right;
}

#abc-chatbot-widget.abc-hidden {
  opacity: 0;
  transform: scale(0.9) translateY(12px);
  pointer-events: none;
}

/* ---- Hlavička ---- */
#abc-chat-header {
  background: var(--abc-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#abc-chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

#abc-chat-header-avatar svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
  fill: none;
}

#abc-header-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

#abc-header-logo-fallback {
  display: none;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1.2;
  text-align: center;
}

#abc-chat-header-info {
  flex: 1;
}

#abc-chat-header-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

#abc-chat-header-sub {
  font-size: 12px;
  opacity: 0.82;
}

#abc-chat-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s, transform 0.2s;
}

#abc-chat-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

#abc-chat-close svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s;
}

/* Operátor online – zelený stav */
.abc-operator-online {
  color: #90ee90 !important;
  opacity: 1 !important;
  font-weight: 600;
}

/* ---- Zprávy ---- */
#abc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#abc-chat-messages::-webkit-scrollbar {
  width: 5px;
}
#abc-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#abc-chat-messages::-webkit-scrollbar-thumb {
  background: var(--abc-border);
  border-radius: 10px;
}

/* Řádek zprávy */
.abc-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.abc-msg-row.abc-user {
  flex-direction: row-reverse;
}

.abc-msg-row.abc-system {
  justify-content: center;
}

/* Avatar bota */
.abc-bot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--abc-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.abc-bot-avatar svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

.abc-bot-avatar.abc-operator-avatar {
  background: #2f855a;
}

/* Bubliny */
.abc-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  word-break: break-word;
  white-space: normal;
  text-align: left;
}

.abc-bubble a {
  color: var(--abc-primary);
  text-decoration: underline;
  word-break: break-all;
}

.abc-bubble.abc-user a {
  color: rgba(255, 255, 255, 0.9);
}

.abc-bubble.abc-bot {
  background: var(--abc-bot-bg);
  color: var(--abc-text);
  border-bottom-left-radius: 4px;
}

.abc-bubble.abc-user {
  background: var(--abc-user-bg);
  color: var(--abc-user-color);
  border-bottom-right-radius: 4px;
}

.abc-bubble.abc-system {
  background: transparent;
  color: var(--abc-muted);
  font-size: 12px;
  font-style: italic;
  padding: 0;
  border-radius: 0;
  text-align: center;
}

/* Časové razítko */
.abc-msg-content {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  min-width: 0;
}

.abc-msg-content-system {
  align-items: center;
  max-width: 100%;
}

.abc-timestamp {
  font-size: 10px;
  font-weight: 500;
  color: var(--abc-muted);
  margin-top: 4px;
  opacity: 0.6;
  letter-spacing: 0.2px;
}

.abc-ts-user {
  text-align: right;
  padding-right: 8px;
}

.abc-ts-bot {
  text-align: left;
  padding-left: 8px;
}

.abc-ts-system {
  text-align: center;
  padding-left: 0;
  margin-top: 2px;
}

/* Upozornění / warning box */
.abc-warning {
  display: block;
  background: #fff8e1;
  border-left: 4px solid #ffc107;
  color: #5d4037;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
}

/* Typing indicator */
.abc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  background: var(--abc-bot-bg);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.abc-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--abc-primary);
  opacity: 0.4;
  animation: abc-bounce 1.2s infinite;
}

.abc-typing span:nth-child(2) { animation-delay: 0.2s; }
.abc-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* Rychlé odpovědi (suggestions) */
#abc-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  flex-shrink: 0;
}

.abc-suggestion-btn {
  background: none;
  border: 1.5px solid var(--abc-primary);
  color: var(--abc-primary);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.abc-suggestion-btn:hover {
  background: var(--abc-primary);
  color: #fff;
}

/* ---- Vstupní pole ---- */
#abc-chat-input-area {
  border-top: 1px solid var(--abc-border);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--abc-bg);
  position: relative;
}

#abc-chat-input {
  flex: 1;
  border: 1.5px solid var(--abc-border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 100px;
  overflow-y: hidden;
  transition: border-color 0.15s;
  line-height: 1.4;
  color: var(--abc-text);
  background: #f9fbff;
}

#abc-chat-input:focus {
  border-color: var(--abc-primary);
  background: #fff;
}

#abc-chat-input::placeholder {
  color: var(--abc-muted);
}

#abc-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--abc-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

#abc-chat-send:hover:not(:disabled) {
  background: var(--abc-primary-dk);
}

#abc-chat-send:active:not(:disabled) {
  transform: scale(0.93);
}

#abc-chat-send:disabled {
  opacity: 0.5;
  cursor: default;
}

#abc-chat-send svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
}

/* ---- Patička / Toolbar ---- */
#abc-chat-footer {
  padding: 6px 12px 8px;
  border-top: 1px solid var(--abc-border);
  flex-shrink: 0;
  position: relative;
}

#abc-toolbar {
  display: flex;
  justify-content: center;
  gap: 2px;
}

.abc-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--abc-muted);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}

.abc-toolbar-btn:hover {
  background: var(--abc-border);
  color: var(--abc-primary);
}

.abc-toolbar-btn:focus,
.abc-toolbar-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.abc-toolbar-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

.abc-toolbar-btn-end:hover {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
}

/* Emoji picker */
.abc-emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--abc-border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  z-index: 50;
  margin-bottom: 8px;
  width: 280px;
}

.abc-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.abc-emoji-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.abc-emoji-btn:hover {
  background: var(--abc-border);
}

/* Potvrzovací dialog pro ukončení chatu */
.abc-end-confirm-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.abc-end-confirm-dialog {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 24px;
  width: calc(100% - 40px);
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  text-align: center;
}


.abc-end-confirm-title {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
  line-height: 1.3;
}

.abc-end-confirm-message {
  font-size: 13px;
  color: #666;
  margin-bottom: 24px;
  line-height: 1.5;
}

.abc-end-confirm-actions {
  display: flex;
  gap: 10px;
}

.abc-end-confirm-btn {
  flex: 1;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.abc-end-confirm-btn:focus,
.abc-end-confirm-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.abc-end-confirm-btn-cancel {
  background: #f0f2f5;
  color: #333;
}

.abc-end-confirm-btn-cancel:hover {
  background: #e2e5ea;
}

.abc-end-confirm-btn-ok {
  background: #dc3545;
  color: #fff;
}

.abc-end-confirm-btn-ok:hover {
  background: #c82333;
}

/* ---- Přiložené soubory (náhled) ---- */
#abc-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 6px;
  flex-shrink: 0;
}

.abc-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--abc-bot-bg);
  border: 1px solid var(--abc-border);
  border-radius: 12px;
  padding: 3px 6px 3px 10px;
  font-size: 12px;
  color: var(--abc-text);
  max-width: 220px;
}

.abc-file-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.abc-file-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--abc-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  font-family: inherit;
}

.abc-file-chip-remove:hover {
  color: var(--abc-primary);
}

/* ---- Analýza reportu – vizuální styly ---- */
.abc-report-header {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--abc-primary);
}

.abc-section {
  display: block;
  font-weight: 600;
  color: var(--abc-muted);
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}

.abc-issue {
  display: block;
  background: #fff3cd;
  color: #856404;
  border-left: 3px solid #ffc107;
  padding: 4px 10px;
  margin: 4px 0;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
}

.abc-ok {
  display: block;
  background: #d4edda;
  color: #155724;
  border-left: 3px solid #28a745;
  padding: 4px 10px;
  margin: 4px 0;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
}

/* Stavová zpráva při analýze souborů */
.abc-status-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--abc-muted);
  background: #f8f9fa;
  border-radius: 12px;
  margin: 0 14px 8px;
  width: fit-content;
  animation: abc-fade-in 0.3s ease;
}

@keyframes abc-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tlačítko stažení reportu */
.abc-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--abc-primary);
  background: #fff;
  border: 1.5px solid var(--abc-primary);
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.abc-download-btn:hover {
  background: var(--abc-primary);
  color: #fff;
}

/* Download button inside user (red) bubble */
.abc-user .abc-bubble .abc-download-btn {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.7);
  color: #fff;
}

.abc-user .abc-bubble .abc-download-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* ---- Drag & drop overlay ---- */
.abc-drag-overlay {
  position: absolute;
  inset: 0;
  background: rgba(204, 0, 0, 0.08);
  border: 3px dashed var(--abc-primary);
  border-radius: var(--abc-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.abc-drag-overlay.visible {
  opacity: 1;
}

.abc-drag-overlay-inner {
  background: #fff;
  border: 2px solid var(--abc-primary);
  border-radius: 12px;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--abc-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ---- Mobilní responzivita ---- */
@media (max-width: 420px) {
  #abc-chatbot-widget {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  #abc-chat-trigger {
    bottom: 16px;
    right: 16px;
  }
}
