
/* Caribbean AI — isolated floating chat styles */

#crc-ai-widget {
    --ai-teal: #087f79;
    --ai-green: #0b6b55;
    --ai-light: #e9f8f4;
    --ai-text: #173f35;
    --ai-border: #dce9e5;
    position: fixed;
    right: 20px;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    z-index: 1000003;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ai-text);
}

#crc-ai-widget,
#crc-ai-widget * {
    box-sizing: border-box;
}

#crc-ai-widget button,
#crc-ai-widget textarea {
    font-family: inherit;
}

#crc-ai-widget button:focus-visible,
#crc-ai-widget textarea:focus-visible,
#crc-ai-widget a:focus-visible {
    outline: 3px solid #18aaa3;
    outline-offset: 3px;
}

#crc-ai-widget .crc-ai-launcher {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 17px 9px 9px;
    border: 2px solid #fff;
    border-radius: 40px;
    background: linear-gradient(135deg, #098a81, #075d50);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 7px 25px rgba(0,0,0,.24);
    transition: transform .2s, box-shadow .2s;
}

#crc-ai-widget .crc-ai-launcher:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

#crc-ai-widget .crc-ai-avatar,
#crc-ai-widget .crc-ai-header-avatar {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #def6ec;
    font-size: 29px;
}

#crc-ai-widget .crc-ai-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 14px);
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 24px));
    height: min(610px, calc(100dvh - 200px));
    min-height: 250px;
    background: #fff;
    border: 1px solid var(--ai-border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 15px 55px rgba(0,0,0,.23);
}

#crc-ai-widget .crc-ai-panel[hidden] {
    display: none !important;
}

#crc-ai-widget .crc-ai-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    background: linear-gradient(120deg, #087f79, #0b6b55);
    color: white;
}

#crc-ai-widget .crc-ai-header-avatar {
    width: 44px;
    height: 44px;
}

#crc-ai-widget .crc-ai-header-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

#crc-ai-widget .crc-ai-header-info strong {
    font-size: 17px;
    color: white;
}

#crc-ai-widget .crc-ai-header-info small {
    font-size: 12px;
    color: #e0fff5;
}

#crc-ai-widget .crc-ai-close {
    background: rgba(255,255,255,.15);
    border: 0;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    color: white;
    font-size: 25px;
    cursor: pointer;
}

#crc-ai-widget .crc-ai-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 12px;
    background: #f7faf9;
}

#crc-ai-widget .crc-ai-message {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    align-items: flex-end;
}

#crc-ai-widget .crc-ai-message-avatar {
    flex-shrink: 0;
    font-size: 23px;
}

#crc-ai-widget .crc-ai-bubble {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 16px;
    background: white;
    border: 1px solid var(--ai-border);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#crc-ai-widget .crc-ai-bubble p {
    margin: 7px 0;
    color: var(--ai-text);
}

#crc-ai-widget .crc-ai-bubble small {
    color: #5b746b;
    font-size: 12px;
}

#crc-ai-widget .crc-ai-user {
    justify-content: flex-end;
}

#crc-ai-widget .crc-ai-user .crc-ai-bubble {
    background: var(--ai-green);
    color: white;
    border: none;
    border-bottom-right-radius: 4px;
}

#crc-ai-widget .crc-ai-assistant .crc-ai-bubble {
    border-bottom-left-radius: 4px;
}

#crc-ai-widget .crc-ai-card {
    margin: 10px 0 14px 31px;
    overflow: hidden;
    border: 1px solid var(--ai-border);
    border-radius: 14px;
    background: white;
    box-shadow: 0 3px 12px rgba(0,0,0,.07);
}

#crc-ai-widget .crc-ai-card img {
    display: block;
    width: 100%;
    max-height: 155px;
    object-fit: cover;
}

#crc-ai-widget .crc-ai-card-body {
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
}

#crc-ai-widget .crc-ai-card-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 10px;
}

#crc-ai-widget .crc-ai-card-actions a {
    display: inline-block;
    background: var(--ai-green);
    color: white;
    border-radius: 9px;
    padding: 8px 11px;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
}

#crc-ai-widget .crc-ai-status {
    padding: 0 13px;
    font-size: 12px;
    color: #56766b;
    background: white;
}

#crc-ai-widget .crc-ai-status:not(:empty) {
    padding-top: 8px;
}

#crc-ai-widget .crc-ai-form {
    display: flex;
    align-items: end;
    gap: 9px;
    margin: 0;
    padding: 12px;
    background: white;
    border-top: 1px solid var(--ai-border);
}

#crc-ai-widget .crc-ai-form textarea {
    flex: 1;
    min-width: 0;
    max-height: 120px;
    resize: none;
    padding: 10px;
    border: 1px solid #ccddd6;
    border-radius: 12px;
    background: white;
    color: #173f35;
    font-size: 14px;
    line-height: 1.45;
}

#crc-ai-widget .crc-ai-form button {
    border: 0;
    border-radius: 11px;
    padding: 12px 14px;
    background: var(--ai-green);
    color: white;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

#crc-ai-widget .crc-ai-form button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

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

