:root {
  --primary: #ff7300;
  --primary-muted: #ffe5c4;
  --primary-muted-less: #ffd7a1;
  --font-sans: Arial, Helvetica, sans-serif;
  --header-height: 80px;
  --secondary: #efefef;
  --terciary: #a2a2a2;
  --status: #10b981;
  --bg: #ffffff;
  --text: #464646;
  --shadow: 0 10px 30px rgba(2, 8, 23, 0.18);
  --status-shadow: 0 0 0 4px rgba(16, 185, 129, 0.08);
  --radius: 14px;
  --delay: 200ms;
}

html,
body,
#chat-root,
.panel-header,
.panel-body,
.composer,
.messages,
input,
button,
textarea,
select {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

#chat-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
}

#chat-bubble {
  width: 70px;
  height: 70px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: var(--bg);
  background: var(--primary);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  position: relative;
  transition:
    transform var(--delay) ease,
    opacity var(--delay) ease;
}
#chat-bubble:hover {
  transform: translateY(-2px);
}
#chat-bubble:active {
  transform: translateY(0px);
}
#chat-bubble .badge {
  position: absolute;
  top: -4px;
  right: 40px;
  width: 18px;
  height: 28px;
  padding: 0 6px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: none;
}
#chat-bubble.notify {
  animation: bubblePulse 600ms ease;
}

@keyframes bubblePulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

#chat-panel {
  width: 380px;
  height: 500px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;

  flex-direction: column;
  opacity: 0;
  transform: translateY(40px) scaleY(0.92);
  transform-origin: bottom right;

  transition:
    opacity var(--delay) ease-out,
    transform var(--delay) cubic-bezier(0.22, 1, 0.36, 1);
}
#chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scaleY(1);
}

#image-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--terciary);
  cursor: pointer;
}
#image-btn svg {
  display: block;
}
#image-btn:active {
  transform: scale(0.92);
}

.panel-header {
  position: relative;
  height: var(--header-height);
  flex: 0 0 var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg);
}

.panel-header-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.title b {
  color: var(--primary);
  font-size: 16px;
}

.subtitle {
  color: var(--terciary);
  font-size: 12px;
  margin-top: 2px;
  font-weight: 600;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--status);
  box-shadow: var(--status-shadow);
}
.status-text {
  color: var(--terciary);
  font-size: 12px;
  font-weight: 500;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: var(--primary-muted);
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  transition:
    background var(--delay) ease,
    transform var(--delay) ease;
}
.icon-btn:hover {
  background: var(--primary-muted-less);
}
.icon-btn:active {
  transform: scale(0.9);
}

.circle-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-muted);
  color: var(--primary);
  border: none;
}

.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 80%;
  padding: 12px 14px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.4;

  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}
.message img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}
.message.bot {
  align-self: flex-start;
  background: var(--secondary);
  color: var(--text);
  font-weight: 500;
  border-radius: 2px 20px 20px 20px;
}
.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--bg);
  font-weight: 500;
  border-radius: 20px 20px 2px 20px;
}

.composer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg);
}
.composer-cloud {
  display: flex;
  align-items: center;
  gap: 8px;

  background: var(--bg);
  border: 3px solid var(--terciary);
  border-radius: 999px;

  padding: 1px 2px;
}

.composer-note {
  color: var(--terciary);
  font-size: 10px;
  margin-top: 4px;
  margin-left: 6px;
  margin-right: 6px;
  margin-bottom: 2px;
  line-height: 1.2;
  font-weight: 500;
  text-align: center;
}
.composer input {
  flex: 1;
  height: 40px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 0;
  font-size: 14px;
  outline: none;
  background: var(--bg);
  color: var(--text);
  font-weight: 500;
}
.composer input:disabled {
  cursor: not-allowed;
}

#send-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #b5b5b5;
  cursor: pointer;
}
#send-btn svg {
  display: block;
}
#send-btn:active {
  transform: scale(0.92);
}

#chat-input:disabled,
#send-btn:disabled,
#image-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.typing {
  align-self: flex-start;
  background: var(--secondary);
  color: var(--terciary);
  border-radius: 14px;
  border-bottom-left-radius: 6px;
  padding: 10px 12px;
  font-weight: 600;
  display: inline-flex;
  gap: 4px;
}
.typing span {
  width: 6px;
  height: 6px;
  background: var(--terciary);
  border-radius: 999px;
  display: inline-block;
  animation: typingBlink 1.4s infinite both;
}
.typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes typingBlink {
  0% {
    opacity: 0.2;
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
  }
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.screen.active {
  display: flex;
}

.options-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.options-content h3 {
  margin: 0 0 8px 0;
  color: var(--primary);
  font-size: 16px;
}

.option-item {
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  background: var(--primary-muted);
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--delay) ease;
}
.option-item:hover {
  background: var(--primary-muted-less);
}

.options-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 8px;
  gap: 20px;
}
.options-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.terms-link {
  color: var(--terciary);
  text-decoration: underline;
  font-weight: 500;
  font-size: 14px;
  transition: color var(--delay) ease;
}
.terms-link:hover {
  color: var(--primary-muted-less);
}

.image-preview {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preview-thumb {
  position: relative;
}

.preview-thumb img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
}

.remove-thumb {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 12px;
  cursor: pointer;
}

.message img {
  cursor: pointer;
}

.message.bot ul,
.message.bot ol {
  padding-left: 18px;
  margin: 6px 0;
}
.message.bot p {
  margin: 6px 0;
}
.message.bot strong {
  font-weight: 700;
}
.message.bot a {
  color: var(--primary);
  text-decoration: underline;
}

@media (max-width: 480px) {
  #chat-root {
    right: 12px;
    bottom: 12px;
    left: auto;
  }

  #chat-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;

    width: auto;
    height: 75vh;
    border-radius: 18px;

    transform-origin: bottom center;
  }

  .messages {
    padding: 12px;
  }

  .message {
    max-width: 90%;
  }

  .composer {
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .panel-header .icon-btn,
  .panel-header .circle-btn {
    width: 48px;
    height: 48px;
  }
}

/* END CHAT I REAKCIJE - u budućnosti*/
/* .end-chat-bar {
  padding: 8px 12px;
  background: var(--bg);
  border-top: 1px solid var(--secondary);
  display: flex;
  justify-content: center;
}

.end-chat-bar.hidden {
  display: none;
}

#end-chat-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: var(--primary-muted);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--delay);
}

#end-chat-btn:hover {
  background: var(--primary-muted-less);
}

.end-chat-reactions {
  padding: 10px 12px;
  background: var(--bg);
  display: flex;
  justify-content: center;
  gap: 12px;
}

.end-chat-reactions.hidden {
  display: none;
}

.reaction-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary-muted);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--primary);
  transition: var(--delay);
}

.reaction-btn svg {
  display: block;
}

.reaction-btn:hover {
  background: var(--primary-muted-less);
}

.reaction-btn.selected {
  background: var(--primary);
  color: white;
}

.reaction-btn:disabled {
  opacity: 0.9;
  cursor: not-allowed;
}
#download-chat-btn { display: none !important; }
*/
