/* =========================================================
   MAIN CONTAINER
========================================================= */

#homeland-chatbot {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999999;
}

#homeland-chatbot,
#homeland-chatbot * {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif !important;
}

/* =========================================================
   LAUNCHER
========================================================= */

.homeland-launcher {
    display: flex;
    align-items: center;
    gap: 8px;

    border: 0;
    cursor: pointer;
    background: transparent;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;

    position: relative;
}

.launcher-icon {
    font-size: 16px;
    line-height: 1;
}

.bubble-text {
    border-radius: 8px;
    padding: 5px 8px;
    background-color: #E5E0D6;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    color: #333;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5em;
    margin-bottom: 80px;
    animation: wa-bounce 2s infinite ease-in-out;
    max-width: 185px;
}
.bubble-img {
    position: absolute;
    right: 0;
    bottom: 0;
    height: 70px;
    width: 70px;
    border-radius: 100%;
}

/* Gentle bounce animation for the popup */
@keyframes wa-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* =========================================================
   CHAT WINDOW
========================================================= */

.homeland-window {
    display: none;

    width: 390px;
    height: 600px;

    overflow: hidden;

    background: #ffffff;

    border-radius: 20px;

    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.18),
        0 6px 20px rgba(15, 23, 42, 0.08);

    flex-direction: column;
}

.homeland-window.is-open {
    display: flex;
}


/* =========================================================
   HEADER
========================================================= */

.homeland-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 74px;
    padding: 13px 16px;

    background: #013D1F;
    color: #ffffff;

    flex-shrink: 0;
}

.homeland-brand {
    display: flex;
    align-items: center;
    gap: 11px;

    min-width: 0;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.12);

    font-size: 20px;
    line-height: 1;
}

.brand-icon img {
    height: 45px;
}

.homeland-brand strong {
    display: block;

    font-size: 19px;
    line-height: 1.15;
    font-weight: 700;

    white-space: nowrap;
}

.homeland-brand small {
    display: block;

    margin-top: 3px;

    color: rgba(255, 255, 255, 0.68);

    font-size: 12px;
    line-height: 1.2;
}

.homeland-close {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    border: 0;
    border-radius: 50%;

    background: transparent;
    color: #ffffff;

    font-family: Arial, sans-serif;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;

    cursor: pointer;
}

.homeland-close:hover {
    background: rgba(255, 255, 255, 0.10);
}


/* =========================================================
   MESSAGES
========================================================= */

.homeland-messages {
    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 16px;

    background: #f8fafc;

    scroll-behavior: smooth;
}

.homeland-messages::-webkit-scrollbar {
    width: 5px;
}

.homeland-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.homeland-messages {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}


/* =========================================================
   MESSAGES
========================================================= */

.message {
    display: flex;
    width: 100%;
    margin-bottom: 12px;
}

.assistant-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    display: block;

    width: fit-content;
    max-width: 88%;

    padding: 11px 14px;

    border: 1px solid #e1e5ea;
    border-radius: 14px;

    background: #ffffff;
    color: #1f2937;

    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;

    overflow-wrap: anywhere;
    word-break: normal;
}

.assistant-message .message-content {
    border-bottom-left-radius: 5px;
}

.user-message .message-content {
    background: #013D1F;
    color: #ffffff;

    border-color: #013D1F;

    border-bottom-right-radius: 5px;
}


/* =========================================================
   RELATED CONTENT WRAPPER
========================================================= */

.homeland-related {
    width: 100%;
    margin: 4px 0 16px;
}

.homeland-related-title {
    margin: 2px 0 8px;
    color: #013D1F;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

/* =========================================================
   SOURCE SECTION
========================================================= */

.source-section {
    display: block;

    width: 100%;

    margin: 4px 0 16px;
}

.source-heading {
    margin: 0 0 8px;

    color: #013D1F;

    font-size: 13px;
    font-weight: 700;

    line-height: 1.3;
}


/* =========================================================
   SOURCE CAROUSEL
========================================================= */

.source-carousel {
    display: flex;
    width: 100%;
    gap: 10px;
    overflow-x: auto;
    padding: 1px 1px 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    margin-top: 10px;
}

.source-carousel::-webkit-scrollbar {
    height: 4px;
}

.source-carousel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}


/* =========================================================
   SOURCE CARD
========================================================= */

.homeland-source-card {
    display: flex;
    flex-direction: column;

    flex: 0 0 215px;

    width: 215px;
    min-width: 215px;
    max-width: 215px;

    overflow: hidden;

    background: #ffffff;

    border: 1px solid #e1e7ee;

    border-radius: 13px;

    scroll-snap-align: start;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.04);
}

.homeland-source-card:hover {
    box-shadow:
        0 7px 18px rgba(15, 23, 42, 0.09);
}


/* =========================================================
   SOURCE IMAGE
========================================================= */

.homeland-source-image {
    display: block;

    width: 100% !important;
    height: 108px !important;

    min-height: 108px;
    max-height: 108px;

    object-fit: cover !important;

    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;

    background: #e2e8f0;

    flex-shrink: 0;
}

