/* Rekono Chatbot v2 */
:root {
  --rc-primary: var(--rekono-primary, #1a56db);
  --rc-shadow: 0 8px 32px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.08);
  --rc-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
#rekono-chatbot-root * { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Toggle ── */
#rc-toggle {
  position: fixed; bottom: 28px; right: 28px;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--rc-primary); border: none; cursor: pointer;
  box-shadow: var(--rc-shadow);
  display: flex; align-items: center; justify-content: center;
  z-index: 99998; outline: none;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
}
#rc-toggle:hover { transform: scale(1.1); }
#rc-toggle svg { width: 27px; height: 27px; color: #fff; transition: opacity .15s, transform .2s; }
#rc-toggle .ico-chat { }
#rc-toggle .ico-close { position: absolute; opacity: 0; transform: rotate(-90deg); }
#rc-toggle.is-open .ico-chat  { opacity: 0; transform: rotate(90deg); }
#rc-toggle.is-open .ico-close { opacity: 1; transform: rotate(0); }

#rc-badge {
  position: absolute; top: -2px; right: -2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ef4444; border: 2px solid #fff;
  font-size: 10px; font-weight: 700; color: #fff;
  display: none; align-items: center; justify-content: center;
  font-family: var(--rc-font);
}
#rc-badge.show { display: flex; }

/* ── Window ── */
#rc-window {
  position: fixed; bottom: 100px; right: 28px;
  width: 380px; max-width: calc(100vw - 40px);
  height: 580px; max-height: calc(100vh - 140px);
  background: #fff; border-radius: 18px;
  box-shadow: var(--rc-shadow);
  display: flex; flex-direction: column;
  z-index: 99997; overflow: hidden;
  transform: scale(.9) translateY(14px); opacity: 0; pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.4,.64,1), opacity .2s;
  font-family: var(--rc-font);
}
#rc-window.is-open { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }

/* Header */
#rc-header {
  background: var(--rc-primary); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.rc-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rc-avatar svg { display: block; }
.rc-header-info { flex: 1; line-height: 1.2; }
.rc-header-name { font-weight: 700; font-size: 14px; }
.rc-header-status {
  font-size: 11px; opacity: .9; display: flex; align-items: center; gap: 4px;
}
.rc-header-status::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80; display: inline-block;
}
.rc-lang-btn {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  font-family: var(--rc-font); transition: background .15s;
}
.rc-lang-btn:hover { background: rgba(255,255,255,.28); }
.rc-close-btn {
  display: none;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff; width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer;
  align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
.rc-close-btn:hover { background: rgba(255,255,255,.28); }
@media (max-width: 600px) {
  .rc-close-btn { display: flex; }
}


/* ── Contact bar ── */
#rc-contact-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  background: #f0f9ff;
  border-bottom: 1px solid #e0f2fe;
  flex-shrink: 0;
  font-size: 12px;
  color: #0369a1;
}
.rc-contact-link {
  color: #0369a1;
  text-decoration: none;
  font-weight: 500;
}
.rc-contact-link:hover {
  text-decoration: underline;
}

/* Messages */
#rc-messages {
  flex: 1; overflow-y: auto; padding: 14px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth; background: #f8f9fb;
}
#rc-messages::-webkit-scrollbar { width: 4px; }
#rc-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.rc-msg { display: flex; gap: 7px; max-width: 94%; animation: msgIn .2s ease-out; }
@keyframes msgIn { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:none; } }
.rc-msg.bot  { align-self: flex-start; }
.rc-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.rc-msg-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--rc-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0; margin-top: 2px;
}
.rc-msg-av svg { display: block; }

