/* AskGive Embed Styles */

body {
    position: relative;
}

header {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Container and Layout */
#askgivefull {
    position: relative;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
}

.askgive-embed-container {
    position: relative;
    height: 100%;
}

.askgive-chat-wrapper {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    padding: 12px;
    overflow: hidden;
    height: calc(100vh - 120px);
}

/* Header Styles */
.askgive-chat-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 8px 0;
}

.back-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #000;
}

.header-title-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.title-with-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.askgive-title {
    font-size: 28px;
    font-weight: 600;
    color: #000;
    margin: 0;
}

.askgive-subtitle {
    font-size: 14px;
    text-align: center;
    font-weight: normal;
    color: #6b7280;
    margin: 4px 0 0 0;
}

.header-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: opacity 0.2s;
}

.icon-button:hover {
    opacity: 0.7;
}

/* Chat Body */
.askgive-chat-body {
    flex: 1;
    overflow-y: auto;
    margin: 8px 0;
    padding: 0 8px;
}

/* Welcome Message */
#gb-chatbot-welcome {
    margin-top: 20px;
}

.welcome-message {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

.bot-avatar {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
}

.welcome-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-text,
.welcome-examples {
    padding: 16px;
    background-color: #d9ebf1;
    border-radius: 8px;
    margin: 0;
    line-height: 1.6;
}

.examples-title {
    font-weight: 700;
    display: block;
    margin-bottom: 8px;
}

/* Chat Messages */
#gb-chatbody {
    margin-top: 20px;
}

.chat-message {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 8px;
    --bg-opacity: 1;
    background-color: rgb(217 235 241 / var(--bg-opacity, 1));
    font-size: 16px;
}

.chat-message.user .chat-message-content {
    background: linear-gradient(135deg, #00965e 0%, #00437b 100%);
    color: white;
    margin-left: auto;
    max-width: 70%;
}

/* Loader Animation */
.chat-loader {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    padding: 0;
}

.loader-content {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-weight: normal;
    font-size: 16px;
    color: #374151;
    background: transparent;
    padding: 0;
    margin: 0;
    border-radius: 0;
    max-width: none;
    line-height: 1.2;
}

.loader-content p {
    margin: 0;
    display: inline;
}

#gb-chatbot-loading-full {
    display: inline;
}

.typing-cursor {
    background-color: black;
    width: 5px;
    height: 16px;
    animation: blink 1s infinite;
    margin-left: 2px;
    display: inline-block;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%,
    50% {
        opacity: 1;
    }
    51%,
    100% {
        opacity: 0;
    }
}

/* Footer */
.askgive-chat-footer {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background-color: white;
    padding-bottom: 20px;
}

.chat-form {
    margin-bottom: 8px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: #00437b;
    border-radius: 8px;
}

.chat-input {
    display: block;
    padding: 10px;
    width: 100%;
    font-size: 14px;
    color: #111827;
    background-color: white;
    border-radius: 8px 0 0 8px;
    border: 1px solid #e99918;
    border-right: none;
    outline: none;
    resize: none;
    font-family: inherit;
}

.chat-input:focus {
    border-color: #e99918;
    box-shadow: 0 0 0 3px rgba(233, 153, 24, 0.1);
}

.submit-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Footer Links */
.chat-footer-links {
    margin-top: 8px;
}

.footer-content {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.copyright {
    font-size: 14px;
    margin: 0;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 16px;
    font-size: 12px;
    justify-content: flex-end;
    border-bottom: none;
}

.footer-links li {
    margin: 0;
}

.footer-link {
    color: #000;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

.footer-link:hover {
    text-decoration: underline;
}

/* FAQ Panel */
.faq-panel {
    position: absolute;
    inset: 0;
    background-color: white;
    transform: translateY(100%);
    transition: transform 0.5s ease-in-out;
}

.faq-panel.active {
    transform: translateY(0);
}

.faq-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: white;
    padding: 12px;
    overflow: hidden;
}

.faq-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 8px 0;
}

.faq-title-group {
    display: flex;
    flex-direction: column;
}

.faq-main-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

.faq-body {
    flex: 1;
    overflow-y: auto;
    margin: 8px 0;
}

.faq-content {
    max-width: 48rem;
    margin: 0 auto;
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 24px 0;
}

.accordion-item {
    border-radius: 4px;
    background-color: #f6f4ee;
}

.accordion-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    text-align: left;
    font-weight: 500;
    color: #000;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.accordion-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.accordion-question {
    color: #000;
    font-weight: 500;
    font-size: 18px;
    flex: 1;
    padding-right: 8px;
}

.accordion-icon {
    width: 20px;
    height: 20px;
    color: #000;
    transform: rotate(0);
    transition: transform 0.2s;
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 16px 16px;
    color: #374151;
}