.homeland-source-card.no-thumbnail .homeland-source-body {
    padding-top: 13px;
}


/* =========================================================
   SOURCE CARD BODY
========================================================= */

.homeland-source-body {
    display: block;

    width: 100%;

    min-width: 0;

    padding: 10px 11px 12px;

    overflow: hidden;
}


/* =========================================================
   SOURCE META
========================================================= */

.homeland-source-meta {
    display: flex;
    align-items: center;

    gap: 6px;

    width: 100%;

    margin-bottom: 5px;

    color: #64748b !important;

    font-size: 9px !important;
    font-weight: 700 !important;

    line-height: 1.3 !important;

    text-transform: uppercase !important;

    letter-spacing: 0.045em !important;

    white-space: nowrap !important;

    overflow: hidden;
}

.homeland-source-meta span {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
}

.homeland-source-meta span + span::before {
    content: "•";

    margin-right: 6px;

    color: #cbd5e1;
}


/* =========================================================
   SOURCE TITLE
========================================================= */

.homeland-source-title {
    display: -webkit-box;

    width: 100%;

    min-height: 40px;
    max-height: 40px;

    margin: 0;

    overflow: hidden;

    color: #013D1F !important;

    font-size: 13px !important;
    font-weight: 700 !important;

    line-height: 1.42 !important;

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* =========================================================
   SOURCE AUTHOR
========================================================= */

.homeland-source-author {
    font-size: 13px !important;
    margin: 5px 0;
    color: #555 !important;
}

/* =========================================================
   SOURCE LINK
========================================================= */

.homeland-source-link {
    display: inline-block;

    max-width: 100%;

    margin-top: 9px;

    color: #013D1F !important;

    text-decoration: none;

    font-size: 11px !important;
    font-weight: 700 !important;

    line-height: 1.3 !important;

    white-space: nowrap !important;
}

.homeland-source-link:hover {
    text-decoration: underline;
}


/* =========================================================
   DEFENSIVE SOURCE RULES
   Prevent raw content from breaking the cards.
========================================================= */

.source-section img {
    max-width: 100%;
}

.source-section .source-card img {
    width: 100%;
    max-width: 100%;
}

.source-section .source-card h1,
.source-section .source-card h2,
.source-section .source-card h3,
.source-section .source-card h4,
.source-section .source-card p {
    margin-top: 0;
    margin-bottom: 8px;
}

.source-section .source-card a {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.source-section .homeland-source-body > * {
    max-width: 100%;
}


/* =========================================================
   TYPING INDICATOR
========================================================= */

.homeland-typing {
    display: none !important;

    align-items: center;

    gap: 5px;

    height: 24px;

    padding: 4px 16px 8px;

    background: #f8fafc;
}

.homeland-typing.is-visible {
    display: flex !important;
}

.homeland-typing span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #9ca6b5;

    animation: homelandTyping 1.2s infinite ease-in-out;
}

.homeland-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.homeland-typing span:nth-child(3) {
    animation-delay: 0.30s;
}

@keyframes homelandTyping {
    0%,
    60%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-2px);
    }
}


/* =========================================================
   INPUT
========================================================= */

.homeland-input-area {
    display: flex;
    align-items: flex-end;

    gap: 8px;

    padding: 12px;

    background: #ffffff;

    border-top: 1px solid #e5e7eb;

    flex-shrink: 0;
}

.homeland-input-area textarea {
    flex: 1;

    min-width: 0;

    min-height: 46px;
    max-height: 100px;

    resize: none;

    border: 1px solid #cbd5e1;
    border-radius: 50px;

    padding: 11px 13px;

    outline: none;

    background: #ffffff;
    color: #1f2937;

    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.homeland-input-area textarea::placeholder {
    color: #8a8f98;
}

.homeland-input-area textarea:focus {
    border-color: #64748b;

    box-shadow:
        0 0 0 2px rgba(100, 116, 139, 0.08);
}


/* =========================================================
   SEND BUTTON
========================================================= */

.homeland-input-area button {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 46px;

    width: 46px;
    height: 46px;

    border: 0;
    border-radius: 100%;

    background: #013D1F;
    color: #ffffff;

    font-family: inherit;
    font-size: 19px;
    line-height: 1;

    cursor: pointer;
}

.homeland-input-area button:hover {
    transform: translateY(-1px);
}

.homeland-input-area button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {

    #homeland-chatbot {
        right: 10px;
        bottom: 10px;
    }

    .homeland-window {
        position: fixed;

        left: 8px;
        right: 8px;
        bottom: 8px;

        width: auto;

        height: calc(var(--homeland-viewport-height, 100dvh) - 16px);

        max-height: 720px;

        border-radius: 18px;
    }

    .homeland-header {
        min-height: 68px;
        padding: 11px 13px;
    }

    .brand-icon {
        width: 38px;
        height: 38px;

        flex-basis: 38px;

        font-size: 18px;
    }

    .homeland-brand {
        gap: 9px;
    }

    .homeland-brand strong {
        font-size: 17px;
    }

    .homeland-brand small {
        font-size: 11px;
    }

    .homeland-close {
        width: 36px;
        height: 36px;

        flex-basis: 36px;

        font-size: 26px;
    }

    .homeland-messages {
        padding: 13px;
    }

    .message {
        margin-bottom: 10px;
    }

    .message-content {
        max-width: 91%;

        padding: 10px 12px;

        font-size: 14px;
        line-height: 1.5;
    }

    .source-card {
        flex-basis: 205px;

        width: 205px;
        min-width: 205px;
        max-width: 205px;
    }

    .source-thumbnail {
        height: 102px !important;
        min-height: 102px;
        max-height: 102px;
    }

    .homeland-source-body {
        padding: 9px 10px 11px;
    }

    .source-title {
        font-size: 12.5px;
    }

    .source-link {
        font-size: 11px;
    }

    .homeland-input-area {
        padding: 10px;
    }

    .homeland-input-area textarea {
        min-height: 44px;
        font-size: 14px;
    }

    .homeland-input-area button {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }
}


