#tauria-ai-admin-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    /* Size is set from the plugin settings; every box property is pinned so
       theme button styles (padding, min-width, line-height) can't change it. */
    width: var(--tauria-launcher-size, 60px);
    height: var(--tauria-launcher-size, 60px);
    min-width: 0;
    min-height: 0;
    max-width: none;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tauria-primary, #007bff);
    color: white;
    font-size: calc(var(--tauria-launcher-size, 60px) * 0.42);
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    z-index: 999999;
    border: 0;
}

#tauria-ai-admin-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: min(380px, calc(100vw - 40px));
    background: white;
    border-radius: 10px;
    box-shadow: 0 14px 42px rgb(0 0 0 / 22%);
    z-index: 99999;
    border: 1px solid #cfcfcf;
    overflow: hidden;
}

.chat-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    background-color: #01b701;
    border-radius: 50%;
}

#chat-header {
    background: #ffffff;
    color: #000000;
    padding: 16px 18px 14px;
    border-bottom: 1px solid #dfdfdf;
    position: relative;
}

.chat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

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

#chat-menu-toggle,
#chat-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    color: #000000;
    cursor: pointer;
    font-size: 30px;
    line-height: 1;
}

#chat-menu-toggle {
    font-size: 34px;
    font-weight: 700;
}

#chat-menu {
    position: absolute;
    top: 58px;
    right: 54px;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid #dedede;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgb(0 0 0 / 20%);
    padding: 6px;
    z-index: 2;
}

#chat-menu[hidden] {
    display: none;
}

/* Launcher shapes (setting "Oblika plavajočega gumba"). */
html body #tauria-ai-admin-button.tauria-launcher--circle { border-radius: 50% !important; }
html body #tauria-ai-admin-button.tauria-launcher--rounded { border-radius: 28% !important; }
html body #tauria-ai-admin-button.tauria-launcher--bubble-tl { border-radius: 0 50% 50% 50% !important; }
html body #tauria-ai-admin-button.tauria-launcher--bubble-tr { border-radius: 50% 0 50% 50% !important; }
html body #tauria-ai-admin-button.tauria-launcher--bubble-bl { border-radius: 50% 50% 50% 0 !important; }
html body #tauria-ai-admin-button.tauria-launcher--bubble-br { border-radius: 50% 50% 0 50% !important; }

/* Built-in SVG icons and uploaded images scale with the button
   (setting "Velikost ikone v gumbu"). */
#tauria-ai-admin-button svg,
#tauria-ai-admin-button img {
    display: block;
    width: var(--tauria-launcher-icon-scale, 50%);
    height: var(--tauria-launcher-icon-scale, 50%);
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
    pointer-events: none;
    color: #fff;
}

/* The size set in the plugin settings must win even over theme CSS that
   forces its own button size with !important (html body = higher specificity). */
html body #tauria-ai-admin-button {
    width: var(--tauria-launcher-size, 60px) !important;
    height: var(--tauria-launcher-size, 60px) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    font-size: calc(var(--tauria-launcher-size, 60px) * 0.42) !important;
    overflow: hidden; /* an icon image at 100% follows the button's shape */
}

/* Themes often style every <button> with display:flex/inline-block, which
   would override the [hidden] attribute and keep these visible. */
#tauria-ai-admin-button[hidden],
#tauria-ai-admin-chatbot [hidden] {
    display: none !important;
}

#chat-new,
#chat-delete {
    display: block;
    width: 100%;
    background: transparent;
    border: 0;
    color: #222;
    cursor: pointer;
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 6px;
    text-align: left;
}

#chat-new:hover,
#chat-delete:hover {
    background: #f3f3f3;
}

#chat-body {
    /* Grow with the screen: the whole panel ends ~230px below the top of the
       viewport (well clear of the site header), between 300px and 620px of
       message area. */
    height: clamp(300px, calc(100vh - 400px), 620px);
    max-height: none;
    overflow-y: auto;
    /* Column layout: lets the starter questions sit at the bottom. */
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    scrollbar-width: thin;
    scrollbar-color: #c7c7c7 transparent;
}

#chat-body::-webkit-scrollbar {
    width: 6px;
}

#chat-body::-webkit-scrollbar-track {
    background: transparent;
}

#chat-body::-webkit-scrollbar-thumb {
    background-color: #c7c7c7;
    border-radius: 3px;
}

#chat-body::-webkit-scrollbar-thumb:hover {
    background-color: #aaaaaa;
}

#chat-form {
    border-top: 1px solid #ececec;
    padding-top: 12px;
    background: #fff;
}

