
/* =========================================================
   HELCU AI ASSISTANT — RESPONSIVE WIDGET CSS
   BRAND COLOR: #05a2b5
   MOBILE FIRST: 0px → 767.98px
   TABLET:       768px → 1199.98px
   DESKTOP:      1200px+
========================================================= */


/* =========================================================
   1. ROOT WIDGET — BASE / MOBILE FIRST
========================================================= */

.helcu-ai-widget,
.helcu-ai-widget * {
    box-sizing: border-box;
}

.helcu-ai-widget {
    --ai-primary: #05a2b5;
    --ai-primary-dark: #048796;
    --ai-primary-light: #e8f6f7;

    --ai-text: #18313b;
    --ai-muted: #71838b;
    --ai-border: #dce5e9;
    --ai-background: #f5f8fa;
    --ai-white: #ffffff;
    --ai-shadow: 0 16px 48px rgba(12, 39, 50, 0.18);

    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 1050;

    color: var(--ai-text);
    font-family: inherit;
}

.helcu-ai-widget button,
.helcu-ai-widget textarea {
    font-family: inherit;
}

.helcu-ai-widget button {
    -webkit-tap-highlight-color: transparent;
}


/* =========================================================
   2. ACCESSIBILITY
========================================================= */

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

.helcu-ai-widget button:focus-visible,
.helcu-ai-widget textarea:focus-visible {
    outline: 3px solid rgba(5, 162, 181, 0.45);
    outline-offset: 3px;
}


/* =========================================================
   3. FLOATING LAUNCHER
   Transparent background — icon only
========================================================= */

.helcu-ai-launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 54px;
    height: 54px;
    min-width: 54px;
    min-height: 54px;
    padding: 0;

    border: none;
    border-radius: 50%;

    background: transparent;
    background-image: none;
    color: var(--ai-primary);

    box-shadow: none;

    font: inherit;
    cursor: pointer;

    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.helcu-ai-launcher:hover {
    background: transparent;
    background-image: none;
    color: var(--ai-primary-dark);
    box-shadow: none;
}

.helcu-ai-launcher:active {
    transform: scale(0.95);
}

.helcu-ai-launcher-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    background: transparent !important;
    color: #48d1cc !important;

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

.helcu-ai-launcher-icon i {
    display: block;
    color: #48d1cc !important;
    background: transparent !important;
    line-height: 1;
}


/* =========================================================
   4. CHAT PANEL
========================================================= */

.helcu-ai-panel[hidden],
.helcu-ai-typing[hidden] {
    display: none !important;
}

.helcu-ai-panel {
    position: fixed;
    inset: auto 8px 76px;

    display: flex;
    flex-direction: column;

    width: auto;
    max-width: none;

    height: min(620px, calc(100dvh - 92px));
    min-height: 300px;

    overflow: hidden;

    border: 1px solid var(--ai-border);
    border-radius: 18px;

    background: var(--ai-white);
    box-shadow: var(--ai-shadow);

    animation: helcu-ai-appear 0.2s ease-out;
}

@keyframes helcu-ai-appear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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


/* =========================================================
   5. CHAT HEADER
========================================================= */

.helcu-ai-header {
    display: flex;
    align-items: center;
    gap: 10px;

    flex: 0 0 auto;
    min-width: 0;
    padding: 13px;

    background: var(--ai-primary);
    color: #ffffff;
}

/* Your HTML uses helcu-ai-message-avatar in the header. */
.helcu-ai-header .helcu-ai-message-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;
    flex: 0 0 40px;

    margin: 0;
    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 11px;

    background: rgba(255, 255, 255, 0.15);
}

.helcu-ai-header-info {
    flex: 1 1 auto;
    min-width: 0;
}

.helcu-ai-header-info h2 {
    margin: 0;

    color: #ffffff;
    font-size: 15px;
    font-weight: 750;
    line-height: 1.4;
}

.helcu-ai-header-info p {
    margin: 3px 0 0;

    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    line-height: 1.4;
}

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

    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    padding: 0;

    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;

    font-size: 15px;
    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.helcu-ai-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.helcu-ai-close:active {
    transform: scale(0.95);
}


/* =========================================================
   6. HELTHCARE SAFETY NOTICE
========================================================= */

.helcu-ai-notice {
    flex: 0 0 auto;
    padding: 9px 12px;

    border-bottom: 1px solid #dceced;
    background: var(--ai-primary-light);

    color: #45666d;
    font-size: 10px;
    line-height: 1.55;
}


/* =========================================================
   7. MESSAGE CONTAINER
========================================================= */