.rc-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.6; word-break: break-word;
  overflow-wrap: anywhere;
}
.rc-msg.bot  .rc-bubble { background: #fff; color: #1f2937; border-bottom-left-radius: 3px; border: 0.5px solid #e5e7eb; }
.rc-msg.user .rc-bubble { background: var(--rc-primary); color: #fff; border-bottom-right-radius: 3px; }

/* Typing */
.rc-typing .rc-bubble { display: flex; gap: 4px; align-items: center; padding: 11px 14px; }
.rc-dot { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: bounce 1.2s infinite; }
.rc-dot:nth-child(2) { animation-delay: .15s; } .rc-dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }



/* Input area */
#rc-input-area {
  padding: 10px 12px; border-top: 1px solid #e5e7eb;
  background: #fff; display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;
}
#rc-input {
  flex: 1; border: 1px solid #d1d5db; border-radius: 22px;
  padding: 9px 15px; font-size: 13.5px; font-family: var(--rc-font);
  resize: none; outline: none; line-height: 1.4; max-height: 90px;
  overflow-y: auto; color: #1f2937; transition: border-color .15s;
}
#rc-input:focus { border-color: var(--rc-primary); }
#rc-input::placeholder { color: #9ca3af; }
#rc-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--rc-primary); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity .15s, transform .15s; outline: none;
}
#rc-send:hover { opacity: .88; transform: scale(1.05); }
#rc-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }
#rc-send svg { width: 17px; height: 17px; color: #fff; }

#rc-footer {
  text-align: center; font-size: 10px; color: #9ca3af;
  padding: 3px 0 7px; background: #fff; flex-shrink: 0;
}
#rc-footer { font-weight: 500; }

/* Inline shortcode mode */
.rekono-inline #rc-window {
  position: relative; bottom: auto; right: auto;
  width: 100%; height: 520px; max-height: 80vh;
  transform: none; opacity: 1; pointer-events: all;
  border-radius: 14px;
}
.rekono-inline #rc-toggle { display: none; }

@media (max-width: 600px) {
  #rc-window {
    bottom: 0; right: 0;
    width: 100%; max-width: 100%;
    height: 100%; max-height: 100%;
    border-radius: 0;
  }
  /* Skrij toggle gumb ko je chat odprt — prekriva gumb za pošiljanje */
  #rc-toggle.is-open {
    display: none !important;
    pointer-events: none !important;
  }
  #rc-toggle {
    bottom: 20px; right: 20px;
    width: 54px; height: 54px;
  }
  /* Input nad mobilno navigacijsko vrstico */
  #rc-input-area {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  /* Gumb za pošiljanje ne sme biti prekrit */
  #rc-send {
    position: relative;
    z-index: 1;
  }
}

/* ── Clickable links in bot messages ── */
.rc-bubble .rc-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: background .15s;
  margin: 1px 0;
}
.rc-bubble .rc-link::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px; flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d4ed8' stroke-width='2'%3E%3Cpath d='M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat;
}
.rc-bubble .rc-link:hover {
  background: #dbeafe;
  text-decoration: none;
}
.rc-msg.user .rc-bubble .rc-link {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.4);
  color: #fff;
}
.rc-msg.user .rc-bubble .rc-link::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2'%3E%3Cpath d='M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71'/%3E%3C/svg%3E");
}

/* ── Bot message rich formatting ── */
.rc-msg.bot .rc-bubble p {
  margin: 0 0 8px;
  line-height: 1.6;
}
.rc-msg.bot .rc-bubble p:last-child { margin-bottom: 0; }
.rc-msg.bot .rc-bubble ul,
.rc-msg.bot .rc-bubble ol {
  margin: 2px 0 8px 18px;
  padding: 0;
}
.rc-msg.bot .rc-bubble ul:last-child,
.rc-msg.bot .rc-bubble ol:last-child { margin-bottom: 0; }
.rc-msg.bot .rc-bubble li {
  margin-bottom: 5px;
  line-height: 1.55;
  padding-left: 2px;
}
.rc-msg.bot .rc-bubble li:last-child { margin-bottom: 0; }
.rc-msg.bot .rc-bubble strong {
  font-weight: 600;
  color: #111827;
}
.rc-msg.bot .rc-bubble ul { list-style: disc; }
.rc-msg.bot .rc-bubble ol { list-style: decimal; }
/* Separator between p and list */
.rc-msg.bot .rc-bubble p + ul,
.rc-msg.bot .rc-bubble p + ol { margin-top: -2px; }
