#ai-chat-panel {
  position: fixed;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: #f4f4f4;
  font-family: "Roboto", Arial, sans-serif;
}
#ai-chat-panel * {
  box-sizing: border-box;
}
#ai-chat-panel .ai-chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #333;
  color: #fff;
  padding: 6px 8px;
  flex-shrink: 0;
}
#ai-chat-panel .ai-chat-toolbar-side {
  flex: 1;
  display: flex;
  align-items: center;
}
#ai-chat-panel .ai-chat-toolbar-side.right {
  justify-content: flex-end;
}
#ai-chat-panel .ai-chat-toolbar-side .ai-chat-tool-btn + .ai-chat-tool-btn {
  margin-left: 6px;
}
#ai-chat-panel .ai-chat-new-btn {
  min-width: 34px;
  font-size: 18px;
}
#ai-chat-panel .ai-chat-title {
  font-size: 15px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  padding: 0 6px;
}
#ai-chat-panel .ai-chat-title b {
  color: #f79a2b;
}
#ai-chat-panel .ai-chat-tool-btn {
  background: transparent;
  border: solid 1px #666;
  color: #fff;
  font-size: 14px;
  height: 32px;
  line-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
  border-radius: 3px;
  outline: none;
}
#ai-chat-panel .ai-chat-history-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-top: -3px;
}
#ai-chat-panel .ai-chat-history-btn {
  min-width: 34px;
  padding: 0 7px;
}
#ai-chat-panel .ai-chat-tool-btn.active {
  border-color: #f79a2b;
  color: #f79a2b;
}
#ai-chat-panel .ai-chat-tool-btn[disabled] {
  opacity: 0.5;
}

/* Istorija */
#ai-chat-panel .ai-chat-history {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  background: #fff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#ai-chat-panel .ai-chat-remaining {
  box-sizing: border-box;
  display: inline-block;
  height: 32px;
  line-height: 30px;
  border: solid 1px #666;
  border-radius: 3px;
  padding: 0 10px;
  font-size: 14px;
  white-space: nowrap;
}
#ai-chat-panel .ai-chat-history-group {
  padding: 12px 14px 4px;
  font-size: 13px;
  color: #888;
  text-transform: uppercase;
}
#ai-chat-panel .ai-chat-history-item {
  padding: 12px 14px;
  border-bottom: solid 1px #eee;
  border-left: solid 4px transparent;
  font-size: 16px;
  color: #333;
}
#ai-chat-panel .ai-chat-history-item.active {
  border-left-color: #f79a2b;
  background: #fafafa;
}
#ai-chat-panel .ai-chat-history-item.disabled {
  opacity: 0.5;
}
#ai-chat-panel .ai-chat-history-row {
  display: flex;
  align-items: center;
}
#ai-chat-panel .ai-chat-history-title {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#ai-chat-panel .ai-chat-history-delete {
  font-size: 24px;
  line-height: 20px;
  color: #aaa;
  padding: 0 4px 0 12px;
}
#ai-chat-panel .ai-chat-delete-confirm {
  margin-top: 8px;
  font-size: 14px;
  color: #555;
}
#ai-chat-panel .ai-chat-delete-confirm button {
  margin: 8px 8px 0 0;
  padding: 6px 14px;
  border: solid 1px #ccc;
  background: #fff;
  font-size: 14px;
}
#ai-chat-panel .ai-chat-delete-confirm button.confirm {
  background: #d9534f;
  border-color: #d9534f;
  color: #fff;
}
#ai-chat-panel .ai-chat-history-empty {
  padding: 20px 14px;
  color: #888;
}

/* AI nije u paketu */
#ai-chat-panel .ai-chat-unavailable {
  position: absolute;
  top: calc(44px + (100% - 108px) / 2);
  left: 12px;
  right: 12px;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  max-height: calc(100% - 132px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 4;
  padding: 16px 14px;
  background: #fff4e6;
  border: solid 1px #f79a2b;
  font-size: 15px;
  line-height: 1.4;
  color: #333;
  text-align: center;
}
#ai-chat-panel .ai-chat-unavailable-title {
  font-weight: bold;
  font-size: 16px;
}
#ai-chat-panel .ai-chat-unavailable p {
  margin: 10px 0 0;
}
#ai-chat-panel .ai-chat-unavailable-cta {
  font-weight: bold;
}
#ai-chat-panel .ai-chat-interested-btn {
  margin-top: 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 2px;
  background: #f79a2b;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  outline: none;
}
#ai-chat-panel .ai-chat-interested-btn[disabled] {
  opacity: 0.5;
}
#ai-chat-panel .ai-chat-interest-form {
  margin-top: 10px;
  text-align: left;
}
#ai-chat-panel .ai-chat-interest-form label {
  display: block;
  margin: 8px 0 4px;
  font-size: 14px;
}
#ai-chat-panel .ai-chat-interest-form input,
#ai-chat-panel .ai-chat-interest-form textarea {
  width: 100%;
  border: solid 1px #ccc;
  border-radius: 3px;
  padding: 6px 8px;
  font-size: 16px;
  font-family: inherit;
}
#ai-chat-panel .ai-chat-interest-form textarea {
  resize: none;
}
#ai-chat-panel .ai-chat-interest-error {
  margin-top: 6px;
  color: #d9534f;
  font-size: 14px;
}
#ai-chat-panel .ai-chat-interest-cancel {
  margin: 10px 0 0 8px;
  padding: 8px 14px;
  border: solid 1px #ccc;
  background: #fff;
  font-size: 15px;
}
#ai-chat-panel .ai-chat-unavailable-contact {
  font-size: 14px;
}