.helcu-ai-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;

    flex: 1 1 auto;
    min-height: 0;

    padding: 14px 11px;

    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;

    background: var(--ai-background);

    scrollbar-width: thin;
    scrollbar-color: #c4d4da transparent;
}

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

.helcu-ai-messages::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #c4d4da;
}


/* =========================================================
   8. MESSAGE ROWS
========================================================= */

.helcu-ai-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;

    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.helcu-ai-message-assistant {
    align-self: flex-start;
}

.helcu-ai-message-user {
    align-self: flex-end;
    justify-content: flex-end;
}


/* Assistant avatar */

.helcu-ai-message-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;
    flex: 0 0 28px;

    margin-top: 2px;
    overflow: hidden;

    border: 1px solid #d8e9eb;
    border-radius: 9px;

    background: #e5f4f5;
    color: var(--ai-primary);

    font-size: 13px;
}


/* Assistant message body */

.helcu-ai-message-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;

    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 36px);
}


/* Assistant author */

.helcu-ai-message-author {
    margin: 0;
    padding-left: 2px;

    color: #547078;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
}


/* Message bubbles */

.helcu-ai-message-content {
    display: block;

    width: fit-content;
    max-width: 100%;
    min-width: 0;

    padding: 7px 10px;

    border: 1px solid var(--ai-border);
    border-radius: 4px 13px 13px 13px;

    background: #ffffff;
    color: var(--ai-text);

    font-size: 12px;
    line-height: 1.45;

    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;

    box-shadow: 0 2px 5px rgba(12, 39, 50, 0.025);
}

.helcu-ai-message-content p {
    margin: 0;
    padding: 0;
    line-height: inherit;
}

.helcu-ai-message-content p + p {
    margin-top: 8px;
}


/* User message bubble */

.helcu-ai-message-user .helcu-ai-message-content {
    max-width: 88%;

    border-color: var(--ai-primary);
    border-radius: 13px 4px 13px 13px;

    background: var(--ai-primary);
    color: #ffffff;

    box-shadow: 0 3px 9px rgba(5, 162, 181, 0.12);
}


/* =========================================================
   9. TYPING INDICATOR
========================================================= */

.helcu-ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;

    flex: 0 0 auto;
    padding: 0 12px 10px;

    background: var(--ai-background);
    color: var(--ai-muted);

    font-size: 10px;
}

.helcu-ai-typing > span:not(.helcu-ai-typing-text) {
    display: block;

    width: 6px;
    height: 6px;
    flex: 0 0 6px;

    border-radius: 50%;
    background: var(--ai-primary);

    animation: helcu-ai-dot 1s infinite ease-in-out;
}

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

.helcu-ai-typing > span:nth-child(3) {
    animation-delay: 0.3s;
}

.helcu-ai-typing-text {
    margin-left: 5px;
}

@keyframes helcu-ai-dot {
    0%,
    60%,
    100% {
        opacity: 0.4;
        transform: translateY(0);
    }

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


/* =========================================================
   10. MESSAGE COMPOSER
========================================================= */

.helcu-ai-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;

    flex: 0 0 auto;
    min-width: 0;
    padding: 10px;

    border-top: 1px solid var(--ai-border);
    background: #ffffff;
}

.helcu-ai-input {
    display: block;

    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    max-height: 110px;

    resize: none;
    overflow-y: auto;

    padding: 10px 11px;

    border: 1px solid var(--ai-border);
    border-radius: 12px;

    background: #fbfdfd;
    color: var(--ai-text);

    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;

    box-shadow: none;
}

.helcu-ai-input::placeholder {
    color: #81929a;
    opacity: 1;
}

.helcu-ai-input:focus {
    outline: none;
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 3px rgba(5, 162, 181, 0.12);
}

.helcu-ai-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}


/* Send button */

.helcu-ai-send {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    flex: 0 0 42px;

    padding: 0;

    border: 0;
    border-radius: 12px;

    background: var(--ai-primary);
    color: #ffffff;

    font-size: 16px;
    cursor: pointer;

    box-shadow: 0 4px 12px rgba(5, 162, 181, 0.18);

    transition:
        background 0.2s ease,
        opacity 0.2s ease,
        transform 0.2s ease;
}

.helcu-ai-send:hover:not(:disabled) {
    background: var(--ai-primary-dark);
}

.helcu-ai-send:active:not(:disabled) {
    transform: scale(0.96);
}

.helcu-ai-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}


/* =========================================================
   11. FOOTER
========================================================= */

.helcu-ai-footer {
    flex: 0 0 auto;
    padding: 8px 10px;

    border-top: 1px solid #edf0f2;
    background: #ffffff;

    color: var(--ai-muted);
    font-size: 10px;
    line-height: 1.5;
    text-align: center;
}


