/* webroot/css/chatbot.css */

.chatbot-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: auto;
    margin: 0;
    padding: 12px 18px;
    border: none;
    border-radius: 999px;
    background: #124c24;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: normal;
    line-height: 1.2;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transition: background-color 0.2s ease;
}

.chatbot-toggle:hover {
    background: #0c3719;
}

.chatbot-toggle:focus-visible {
    outline: 3px solid #e7eee8;
    outline-offset: 3px;
}

.chatbot-toggle-icon {
    display: block;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.chatbot-toggle-label {
    display: block;
    font-family: "Raleway", sans-serif;
    font-weight: 600;
    line-height: 20px;
}

.chatbot-panel {
    position: fixed;
    right: 20px;
    bottom: 84px;
    z-index: 1000;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 110px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fbf9f5;
    border: 1px solid #c9bca9;
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

.chatbot-panel[hidden] {
    display: none;
}

.chatbot-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #124c24;
    color: #ffffff;
}

.chatbot-header-content {
    min-width: 0;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-title {
    margin: 0;
    color: #ffffff;
    font-family: "Raleway", sans-serif;
    font-size: 18px;
    line-height: 1.2;
}

.chatbot-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.4;
    opacity: 0.9;
}

.chatbot-reset,
.chatbot-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-height: 32px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    background: transparent;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: normal;
    line-height: 1.2;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chatbot-reset:hover,
.chatbot-reset:focus,
.chatbot-close:hover,
.chatbot-close:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
    color: #ffffff;
    outline: 0;
}

.chatbot-close {
    width: 32px;
    min-width: 32px;
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
}

.chatbot-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 14px;
}

.chatbot-message {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-line;
}

.chatbot-message-user {
    align-self: flex-end;
    background: #124c24;
    color: #ffffff;
}

.chatbot-message-assistant {
    align-self: flex-start;
    background: #e7eee8;
    color: #2f2e2c;
}

.chatbot-message-error {
    align-self: flex-start;
    background: #fbe9e7;
    color: #8a1c1c;
}

.chatbot-message a:not(.chatbot-path-link) {
    color: #124c24;
    text-decoration: underline;
}

.chatbot-path-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 4px 6px 4px 0;
    padding: 7px 12px;
    min-height: 32px;
    border-radius: 999px;
    background: #124c24;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: normal;
    text-decoration: none;
    vertical-align: middle;
    white-space: nowrap;
}

.chatbot-path-link:hover,
.chatbot-path-link:focus {
    background: #0c3719;
    color: #ffffff;
    text-decoration: none;
}

.chatbot-suggestions-section {
    border-top: 1px solid #ded5c8;
}

.chatbot-suggestions-toggle {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 8px 14px;
    border: 0;
    border-radius: 0;
    background: #fbf9f5;
    color: #124c24;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: normal;
    line-height: 1.2;
    text-align: left;
    text-transform: none;
}

.chatbot-suggestions-toggle:hover,
.chatbot-suggestions-toggle:focus,
.chatbot-suggestions-toggle:focus-visible {
    border: 0;
    background: #f1eee7;
    color: #124c24;
}

.chatbot-suggestions-toggle:focus-visible {
    outline: 2px solid #124c24;
    outline-offset: -2px;
}

.chatbot-suggestions-toggle svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    transition: transform 0.18s ease;
}

.chatbot-suggestions-toggle[aria-expanded="false"] svg {
    transform: rotate(180deg);
}

.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 14px 12px;
}

.chatbot-suggestions[hidden] {
    display: none;
}

.chatbot-suggestion {
    height: auto;
    min-height: 34px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid #124c24;
    border-radius: 999px;
    background: #ffffff;
    color: #124c24;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: normal;
    line-height: 1.2;
    text-transform: none;
    white-space: normal;
    cursor: pointer;
}

.chatbot-suggestion:hover,
.chatbot-suggestion:focus {
    background: #124c24;
    border-color: #124c24;
    color: #ffffff;
    outline: 0;
}

.chatbot-status {
    margin: 0;
    padding: 0 14px 6px;
    min-height: 24px;
    color: #5b5545;
    font-size: 12px;
    line-height: 18px;
}

.chatbot-status[hidden] {
    display: block;
    visibility: hidden;
}

.chatbot-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px 14px;
    border-top: 1px solid #c9bca9;
}

.chatbot-input {
    flex: 1;
    height: auto;
    min-height: 42px;
    max-height: 120px;
    margin: 0;
    padding: 10px;
    border: 1px solid #c9bca9;
    border-radius: 10px;
    resize: none;
    background: #ffffff;
    color: #2f2e2c;
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.chatbot-input:focus {
    border-color: #124c24;
    outline: 2px solid #124c24;
    outline-offset: 1px;
}

.chatbot-send {
    height: 42px;
    margin: 0;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: #124c24;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: normal;
    line-height: 42px;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
}

.chatbot-send:hover:not(:disabled) {
    background: #0c3719;
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: default;
}

.chatbot-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@media (max-width: 480px) {
    .chatbot-panel {
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chatbot-toggle {
        right: 16px;
        bottom: 16px;
    }

    .chatbot-suggestion,
    .chatbot-path-link {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .chatbot-panel {
        opacity: 1;
        transform: translateY(0);
        transition:
            opacity 0.2s ease,
            transform 0.2s ease;
    }
}