/* One rounded field: borderless input + send icon in the brand colour. */
#chat-input-container {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 14px 6px;
    padding: 4px 6px 4px 16px;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#chat-input-container:focus-within {
    border-color: var(--tauria-primary, #007bff);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.ai-message {
    margin-top: 10px;
    margin-right: auto;
    margin-left: 0;
    max-width: 88%;
    width: fit-content;
    background: #ededed;
    padding: 14px 16px;
    border-radius: 12px 12px 12px 4px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Formatted greeting (HTML from the admin editor). */
.greeting-message {
    white-space: normal;
}

.greeting-message p {
    margin: 0 0 0.6em;
}

.greeting-message p:last-child,
.greeting-message ul:last-child,
.greeting-message ol:last-child {
    margin-bottom: 0;
}

.greeting-message ul,
.greeting-message ol {
    margin: 0.3em 0 0.6em;
    padding-left: 1.3em;
}

.ai-message a {
    color: var(--tauria-primary, #007bff);
    text-decoration: underline;
    word-break: break-all;
}

#tauria-ai-admin-chatbot #chat-input-container input#chat-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    font-family: inherit;
    font-size: 16px; /* 16px keeps iOS from zooming in on focus */
    color: #111;
}

#tauria-ai-admin-chatbot #chat-input-container input#chat-input::placeholder {
    color: #9a9a9a;
    opacity: 1;
}
.user-message {
    background: var(--tauria-primary, #007bff);
    text-align: left;
    padding: 10px 12px;
    margin-bottom: 15px;
    border-radius: 12px 12px 4px 12px;
    margin-top: 15px;
    width: fit-content;
    max-width: 82%;
    /* Visitor on the right, assistant on the left. */
    margin-left: auto;
    margin-right: 0;
    color: white;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

span#chat-title {
    display: block;
    font-size: 25px;
    font-weight: 600;
    line-height: 1.2;
}

.ai-message.error {
    background: var(--tauria-primary, #007bff);
    padding: 8px;
    margin-bottom: 10px;
    text-align: left;
    color: white;
    border-radius: 5px;
    border-bottom-left-radius: 0px;
}
#tauria-ai-admin-chatbot button#chat-send {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    color: var(--tauria-primary, #007bff);
    border: 0;
    border-radius: 10px;
    box-shadow: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

#tauria-ai-admin-chatbot button#chat-send:hover,
#tauria-ai-admin-chatbot button#chat-send:focus-visible {
    background: rgba(0, 0, 0, 0.05);
    color: var(--tauria-primary, #007bff);
}

#tauria-ai-admin-chatbot button#chat-send:active { transform: scale(0.92); }

button#chat-send svg {
    display: block;
}

#tauria-ai-admin-chatbot button#chat-send:disabled { opacity: 0.4; cursor: wait; background: transparent; }
#chat-status { min-height: 0; padding: 0 14px; font-size: 13px; color: #555; }
#chat-privacy { padding: 0 14px 10px; font-size: 10px; color: #666; line-height: 1.25; }
#chat-privacy a { color: inherit; text-decoration: underline; }
.screen-reader-text {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.hidden {
    display: none;
}

.typing-message {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    min-width: 54px;
}

.typing-message span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #777;
    animation: tauriaTyping 1.15s infinite ease-in-out;
}

.typing-message span:nth-child(2) { animation-delay: .15s; }
.typing-message span:nth-child(3) { animation-delay: .3s; }

.confirm-message {
    white-space: normal;
}

.chat-confirm-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.chat-confirm-actions button {
    border: 1px solid #d9e3f2;
    border-radius: 6px;
    padding: 7px 10px;
    cursor: pointer;
    background: #fff;
}

.chat-confirm-actions button.danger {
    background: var(--tauria-primary, #007bff);
    border-color: var(--tauria-primary, #007bff);
    color: #fff;
}

@keyframes tauriaTyping {
    0%, 80%, 100% { transform: translateY(0); opacity: .45; }
    40% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 480px) {
    #tauria-ai-admin-chatbot {
        right: 10px; bottom: 10px; width: calc(100vw - 20px); max-height: calc(100vh - 20px);
    }
    #chat-body { height: max(260px, calc(80vh - 200px)); } /* panel ~80% of the screen */
    #chat-input-container { margin: 0 10px 6px; }
}

@media (prefers-reduced-motion: reduce) {
    #tauria-ai-admin-chatbot, #tauria-ai-admin-button { scroll-behavior: auto; }
    .typing-message span { animation: none; }
}

/* Starter questions */
/* Starter questions sit at the bottom of the message area, centred,
   right above the input field. */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    flex-shrink: 0;
}

#tauria-ai-admin-chatbot .chat-suggestion {
    background: #fff;
    color: #222;
    border: 1px solid var(--tauria-primary, #007bff);
    border-radius: 18px;
    padding: 7px 12px;
    margin: 0;
    font: inherit;
    font-size: 14px;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    width: auto;
    height: auto;
}

#tauria-ai-admin-chatbot .chat-suggestion:hover,
#tauria-ai-admin-chatbot .chat-suggestion:focus-visible {
    background: var(--tauria-primary, #007bff);
    color: #fff;
}

