/* ═══════════════════════════════════════════════════════════════
   Joey AI — Glassmorphism Chat Widget Styles
   Isolated CSS — does NOT affect any existing site styles.
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ─── */
:root {
    --joey-primary: #FFDE59;
    --joey-primary-hover: #E6C850;
    --joey-bg: #ffffff;
    --joey-glass: rgba(255, 255, 255, 0.65);
    --joey-glass-border: rgba(255, 255, 255, 0.35);
    --joey-text: #1a1a2e;
    --joey-text-muted: #64748b;
    --joey-user-bubble: #FFDE59;
    --joey-user-text: #000000;
    --joey-ai-bubble: #f1f5f9;
    --joey-ai-text: #1e293b;
    --joey-border: #e2e8f0;
    --joey-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
    --joey-radius: 0px;
    --joey-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Floating Launcher Button ─── */
.joey-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--joey-primary);
    border: none;
    cursor: pointer;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(255, 222, 89, 0.4);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s, opacity 0.2s, visibility 0.2s;
    animation: joey-pulse 2.5s infinite;
    overflow: hidden;
}

.joey-launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(255, 222, 89, 0.5);
}

.joey-launcher img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.joey-launcher .joey-close-icon {
    display: none;
    font-size: 28px;
    color: #000;
    line-height: 1;
}

.joey-launcher.active img {
    display: none;
}

.joey-launcher.active .joey-close-icon {
    display: block;
}

.joey-launcher.active {
    animation: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes joey-pulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(255, 222, 89, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(255, 222, 89, 0.15), 0 0 0 12px rgba(255, 222, 89, 0.08);
    }
}

/* ─── Chat Container ─── */
.joey-chat-container {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 45%;
    min-width: 400px;
    max-width: 600px;
    height: 100vh;
    max-height: 100vh;
    background: var(--joey-bg);
    border: none;
    border-left: 1px solid var(--joey-border);
    border-radius: var(--joey-radius);
    box-shadow: var(--joey-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    font-family: var(--joey-font);
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.joey-chat-container.active {
    display: flex;
    opacity: 1;
    transform: translateX(0);
}

/* ─── Chat Header ─── */
.joey-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: #ffffff;
    border-bottom: 1px solid var(--joey-border);
    color: var(--joey-text);
    position: relative;
    flex-shrink: 0;
}

.joey-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--joey-border);
    object-fit: cover;
    flex-shrink: 0;
}

.joey-header-info {
    flex: 1;
    min-width: 0;
}

.joey-header-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin: 0;
    line-height: 1.2;
    color: var(--joey-text);
}

.joey-header-subtitle {
    font-size: 12px;
    color: var(--joey-text-muted);
    margin: 2px 0 0 0;
    line-height: 1.2;
}

.joey-header-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-right: 28px;
}

.joey-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.joey-badge-encrypted {
    background: #e2fcdb;
    color: #166534;
}

.joey-badge-new {
    background: #e0f2fe;
    color: #0369a1;
}

.joey-close-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 18px;
    background: none;
    border: none;
    color: var(--joey-text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 6px;
    transition: color 0.2s;
}

.joey-close-btn:hover {
    color: var(--joey-text);
}

/* ─── Chat Body ─── */
.joey-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.joey-body::-webkit-scrollbar {
    width: 4px;
}

.joey-body::-webkit-scrollbar-track {
    background: transparent;
}

.joey-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* ─── Welcome Screen ─── */
.joey-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 10px 0 0;
}

.joey-welcome-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--joey-border);
    object-fit: cover;
}

.joey-welcome-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--joey-text);
    margin: 0;
}

.joey-welcome-sub {
    font-size: 13px;
    color: var(--joey-text-muted);
    margin: -8px 0 0;
}

/* ─── Quick Start Grid ─── */
.joey-quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.joey-quick-card {
    background: #fff;
    border: 1px solid var(--joey-border);
    border-radius: 12px;
    padding: 14px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.joey-quick-card:hover {
    border-color: var(--joey-primary);
    background: #FFFBEB;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 222, 89, 0.15);
}

.joey-quick-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--joey-text);
    margin: 0 0 4px;
}

.joey-quick-card-desc {
    font-size: 11px;
    color: var(--joey-text-muted);
    margin: 0;
    line-height: 1.4;
}

/* ─── Chat Messages ─── */
.joey-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: joey-msgIn 0.3s ease;
}

@keyframes joey-msgIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.joey-message.user {
    align-self: flex-end;
}

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

.joey-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
}

.joey-message.user .joey-bubble {
    background: var(--joey-user-bubble);
    color: var(--joey-user-text);
    border-bottom-right-radius: 4px;
}

.joey-message.ai .joey-bubble {
    background: var(--joey-ai-bubble);
    color: var(--joey-ai-text);
    border-bottom-left-radius: 4px;
}

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

.joey-bubble p:last-child {
    margin-bottom: 0;
}

.joey-bubble strong {
    font-weight: 600;
}

.joey-bubble ul, .joey-bubble ol {
    margin: 6px 0;
    padding-left: 18px;
}

.joey-bubble li {
    margin-bottom: 4px;
}

/* ─── Typing Indicator ─── */
.joey-typing {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 18px;
    background: var(--joey-ai-bubble);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 85%;
    animation: joey-msgIn 0.3s ease;
}

.joey-typing-text {
    font-size: 12px;
    color: var(--joey-text-muted);
    font-weight: 500;
    line-height: 1.4;
}

.joey-typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.joey-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: joey-bounce 1.4s infinite;
}

.joey-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.joey-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes joey-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* ─── Chat Footer / Input ─── */
.joey-footer {
    padding: 16px 20px 8px;
    border-top: none;
    background: #fff;
    flex-shrink: 0;
}