.accordion-answer {
    font-weight: normal;
    font-size: 16px;
    color: #000;
    line-height: 1.6;
    margin: 0;
}

.faq-link {
    color: #3b82f6;
    text-decoration: underline;
}

/* Feedback Modal */
.feedback-modal {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 16px;
    max-width: 600px;
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #000;
    line-height: 1;
    padding: 0;
}

.modal-body {
    display: flex;
    flex-direction: column;
}

.terms-bubble {
    background-color: #d9ebf1 !important;
    color: #111827;
}

.terms-bubble p {
    margin: 0 0 8px 0;
}

.terms-bubble .terms-link {
    color: #3b82f6;
    text-decoration: underline;
    display: block;
    margin-bottom: 12px;
}

.terms-bubble .terms-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.terms-bubble .terms-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.terms-bubble .terms-checkbox span {
    color: #111827;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Mobile Responsive */
.mobile-break {
    display: none;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 1023px) {
    .chat-message-content,
    .chat-message-content p {
        font-size: 16px;
        line-height: 1.5rem;
    }
}

@media (max-width: 768px) {
    .askgive-container {
        position: relative;
        top: unset;
    }

    .askgive-chat-wrapper {
        padding: 8px;
        height: calc(100vh - 70px);
    }

    .askgive-chat-body {
        flex: 1;
        min-height: calc(100vh - 400px);
    }

    .askgive-chat-footer {
        flex-shrink: 0;
        padding-bottom: 10px;
    }

    .welcome-message {
        flex-direction: column;
        gap: 8px;
    }

    #streaming-message {
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: pre-wrap;
    }

    .chat-message-content {
        max-width: 70%;
        width: fit-content;
        padding: 12px 16px;
        border-radius: 8px;
        --bg-opacity: 1;
        background-color: rgb(217 235 241 / var(--bg-opacity, 1));
        word-break: break-word;
    }

    .chat-input {
        max-height: 80px;
        font-size: 14px;
    }

    .mobile-break {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    .footer-content {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .accordion-question {
        font-size: 16px;
    }

    .modal-content {
        margin: 8px;
    }
}

/* Integration with existing askgive page styles */
.askgive-interface {
    width: 100%;
    max-width: 100%;
}

/* Gravity Forms in Modal - Custom Styling */
.feedback-modal .gform_wrapper {
    margin: 0;
}

.feedback-modal .gform_wrapper .gform_body {
    padding: 0;
}

.feedback-modal .gform_wrapper .gfield {
    margin-bottom: 16px;
}

.feedback-modal .gform_wrapper .gfield_label {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.5);
    margin-bottom: 4px;
}

.feedback-modal .gform_wrapper textarea {
    width: 100%;
    border-radius: 4px;
    border: 1px solid #fdb913;
    padding: 8px;
    font-size: 14px;
    resize: vertical;
}

.feedback-modal .gform_wrapper textarea:focus {
    outline: none;
    border-color: #fdb913;
    box-shadow: 0 0 0 3px rgba(253, 185, 19, 0.1);
}

.feedback-modal .gform_wrapper .gform_footer {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding: 0;
}

.feedback-modal .gform_wrapper .gform_button {
    padding: 8px 16px;
    background-color: #fdb913;
    color: black;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    font-size: 14px;
    font-weight: 500;
}

.feedback-modal .gform_wrapper .gform_button:hover {
    background-color: #e99918;
}

/* Hide default Gravity Forms ajax spinner */
.feedback-modal .gform_ajax_spinner {
    display: none;
}

.recommended-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    margin-left: 0;
    padding-right: 16px;
}

.recommended-link {
    --bg-opacity: 1;
    background-color: rgb(255 211 104 / var(--bg-opacity, 1));
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    color: #000;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
    position: relative;
    padding-left: 32px;
}

.recommended-link:hover {
    --bg-opacity: 0.75;
    background-color: rgb(255 211 104 / var(--bg-opacity, 1));
    text-decoration: none;
}

.recommended-link:before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23007bff' class='bi bi-book' viewBox='0 0 16 16'%3E%3Cpath d='M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783'%3E%3C/path%3E%3C/svg%3E");
    position: absolute;
    left: 8px;
    font-size: 14px;
    width: 16px;
    height: 16px;
}

/* Report Button */
.report-button-container {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.report-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #6b7280;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.report-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #dc2626;
}

.report-button svg {
    width: 14px;
    height: 14px;
}

.report-button-text {
    font-weight: 500;
}

/* Hide report button in terms/welcome messages */
.terms-bubble .report-button-container,
#gb-chatbot-welcome .report-button-container {
    display: none;
}

@media (max-width: 768px) {
    .recommended-links {
        margin-left: 0;
        margin-top: 8px;
    }

    .recommended-link {
        font-size: 12px;
        padding: 4px 8px;
        padding-left: 20px;
    }
}
