.maca-tjatt {
    --maca-tjatt-accent: #1f6f4a;
    --maca-tjatt-toggle-bg: #1f6f4a;
    --maca-tjatt-toggle-ring-width: 4px;
    --maca-tjatt-bg: #ffffff;
    --maca-tjatt-border: #d8e2dc;
    --maca-tjatt-avatar-size: 44px;
    --maca-tjatt-toggle-avatar-size: 48px;
    --maca-tjatt-toggle-min-size: 64px;
    font-family: inherit;
    max-width: 420px;
}

.maca-tjatt--floating {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 99990;
    max-width: min(420px, calc(100vw - 32px));
}

.maca-tjatt-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 56px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--maca-tjatt-toggle-bg, var(--maca-tjatt-accent));
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.maca-tjatt-toggle:has(.maca-tjatt-toggle-avatar) {
    background: transparent;
    padding: 0;
    box-shadow: none;
    min-width: auto;
    min-height: auto;
}

.maca-tjatt-toggle--loading {
    visibility: hidden;
}

.maca-tjatt-toggle-avatar {
    display: block;
    width: var(--maca-tjatt-toggle-avatar-size);
    height: var(--maca-tjatt-toggle-avatar-size);
    box-shadow:
        0 0 0 var(--maca-tjatt-toggle-ring-width) var(--maca-tjatt-toggle-bg, var(--maca-tjatt-accent)),
        0 8px 24px rgba(0, 0, 0, 0.18);
}

.maca-tjatt--floating .maca-tjatt-toggle {
    animation:
        maca-tjatt-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both,
        maca-tjatt-attention 1.4s ease-in-out 0.75s 1;
}

.maca-tjatt--floating .maca-tjatt-toggle.maca-tjatt-toggle--attention {
    animation: maca-tjatt-attention 1.4s ease-in-out 1;
}

@keyframes maca-tjatt-enter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.88);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes maca-tjatt-attention {
    0%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }

    55% {
        transform: translateY(0);
    }

    75% {
        transform: translateY(-3px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .maca-tjatt--floating .maca-tjatt-toggle {
        animation: maca-tjatt-enter 0.2s ease both;
    }
}

.maca-tjatt-panel {
    margin-top: 12px;
    border: 1px solid var(--maca-tjatt-border);
    border-radius: 16px;
    background: var(--maca-tjatt-bg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.maca-tjatt--floating .maca-tjatt-panel {
    margin-top: 0;
}

.maca-tjatt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--maca-tjatt-accent) 8%, white);
    border-bottom: 1px solid var(--maca-tjatt-border);
}

.maca-tjatt-header-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.maca-tjatt-title {
    font-weight: 600;
}

.maca-tjatt--avatar-sm {
    --maca-tjatt-avatar-size: 32px;
    --maca-tjatt-toggle-avatar-size: 40px;
    --maca-tjatt-toggle-min-size: 52px;
}

.maca-tjatt--avatar-lg {
    --maca-tjatt-avatar-size: 56px;
    --maca-tjatt-toggle-avatar-size: 64px;
    --maca-tjatt-toggle-min-size: 80px;
}

.maca-tjatt-avatar,
.maca-tjatt-toggle-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.maca-tjatt-avatar {
    width: var(--maca-tjatt-avatar-size);
    height: var(--maca-tjatt-avatar-size);
}

.maca-tjatt-avatar-preview {
    margin: 8px 0 0;
}

.maca-tjatt-avatar-preview-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.maca-tjatt-avatar-preview-wrap {
    max-width: none;
}

.maca-tjatt-avatar-preview-wrap .maca-tjatt-avatar-preview-image,
.maca-tjatt-avatar-preview-wrap .maca-tjatt-avatar-preview-toggle img {
    display: block;
    width: var(--maca-tjatt-toggle-avatar-size);
    height: var(--maca-tjatt-toggle-avatar-size);
    max-width: var(--maca-tjatt-toggle-avatar-size);
    max-height: var(--maca-tjatt-toggle-avatar-size);
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow:
        0 0 0 var(--maca-tjatt-toggle-ring-width) var(--maca-tjatt-toggle-bg, var(--maca-tjatt-accent)),
        0 8px 24px rgba(0, 0, 0, 0.18);
}

.maca-tjatt-avatar-custom {
    margin-top: 12px;
}

.maca-tjatt-avatar-custom[hidden] {
    display: none;
}

.maca-tjatt-close {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}

.maca-tjatt-messages {
    min-height: 180px;
    max-height: 320px;
    overflow: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.maca-tjatt-message {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.maca-tjatt-message--user {
    align-self: flex-end;
    background: color-mix(in srgb, var(--maca-tjatt-accent) 12%, white);
}

.maca-tjatt-message--assistant {
    align-self: flex-start;
    background: #f5f5f5;
}

.maca-tjatt-message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.maca-tjatt-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    border: 0;
    border-radius: 10px;
    padding: 8px 14px;
    background: var(--maca-tjatt-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.maca-tjatt-cta--booking {
    width: 100%;
}

.maca-tjatt-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.maca-tjatt-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--maca-tjatt-border);
    background: #fff;
    color: var(--maca-tjatt-accent);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
}

.maca-tjatt-link:hover,
.maca-tjatt-link:focus {
    background: color-mix(in srgb, var(--maca-tjatt-accent) 8%, white);
}

.maca-tjatt-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--maca-tjatt-border);
}

.maca-tjatt-input {
    width: 100%;
    resize: vertical;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--maca-tjatt-border);
    border-radius: 10px;
    font: inherit;
}

.maca-tjatt-send {
    align-self: end;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--maca-tjatt-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.maca-tjatt-send:disabled {
    opacity: 0.6;
    cursor: wait;
}

.maca-tjatt--admin-test {
    max-width: 640px;
    margin-top: 12px;
}

.maca-tjatt--admin-test .maca-tjatt-panel {
    margin-top: 0;
}

.maca-tjatt--admin-test .maca-tjatt-messages {
    min-height: 220px;
    max-height: 420px;
}

@media (max-width: 480px) {
    .maca-tjatt--floating {
        right: 12px;
        bottom: 12px;
    }

    .maca-tjatt-messages {
        max-height: 50vh;
    }
}

.maca-tjatt-avatar-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.maca-tjatt-avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 96px;
    padding: 10px;
    border: 1px solid #c3c4c7;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: center;
}

.maca-tjatt-avatar-option:has(input:checked) {
    border-color: #1f6f4a;
    box-shadow: 0 0 0 1px #1f6f4a;
}

.maca-tjatt-avatar-option input {
    margin: 0;
}

.maca-tjatt-avatar-option img {
    border-radius: 50%;
    object-fit: cover;
}

.maca-tjatt-avatar-option-custom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f0f0f1;
    color: #50575e;
    font-size: 28px;
    line-height: 1;
}

.maca-tjatt-avatar-custom {
    margin-top: 4px;
}