/* Poruke */
#ai-chat-panel .ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
}
#ai-chat-panel .ai-chat-messages.faded {
  opacity: 0.25;
}
#ai-chat-panel .ai-chat-message {
  display: flex;
  margin-bottom: 10px;
}
#ai-chat-panel .ai-chat-message.user {
  justify-content: flex-end;
}
#ai-chat-panel .ai-chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
#ai-chat-panel .ai-chat-message.model .ai-chat-bubble {
  background: #fff;
  color: #333;
  border: solid 1px #e2e2e2;
}
#ai-chat-panel .ai-chat-message.user .ai-chat-bubble {
  background: #f79a2b;
  color: #fff;
}
#ai-chat-panel .ai-chat-user-text {
  white-space: pre-wrap;
}
#ai-chat-panel .ai-chat-markdown p {
  margin: 0 0 8px;
}
#ai-chat-panel .ai-chat-markdown p:last-child {
  margin-bottom: 0;
}
#ai-chat-panel .ai-chat-markdown ul,
#ai-chat-panel .ai-chat-markdown ol {
  margin: 4px 0 8px;
  padding-left: 20px;
}
#ai-chat-panel .ai-chat-markdown h1,
#ai-chat-panel .ai-chat-markdown h2,
#ai-chat-panel .ai-chat-markdown h3,
#ai-chat-panel .ai-chat-markdown h4 {
  font-size: 16px;
  margin: 10px 0 6px;
}
#ai-chat-panel .ai-chat-markdown table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  margin: 6px 0;
}
#ai-chat-panel .ai-chat-markdown th,
#ai-chat-panel .ai-chat-markdown td {
  border: solid 1px #ddd;
  padding: 4px 6px;
  font-size: 14px;
}
#ai-chat-panel .ai-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: solid 1px #eee;
  font-size: 14px;
}
#ai-chat-panel .ai-sources ul {
  margin: 4px 0 0;
  padding-left: 18px;
}
#ai-chat-panel .ai-sources li {
  margin-bottom: 4px;
}
#ai-chat-panel .ai-sources a {
  color: #d9780a;
  text-decoration: underline;
  cursor: pointer;
}
#ai-chat-panel .ai-chat-help-link {
  display: inline-block;
  margin-top: 6px;
  color: #d9780a;
  text-decoration: underline;
  font-size: 14px;
}
#ai-chat-panel .ai-source-locked {
  color: #777;
}
#ai-chat-panel .ai-chat-loading {
  color: #777;
  font-style: italic;
}
#ai-chat-panel .ai-chat-loading .dots span {
  animation: ai-chat-dot 1.4s infinite;
  opacity: 0;
}
#ai-chat-panel .ai-chat-loading .dots span:nth-child(2) {
  animation-delay: 0.2s;
}
#ai-chat-panel .ai-chat-loading .dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes ai-chat-dot {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* Unos */
#ai-chat-panel .ai-chat-input-row {
  display: flex;
  align-items: stretch;
  padding: 8px;
  background: #fff;
  border-top: solid 1px #ddd;
  flex-shrink: 0;
}
#ai-chat-panel .ai-chat-input-row textarea {
  flex: 1;
  resize: none;
  border: solid 1px #ccc;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  max-height: 120px;
}
#ai-chat-panel .ai-chat-input-row button {
  margin-left: 8px;
  width: 48px;
  border: none;
  border-radius: 4px;
  background: #f79a2b;
  color: #fff;
  font-size: 20px;
  outline: none;
}
#ai-chat-panel .ai-chat-input-row button[disabled] {
  opacity: 0.5;
}

/* Plutajuće AI dugme na ostalim stranicama */
#ai-fab {
  position: fixed;
  right: 10px;
  bottom: 10px;
  width: 52px;
  height: 52px;
  line-height: 52px;
  border-radius: 50%;
  background: #333;
  color: #f7b733;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 9998;
  -webkit-tap-highlight-color: transparent;
}
#sb-site .view {
  padding-bottom: 70px;
}