/* =========================================================
   12. HELCU LOGO
========================================================= */

.helcu-ai-logo {
    display: block;

    width: 68%;
    height: 68%;
    max-width: 68%;
    max-height: 68%;

    object-fit: contain;
    border-radius: inherit;
}

/* Smaller logo beside assistant messages */
.helcu-ai-message-avatar .helcu-ai-logo {
    width: 65%;
    height: 65%;
    max-width: 65%;
    max-height: 65%;
}


/* =========================================================
   13. SMALL MOBILE SCREENS
   0px → 359px
========================================================= */

@media (max-width: 359px) {

    .helcu-ai-widget {
        right: 8px;
        bottom: 8px;
    }

    .helcu-ai-launcher {
        width: 50px;
        height: 50px;
        min-width: 50px;
        min-height: 50px;
    }

    .helcu-ai-launcher-icon {
        font-size: 31px;
    }

    .helcu-ai-panel {
        inset: auto 5px 66px;

        height: min(580px, calc(100dvh - 80px));
        min-height: 280px;

        border-radius: 15px;
    }

    .helcu-ai-header {
        gap: 8px;
        padding: 11px;
    }

    .helcu-ai-header .helcu-ai-message-avatar {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .helcu-ai-header-info h2 {
        font-size: 14px;
    }

    .helcu-ai-notice {
        padding: 8px 10px;
        font-size: 9px;
    }

    .helcu-ai-messages {
        gap: 10px;
        padding: 11px 8px;
    }

    .helcu-ai-message-content {
        padding: 6px 9px;
        font-size: 12px;
    }

    .helcu-ai-composer {
        gap: 6px;
        padding: 8px;
    }

    .helcu-ai-send {
        width: 39px;
        height: 39px;
        flex-basis: 39px;
    }

    .helcu-ai-footer {
        padding: 7px 8px;
        font-size: 9px;
    }
}


/* =========================================================
   14. TABLET
   768px → 1199.98px
========================================================= */

@media (min-width: 768px) {

    .helcu-ai-widget {
        right: 20px;
        bottom: 20px;
    }

    .helcu-ai-launcher {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
    }

    .helcu-ai-launcher-icon {
        font-size: 36px;
    }

    .helcu-ai-panel {
        position: absolute;
        inset: auto 0 70px auto;

        width: 365px;
        max-width: calc(100vw - 40px);

        height: min(580px, calc(100dvh - 110px));
        min-height: 340px;

        border-radius: 19px;
    }

    .helcu-ai-header {
        gap: 12px;
        padding: 15px;
    }

    .helcu-ai-header .helcu-ai-message-avatar {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .helcu-ai-header-info h2 {
        font-size: 16px;
    }

    .helcu-ai-header-info p {
        font-size: 12px;
    }

    .helcu-ai-notice {
        padding: 10px 14px;
        font-size: 11px;
    }

    .helcu-ai-messages {
        gap: 13px;
        padding: 15px 13px;
    }

    .helcu-ai-message-content {
        padding: 7px 10px;
        font-size: 13px;
        line-height: 1.5;
    }

    .helcu-ai-composer {
        gap: 9px;
        padding: 12px;
    }

    .helcu-ai-input {
        min-height: 43px;
        font-size: 13px;
    }

    .helcu-ai-send {
        width: 43px;
        height: 43px;
        flex-basis: 43px;
    }
}


/* =========================================================
   15. DESKTOP
   1200px+
========================================================= */

@media (min-width: 1200px) {

    .helcu-ai-widget {
        right: 24px;
        bottom: 24px;
    }

    .helcu-ai-launcher {
        width: 58px;
        height: 58px;
        min-width: 58px;
        min-height: 58px;
    }

    .helcu-ai-launcher-icon {
        font-size: 38px;
    }

    .helcu-ai-launcher:hover {
        transform: translateY(-2px);
    }

    .helcu-ai-panel {
        width: 390px;
        max-width: calc(100vw - 48px);

        height: min(600px, calc(100dvh - 120px));
        min-height: 360px;
    }

    .helcu-ai-header {
        padding: 16px;
    }

    .helcu-ai-header .helcu-ai-message-avatar {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .helcu-ai-messages {
        padding: 17px 15px;
    }

    .helcu-ai-message-content {
        font-size: 13px;
        line-height: 1.5;
    }

    .helcu-ai-composer {
        padding: 13px;
    }

    .helcu-ai-footer {
        padding: 9px 13px;
    }
}


/* =========================================================
   16. REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .helcu-ai-widget *,
    .helcu-ai-widget *::before,
    .helcu-ai-widget *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
