#chat-widget-toggle {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: none;
    background: #69aa00;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    z-index: 900;
}

#chat-widget-toggle:hover {
    background: #5c9400;
}

#chat-widget-panel {
    position: fixed;
    right: 1.5rem;
    bottom: 5.5rem;
    width: 360px;
    height: 500px;
    max-height: 70vh;
    background: #faf9f6;
    border-radius: 0.6em;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    z-index: 900;
}

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

#chat-widget-header {
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.75em 1em;
    background: #1a1a1a;
    color: #fff;
}

#chat-widget-header span {
    font-weight: 600;
    flex: 1;
}

#chat-widget-profile {
    width: 2em;
    height: 2em;
    border-radius: 50%;
}

#chat-widget-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.2rem;
}

#chat-widget-container {
    flex: 1;
    overflow-y: auto;
    padding: 1em;
}

#chat-widget-container .speech-bubble {
    font-size: 0.95rem;
    position: relative;
    background: #ece9e2;
    border-radius: 0.4em;
    color: #1a1a1a;
    padding: 0.75em 1em;
    margin-bottom: 0.75em;
    width: fit-content;
    max-width: 85%;
}

#chat-widget-container .speech-bubble.user {
    background: #69aa00;
    color: #fff;
    margin-left: auto;
}

#chat-widget-container .speech-bubble p:first-child {
    margin-top: 0;
}

#chat-widget-container .speech-bubble p:last-child {
    margin-bottom: 0;
}

#chat-widget-container .chat-link {
    color: #2f6f00;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
}

#chat-widget-container .wave {
    min-width: 40px;
}

#chat-widget-container .wave .dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    margin-right: 8px;
    background: #1a1a1a;
    animation: chat-widget-wave 1.3s linear infinite;
}

#chat-widget-container .wave .dot:nth-child(2) {
    animation-delay: -1.1s;
}

#chat-widget-container .wave .dot:nth-child(3) {
    animation-delay: -0.9s;
    margin-right: 0;
}

@keyframes chat-widget-wave {
    0%, 60%, 100% { transform: initial; }
    30% { transform: translateY(-8px); }
}

#chat-widget-form {
    display: flex;
    gap: 0.5em;
    padding: 0.75em;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

#chat-widget-input {
    flex: 1;
    resize: none;
    font: inherit;
    font-size: 0.9rem;
    padding: 0.5em 0.6em;
    border: 1px solid #ccc;
    border-radius: 0.4em;
}

#chat-widget-input:focus {
    outline: none;
    border-color: #69aa00;
}

#chat-widget-submit {
    border: none;
    border-radius: 0.4em;
    background: #69aa00;
    color: #fff;
    padding: 0 1em;
    cursor: pointer;
    font: inherit;
}

#chat-widget-submit:hover {
    background: #5c9400;
}

.chat-widget-pdf-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget-pdf-backdrop[hidden] {
    display: none;
}

.chat-widget-pdf-modal {
    background: #222;
    border-radius: 0.5rem;
    width: 90vw;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget-pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #111;
    border-bottom: 1px solid #333;
}

.chat-widget-pdf-modal-header a {
    color: rgba(243, 211, 0, 0.9);
    font-size: 1rem;
}

#chat-widget-pdf-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

#chat-widget-pdf-embed {
    flex: 1;
    width: 100%;
    border: none;
}

@media only screen and (max-width: 600px) {
    #chat-widget-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}