/* Mobile layout */
@media (max-width: 600px) {
    #crc-ai-widget {
        right: 12px;
        bottom: calc(85px + env(safe-area-inset-bottom, 0px));
    }

    #crc-ai-widget .crc-ai-launcher {
        padding: 7px 12px 7px 7px;
    }

    #crc-ai-widget .crc-ai-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(155px + env(safe-area-inset-bottom, 0px));
        width: auto;
        height: min(560px, calc(100dvh - 180px));
        min-height: 0;
        border-radius: 19px;
    }
}

/* Avoid blocking the QR landing page's PWA invitation */
body:has(#pwaInstallBanner.show) #crc-ai-launcher {
    visibility: hidden;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    #crc-ai-widget .crc-ai-launcher {
        transition: none;
    }
}


/* Caribbean AI layout refinements — private preview */

/* Keep the popup open, but hide the launcher beneath it. */
#crc-ai-widget .crc-ai-launcher[aria-expanded="true"] {
    visibility: hidden;
    pointer-events: none;
}

/* Two compact recommendation cards per row. */
#crc-ai-widget .crc-ai-card-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 9px 0 16px;
    align-items: start;
}

#crc-ai-widget .crc-ai-card-heading {
    margin: 16px 0 8px;
    font-size: 14px;
    line-height: 1.4;
}

#crc-ai-widget .crc-ai-card {
    min-width: 0;
    margin: 0;
    border-radius: 12px;
}

#crc-ai-widget .crc-ai-card img {
    height: 108px;
    max-height: 108px;
    object-fit: cover;
}

#crc-ai-widget .crc-ai-card-body {
    padding: 10px;
    font-size: 12px;
    overflow-wrap: anywhere;
}

#crc-ai-widget .crc-ai-card-body > strong {
    display: block;
    font-size: 13px;
    line-height: 1.35;
}

#crc-ai-widget .crc-ai-card-body p {
    margin: 6px 0;
    line-height: 1.4;
}

#crc-ai-widget .crc-ai-card-actions {
    gap: 6px;
    margin-top: 9px;
}

#crc-ai-widget .crc-ai-card-actions a {
    padding: 7px 9px;
    font-size: 11px;
    line-height: 1.35;
}

@media (max-width: 600px) {
    /* Bring the conversation input closer to the bottom of the phone. */
    #crc-ai-widget .crc-ai-panel {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        height: min(680px, calc(100dvh - 24px - env(safe-area-inset-bottom, 0px)));
    }
}

/* Very narrow phones need one readable card per row. */
@media (max-width: 350px) {
    #crc-ai-widget .crc-ai-card-group {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* Coco mascot artwork */
#crc-ai-widget .crc-ai-avatar,
#crc-ai-widget .crc-ai-header-avatar,
#crc-ai-widget .crc-ai-message-avatar {
    overflow: hidden;
}

#crc-ai-widget .crc-ai-avatar img,
#crc-ai-widget .crc-ai-header-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#crc-ai-widget .crc-ai-message-avatar {
    display: block;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    border-radius: 50%;
}

#crc-ai-widget .crc-ai-message-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#crc-ai-widget .crc-ai-welcome-image {
    display: block;
    width: 135px;
    max-width: 100%;
    height: 115px;
    margin: 0 auto 4px;
    border-radius: 12px;
    object-fit: cover;
    object-position: center;
}

/* Coco compact welcome spacing */
#crc-ai-widget .crc-ai-messages > .crc-ai-message:first-child .crc-ai-bubble {
    padding-top: 8px;
    padding-bottom: 8px;
}



/* Coco message input height fix */
#crc-ai-widget #crc-ai-input {
    box-sizing: border-box !important;
    flex: 1 1 0% !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    overflow-y: auto;
}


/* Coco voice controls — preview styling */
#crc-ai-widget .crc-ai-voice-tools[hidden] {
    display: none !important;
}

#crc-ai-widget .crc-ai-voice-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 9px 12px;
    background: #f4faf8;
    border-top: 1px solid var(--ai-border);
}

#crc-ai-widget .crc-ai-voice-tools label {
    font-size: 12px;
    font-weight: 700;
    color: #355c50;
}

#crc-ai-widget .crc-ai-voice-tools select {
    min-width: 0;
    max-width: 125px;
    padding: 7px;
    border: 1px solid #c4dcd4;
    border-radius: 9px;
    background: white;
    color: #173f35;
    font-size: 12px;
}

#crc-ai-widget .crc-ai-voice-tools button {
    padding: 8px 10px;
    border: 1px solid #b5d7cd;
    border-radius: 10px;
    background: white;
    color: #0b6b55;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#crc-ai-widget .crc-ai-voice-tools button[aria-pressed="true"] {
    background: #0b6b55;
    border-color: #0b6b55;
    color: white;
}

#crc-ai-widget .crc-ai-voice-tools button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

#crc-ai-widget #crc-ai-voice-status {
    flex-basis: 100%;
    font-size: 12px;
    color: #456b5d;
}

#crc-ai-widget #crc-ai-voice-status:empty {
    display: none;
}

@media (max-width: 600px) {
    #crc-ai-widget .crc-ai-voice-tools {
        gap: 6px;
        padding: 8px;
    }

    #crc-ai-widget .crc-ai-voice-tools button {
        padding: 7px 9px;
    }
}