.joey-input-container {
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid var(--joey-border);
    border-radius: 30px;
    background: #f8fafc;
    padding: 4px 6px 4px 18px;
    transition: border-color 0.2s, background 0.2s;
}

.joey-input-container:focus-within {
    border-color: var(--joey-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 222, 89, 0.25);
}

.joey-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 13.5px;
    outline: none;
    color: var(--joey-text);
    font-family: var(--joey-font);
}

.joey-input::placeholder {
    color: #94a3b8;
}

.joey-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--joey-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.joey-send-btn:hover {
    background: var(--joey-primary-hover);
    transform: scale(1.05);
}

.joey-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.joey-send-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: #000000;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ─── Credit Footer ─── */
.joey-credits {
    display: flex;
    justify-content: space-between;
    padding: 4px 24px 16px;
    font-size: 10.5px;
    color: #94a3b8;
    background: #fff;
    flex-shrink: 0;
}

/* ─── Lead Form Overlay ─── */
.joey-lead-form {
    position: absolute;
    inset: 0;
    background: #ffffff;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 24px;
    z-index: 10;
    border-radius: 0;
}

.joey-lead-form.active {
    display: flex;
}

.joey-lead-form h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--joey-text);
    margin: 0 0 4px;
}

.joey-lead-form p {
    font-size: 13px;
    color: var(--joey-text-muted);
    margin: 0 0 20px;
    text-align: center;
}

.joey-lead-form input {
    width: 100%;
    border: 1px solid var(--joey-border);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    font-family: var(--joey-font);
    color: var(--joey-text);
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.joey-lead-form input:focus {
    border-color: var(--joey-primary);
}

.joey-lead-submit {
    width: 100%;
    padding: 12px;
    background: var(--joey-primary);
    color: #000000;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--joey-font);
    transition: background 0.2s;
    margin-top: 4px;
}

.joey-lead-submit:hover {
    background: var(--joey-primary-hover);
}

.joey-lead-submit:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.joey-lead-cancel {
    background: none;
    border: none;
    color: var(--joey-text-muted);
    font-size: 12px;
    cursor: pointer;
    margin-top: 12px;
    font-family: var(--joey-font);
    text-decoration: underline;
}

.joey-lead-success {
    text-align: center;
}

.joey-lead-success .joey-checkmark {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

/* ─── Backdrop / Page Blur ─── */
.joey-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.joey-backdrop.active {
    display: block;
}

/* ─── Package Cards Grid ─── */
.joey-pkg-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 14px 0;
    width: 100%;
}

.joey-pkg-cards-grid:has(> :only-child) {
    grid-template-columns: 1fr;
}

/* ─── Package Mini Card ─── */
.joey-pkg-mini-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--joey-border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none !important;
    color: var(--joey-text) !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.joey-pkg-mini-card:hover {
    border-color: var(--joey-primary);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(255, 222, 89, 0.25);
    background: #FFFBEB;
}

.joey-pkg-card-img-wrapper {
    width: 100%;
    height: 100px;
    overflow: hidden;
    background: #f1f5f9;
    position: relative;
}

.joey-pkg-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.joey-pkg-mini-card:hover .joey-pkg-card-img {
    transform: scale(1.05);
}

.joey-pkg-card-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.joey-pkg-card-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 34px;
}

.joey-pkg-card-duration {
    font-size: 11px;
    color: var(--joey-text-muted);
    margin: 0 0 6px 0;
}

.joey-pkg-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    font-size: 12px;
}

.joey-pkg-card-price {
    font-weight: 800;
    color: #1e293b;
}

.joey-pkg-card-rating {
    font-weight: 700;
    color: #eab308;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .joey-chat-container {
        width: 100vw;
        max-width: 100vw;
        min-width: 100vw;
        height: 100vh;
        border-left: none;
    }

    .joey-launcher {
        bottom: 20px !important;
        right: 20px !important;
        width: 54px !important;
        height: 54px !important;
    }

    .joey-launcher img {
        width: 38px !important;
        height: 38px !important;
    }

    /* Align WhatsApp launcher symmetrically on mobile */
    .whatsapp-float-btn {
        bottom: 20px !important;
        left: 20px !important;
        width: 54px !important;
        height: 54px !important;
    }
    
    .whatsapp-svg-icon {
        width: 28px !important;
        height: 28px !important;
    }

    /* Float both above the mobile sticky CTA bar when it is present on the page */
    body:has(.mobile-sticky-cta) .whatsapp-float-btn,
    body:has(.mobile-sticky-cta) .joey-launcher {
        bottom: 95px !important;
    }

    /* Mobile Header Layout Adjustment */
    .joey-header {
        display: grid;
        grid-template-areas: 
            "avatar info close"
            "avatar badges close";
        grid-template-columns: auto 1fr auto;
        gap: 4px 12px;
        padding: 14px 16px;
        align-items: center;
    }
    
    .joey-header-avatar {
        grid-area: avatar;
        width: 38px;
        height: 38px;
    }
    
    .joey-header-info {
        grid-area: info;
        margin: 0;
        padding: 0;
    }
    
    .joey-header-title {
        font-size: 14px;
        line-height: 1.2;
    }
    
    .joey-header-subtitle {
        font-size: 11px;
        margin-top: 1px;
        line-height: 1.2;
    }
    
    .joey-header-badges {
        grid-area: badges;
        margin-right: 0;
        margin-top: 2px;
        gap: 6px;
    }

    .joey-badge {
        font-size: 8px;
        padding: 3px 6px;
    }
    
    .joey-close-btn {
        grid-area: close;
        position: static;
        transform: none;
        margin-left: auto;
        font-size: 26px;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
}
