@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --rosie-primary: #10b981;
    /* Fallback, overridden by PHP */
    --rosie-primary-dark: #059669;
    /* Fallback */
    --rosie-secondary: #0f172a;
    --rosie-bg: #f8fafc;
    --rosie-user-msg: var(--rosie-primary);
    --rosie-ai-msg: #ffffff;
    --rosie-text-dark: #1e293b;
    --rosie-text-light: #64748b;
    --rosie-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --rosie-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --rosie-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Chat Bubble Container */
#rosie-ai-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--rosie-primary), var(--rosie-primary-dark));
    border-radius: 50% 50% 4px 50%;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#rosie-ai-bubble:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.5);
}

#rosie-ai-bubble svg {
    width: 30px;
    height: 30px;
    fill: #fff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Chat Window */
#rosie-ai-window {
    display: none;
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 420px;
    height: 580px;
    max-height: 85vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: var(--rosie-shadow-lg);
    z-index: 10000;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-family: var(--rosie-font);
    transform-origin: bottom right;
    animation: rosieSlideUp 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes rosieSlideUp {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
#rosie-ai-header {
    background: linear-gradient(to right, var(--rosie-primary), var(--rosie-primary-dark));
    color: #fff;
    padding: 4px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#rosie-ai-header span:first-child {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rosie-chat-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

/* #rosie-ai-header span:first-child::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 12px #4ade80;
} */

#rosie-ai-close {
    cursor: pointer;
    font-size: 24px;
    padding: 4px;
    transition: transform 0.2s;
    line-height: 1;
}

#rosie-ai-close:hover {
    transform: rotate(90deg);
}

/* Messages Area */
#rosie-ai-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--rosie-bg);
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.rosie-message {
    max-width: 85%;
    padding: 14px 20px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    animation: rosieFadeIn 0.3s ease-out;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

@keyframes rosieFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.rosie-message.user {
    align-self: flex-end;
    background: var(--rosie-user-msg);
    color: #fff;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

.rosie-message.rosie {
    align-self: flex-start;
    background: var(--rosie-ai-msg);
    color: var(--rosie-text-dark);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Intent Actions */
.rosie-btn-yes,
.rosie-btn-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    margin: 8px 6px 0 0;
    line-height: 1.3;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.rosie-btn-yes {
    background: var(--rosie-primary);
    color: white;
}

.rosie-btn-yes:hover {
    background: var(--rosie-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2);
}

.rosie-btn-no {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #475569;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.rosie-btn-no:hover {
    border-color: #94a3b8;
    color: #1e293b;
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

/* Typing Indicator */
.rosie-working {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
    padding: 8px 0;
    align-self: flex-start;
    margin-bottom: 10px;
}

.rosie-working.hidden {
    display: none;
}

.rosie-dot {
    width: 10px;
    height: 10px;
    background-color: var(--rosie-primary);
    border-radius: 50%;
    animation: rosieBounce 0.6s infinite ease-in-out;
}

.rosie-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.rosie-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes rosieBounce {

    0%,
    80%,
    100% {
        transform: translateY(0) scale(1);
    }

    40% {
        transform: translateY(-6px) scale(1.2);
    }
}

/* Input Area */
#rosie-ai-input-area {
    padding: 15px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    background: #fff;
    align-items: flex-end;
    /* Align button to bottom of larger textarea */
    gap: 10px;
}

#rosie-ai-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    transition: border 0.3s;
    font-size: 14px;
    resize: none;
    height: 44px;
    /* Initial fixed height */
    max-height: 300px;
    /* Constrain max height */
    overflow-y: hidden;
    /* Hide until max height reached (handled in JS) */
    line-height: 1.4;
    font-family: inherit;
}

#rosie-ai-input:focus {
    background: #fff;
    border-color: var(--rosie-primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

#rosie-ai-send {
    width: 48px;
    height: 48px;
    background: var(--rosie-primary);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #fff;
    padding: 0;
}

#rosie-ai-send:hover {
    background: var(--rosie-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.2);
}

#rosie-ai-send:active {
    transform: scale(0.95);
}

#rosie-ai-send:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
    transform: none;
}

/* Scrollbar */
#rosie-ai-messages::-webkit-scrollbar {
    width: 5px;
}

#rosie-ai-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    #rosie-ai-window {
        width: calc(100% - 40px);
        height: 70vh;
        right: 20px;
        bottom: 100px;
    }
}

/* Hero Search Banner component */
.rosie-hero-search-banner {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f1f5f9;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--rosie-font);
}

.rosie-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1;
}

.rosie-hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

.rosie-hero-text {
    flex: 1;
}

.rosie-hero-text h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 10px 0;
    line-height: 1.2;
    text-align: center;
}

.rosie-hero-text p {
    font-size: 18px;
    color: #475569;
    margin: 0 0 25px 0;
    text-align: center;
}

.rosie-hero-search-form {
    width: 100%;
    max-width: 550px;
}

.rosie-hero-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 40px;
    padding: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.rosie-hero-search-icon {
    width: 24px;
    height: 24px;
    fill: #94a3b8;
    margin-left: 15px;
}

.rosie-hero-input-wrap .rosie-hero-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 15px;
    font-size: 16px;
    color: #334155;
    outline: none;
}

.rosie-hero-input::placeholder {
    color: #94a3b8;
}

.rosie-hero-submit {
    background: var(--rosie-primary);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rosie-hero-submit:hover {
    background: var(--rosie-primary-dark);
    transform: scale(1.02);
}

.rosie-hero-avatar {
    width: 220px;
    height: 220px;
}

@media (max-width: 768px) {
    .rosie-hero-search-banner {
        padding: 40px 20px;
    }

    .rosie-hero-content {
        flex-direction: column-reverse;
        text-align: center;
        gap: 20px;
    }

    .rosie-hero-text h2 {
        font-size: 22px;
    }

    .rosie-hero-text p {
        font-size: 16px;
        margin-bottom: 20px;
    }

    .rosie-hero-avatar {
        width: 140px;
        height: 140px;
    }
}

@media (max-width: 480px) {
    .rosie-hero-search-banner {
        padding: 30px 15px;
        border-radius: 0;
    }

    .rosie-hero-input-wrap {
        padding: 4px;
    }

    .rosie-hero-input-wrap .rosie-hero-input {
        padding: 10px 8px;
        font-size: 15px;
    }

    .rosie-hero-submit {
        padding: 10px 20px;
        font-size: 15px;
    }
    
    .rosie-hero-search-icon {
        width: 20px;
        height: 20px;
        margin-left: 10px;
    }
}

@media (max-width: 380px) {
    .rosie-hero-search-icon {
        display: none;
    }
    
    .rosie-hero-text h2 {
        font-size: 20px;
    }

    .rosie-hero-submit {
        padding: 10px 15px;
    }
}