/* =========================================================
   VERY SMALL MOBILE
========================================================= */

@media (max-width: 380px) {

    .homeland-window {
        left: 5px;
        right: 5px;
        bottom: 5px;

        height: calc(var(--homeland-viewport-height, 100dvh) - 10px);

        border-radius: 16px;
    }

    .homeland-messages {
        padding: 11px;
    }

    .source-card {
        flex-basis: 190px;

        width: 190px;
        min-width: 190px;
        max-width: 190px;
    }

    .source-thumbnail {
        height: 95px !important;
        min-height: 95px;
        max-height: 95px;
    }
}
/* =========================================================
   RESPONSE FEEDBACK
========================================================= */
.homeland-feedback {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: -5px 0 14px 2px;
    color: #64748b;
    font-size: 11px;
}

.homeland-feedback-label {
    margin-right: 2px;
}

.homeland-feedback button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.homeland-feedback button:hover,
.homeland-feedback button.is-selected {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.homeland-feedback.is-complete .homeland-feedback-label {
    color: #475569;
}


/* =========================================================
   HOMEland AI — Elementor isolation
   Prevent WordPress / Elementor button styles from leaking in
========================================================= */

#homeland-chatbot button {
    white-space: normal !important;
    padding: 0 !important;
    margin: 0 !important;
}

#homeland-chatbot > button {
    background: transparent !important;
}

#homeland-chatbot button {
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    outline: none;
}

#homeland-chatbot button:hover,
#homeland-chatbot button:focus,
#homeland-chatbot button:active {
    box-shadow: none;
    outline: none;
}

/* Chat trigger */
#homeland-chatbot .homeland-toggle {
    margin: 0;
    padding: 0;
    border: 0;
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
}

/* Close button */
#homeland-chatbot .homeland-close {
    margin: 0;
    padding: 0;
    border: 0;
    text-transform: none;
    letter-spacing: normal;
}

/* Send button */
#homeland-chatbot .homeland-input-area button {
    margin: 0;
    padding: 0;
    border: 0;
    text-transform: none;
    letter-spacing: normal;
}

#homeland-chatbot .homeland-toggle {
    background: #111827 !important;
    color: #ffffff !important;
    border: 0 !important;
    box-shadow: none !important;
    text-transform: none !important;
}

#homeland-chatbot .homeland-close {
    background: transparent !important;
    color: #ffffff !important;
    border: 0 !important;
    box-shadow: none !important;
    text-transform: none !important;
}

#homeland-chatbot .homeland-input-area button {
    background: #111827 !important;
    color: #ffffff !important;
    border: 0 !important;
    box-shadow: none !important;
    text-transform: none !important;
}

/* =========================================================
   JEDDO FEEDBACK (isolated; does not alter existing layout)
========================================================= */
#homeland-chatbot .homeland-final-feedback {
    margin: 12px 0;
    padding: 13px;
    border: 1px solid #dfe5e1;
    border-radius: 14px;
    background: #ffffff;
    text-align: center;
}
#homeland-chatbot .homeland-final-feedback-title {
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}
#homeland-chatbot .homeland-final-feedback-note {
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
}
#homeland-chatbot .homeland-final-feedback-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}
#homeland-chatbot .homeland-final-feedback-buttons button {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 1px solid #d1d5db !important;
    border-radius: 999px !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    padding: 7px 11px !important;
    min-height: 34px !important;
    font-family: inherit !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    cursor: pointer !important;
    box-shadow: none !important;
}

/* =========================================================
   INPUT PROTECTION AGAINST WORDPRESS / ELEMENTOR GLOBAL CSS
   Keeps the original Jeddo input compact.
========================================================= */
#homeland-chatbot .homeland-input-area {
    box-sizing: border-box !important;
}
#homeland-chatbot .homeland-input-area textarea {
    box-sizing: border-box !important;
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    margin: 0 !important;
    resize: none !important;
    line-height: 1.4 !important;
}
#homeland-chatbot .homeland-input-area button {
    box-sizing: border-box !important;
}
@media (max-width: 600px) {
    #homeland-chatbot .homeland-input-area textarea {
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
    }
}
