/* Lakeland Networks Chatbot */

.lcb-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;
}

/* Links inside the chat stream */
#chatbox a {
    color: var(--lcb-primary, #004080);
    text-decoration: underline;
}

/* Bubble + tooltip wrapper (floating) */
#chatbotBubbleWrapper {
    position: fixed;
    bottom: 90px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 99999;
}

#chatbotTooltip {
    background-color: var(--lcb-primary, #004080);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    animation: fadeInSlideLeft 0.3s ease-out;
}

#chatbotBubble {
    width: 60px;
    height: 60px;
    background: var(--lcb-accent, #0073aa);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 4px;
}

#chatbotBubble img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    display: block;
}

@keyframes fadeInSlideLeft {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Main window */
#chatbotWindow {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 500px;
    height: 550px;
    background: var(--lcb-background, #fff);
    color: var(--lcb-text, #222);
    border: 1px solid #ccc;
    display: none;
    flex-direction: column;
    z-index: 99998;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#chatHeader {
    background-color: var(--lcb-primary, #004080);
    color: white;
    padding: 10px;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lcb-chat-view {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.lcb-chat-view[hidden],
.lcb-contact-view[hidden] {
    display: none !important;
}

#chatbox {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: var(--lcb-background, #fff);
    color: var(--lcb-text, #222);
    display: flex;
    flex-direction: column;
}

#chatbox h1,
#chatbox h2,
#chatbox h3,
#chatbox h4,
#chatbox h5,
#chatbox h6 {
    color: var(--lcb-primary, #004080);
    margin: 8px 0 6px;
    font-weight: 700;
}

/* Assistant name inside bot messages */
#chatbox .bot-message h4 {
    font-size: 14px;
    margin: 4px 0 2px;
    line-height: 1.2;
}

#chatbox p {
    margin: 6px 0;
    line-height: 1.45em;
    color: var(--lcb-text, #222);
}

/* Compact lists inside chat */
#chatbox ul.lcb-list,
#chatbox ul {
    margin: 6px 0;
    padding-left: 18px;
}

#chatbox li {
    margin: 3px 0;
    line-height: 1.35em;
}

/* Plan blocks */
#chatbox .plan-block {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 10px;
    margin: 8px 0;
    background: #fafafa;
}

#chatbox .plan-title {
    font-weight: 800;
    color: var(--lcb-primary, #004080);
    margin-bottom: 6px;
}

#chatbox .plan-line {
    margin: 3px 0;
    color: var(--lcb-text, #222);
    line-height: 1.35em;
}

#chatInput {
    display: flex;
    border-top: 1px solid #ccc;
    padding: 8px;
    background: #f1f1f1;
    gap: 8px;
}

#userInput {
    flex: 1;
    resize: none;
    overflow-y: auto;
    max-height: 150px;
    padding: 6px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
    min-height: 2.6em;
}

#chatbotSendButton {
    padding: 6px 12px;
    background-color: var(--lcb-primary, #004080);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
}

#chatbotSendButton:disabled {
    cursor: wait;
    opacity: 0.65;
}

#chatClose {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

#typingIndicator {
    font-style: italic;
    color: #888;
    padding: 5px 10px;
}

#typingIndicator .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top: 2px solid var(--lcb-primary, #004080);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.user-message {
    align-self: flex-end;
    max-width: 90%;
    background: var(--lcb-user-background, #e9f2ff);
    border: 1px solid #cfe2ff;
    padding: 8px 10px;
    margin: 6px 0;
    border-radius: 8px;
    color: var(--lcb-user-text, #002b5c);
}

.bot-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 6px 0;
    max-width: 95%;
}

.bot-message img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 8px 10px 10px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

#newConversationBtn,
#downloadTranscriptBtn,
#lcbContactUsBtn {
    background-color: #f1f1f1;
    color: var(--lcb-primary, #004080);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
}

#lcbContactUsBtn {
    background-color: var(--lcb-primary, #004080);
    border-color: var(--lcb-primary, #004080);
    color: #fff;
    font-weight: 600;
}

.lcb-contact-view {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    background: var(--lcb-background, #fff);
    color: var(--lcb-text, #222);
}

.lcb-contact-view h2 {
    margin: 8px 0 4px;
    color: var(--lcb-primary, #004080);
    font-size: 20px;
}

.lcb-contact-view p {
    line-height: 1.4;
}

.lcb-contact-form-container,
.lcb-contact-form-container .gform_wrapper,
.lcb-contact-form-container form,
.lcb-contact-form-container fieldset,
.lcb-contact-form-container .gform_fields,
.lcb-contact-form-container .gfield,
.lcb-contact-form-container .ginput_container {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

.lcb-contact-form-container input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
.lcb-contact-form-container select,
.lcb-contact-form-container textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.lcb-contact-form-container textarea {
    resize: vertical;
}

.lcb-contact-form-container .gform_validation_errors,
.lcb-contact-form-container .validation_message,
.lcb-contact-form-container .gfield_validation_message {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.lcb-contact-form-container input[type="submit"],
.lcb-contact-form-container button[type="submit"] {
    max-width: 100%;
    padding: 8px 14px;
    border: 0;
    border-radius: 5px;
    background: var(--lcb-primary, #004080);
    color: #fff;
    cursor: pointer;
}

#chatbotBubble:focus-visible,
#chatClose:focus-visible,
#chatbotSendButton:focus-visible,
#newConversationBtn:focus-visible,
#downloadTranscriptBtn:focus-visible,
#lcbContactUsBtn:focus-visible,
.lcb-contact-form-container input:focus-visible,
.lcb-contact-form-container select:focus-visible,
.lcb-contact-form-container textarea:focus-visible,
.lcb-contact-form-container button:focus-visible,
#userInput:focus-visible {
    outline: 3px solid var(--lcb-focus, #ffbf47);
    outline-offset: 2px;
}

.lcb-conversation-notice {
    align-self: center;
    margin: 8px 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f1f1;
    color: #555;
    font-size: 12px;
    text-align: center;
}

.lcb-privacy-notice {
    margin: 0;
    padding: 8px 10px 10px;
    border-top: 1px solid var(--lcb-notice-border, #c7dced);
    background: var(--lcb-notice-background, #eaf4ff);
    color: var(--lcb-notice-text, #173b5f);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.lcb-privacy-notice[hidden] {
    display: none !important;
}

.lcb-contact-privacy-notice {
    background: var(--lcb-notice-background, #eaf4ff);
}

#chatbotWindow .lcb-chat-privacy-notice,
#chatbotWindow .lcb-contact-privacy-notice {
    box-sizing: border-box;
    margin: 0;
    padding: 8px 10px 10px;
}

.lcb-contact-privacy-notice.lcb-notice-pulse {
    animation: lcbNoticePulse 0.75s ease-in-out 2;
}

@keyframes lcbNoticePulse {
    0%, 100% {
        background: var(--lcb-notice-background, #eaf4ff);
        box-shadow: inset 0 0 0 0 var(--lcb-notice-border, #c7dced);
    }
    50% {
        background: var(--lcb-notice-background, #eaf4ff);
        box-shadow: inset 0 0 0 3px var(--lcb-notice-border, #c7dced);
    }
}

/* Smaller screens */
@media screen and (max-width: 480px) {
    #chatbotWindow {
        right: 10px;
        left: 10px;
        width: auto;
        max-width: 100%;
        height: 90vh;
        height: 90dvh;
        bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    }

    #chatbotBubbleWrapper {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        right: 20px;
    }

    .chat-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .lcb-contact-view {
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #chatbotTooltip,
    #typingIndicator .spinner {
        animation: none;
    }

    #chatbotWindow *,
    #chatbotBubbleWrapper * {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .lcb-contact-privacy-notice.lcb-notice-pulse {
        animation: none;
    }
}
