@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --xue-primary: #24b4a6;
    --xue-secondary: #0d9488;
    --xue-bg-gradient: linear-gradient(135deg, #00bfa5, #00796b);
    --xue-text-main: #1e293b;
    --xue-text-muted: #64748b;
    --xue-radius-lg: 30px;
    --xue-radius-md: 20px;
    --xue-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

#xue-ai-search-widget, 
#xue-ai-search-widget *,
.xue-ai-widget,
.xue-ai-widget * {
    font-family: 'Outfit', sans-serif !important;
    box-sizing: border-box;
}

#xue-ai-search-widget {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    color: var(--xue-text-main);
}

/* ── HERO MODE ── */
.xue-hero-wrapper {
    background: var(--xue-bg-gradient);
    padding: 80px 40px;
    border-radius: var(--xue-radius-md);
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.xue-hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.xue-hero-title {
    color: #fff;
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.2;
}

.xue-hero-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 30px;
}

/* ── SEARCH BAR (IMPROVED ALIGNMENT) ── */
.xue-search-bar-wrap {
    width: 100%;
    margin-bottom: 20px;
}

.xue-search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    padding: 6px 10px 6px 30px; /* Reduced vertical padding */
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

#xue-ai-search-widget:not(.xue-hero-mode) .xue-search-bar {
    border: 1px solid #e2e8f0;
}

.xue-search-bar:focus-within {
    box-shadow: 0 20px 50px rgba(36, 180, 166, 0.15);
    border-color: var(--xue-primary);
}

.xue-search-icon {
    color: var(--xue-text-muted);
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    height: 100%;
}

.xue-ai-input {
    flex: 1;
    border: none !important;
    margin: 0 !important;
    outline: none;
    font-size: 17px;
    color: var(--xue-text-main);
    background: transparent;
    padding: 14px 0;
    height: auto;
    line-height: 1.2;
    box-shadow: none !important;
}

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

.xue-ai-btn {
    background: var(--xue-primary);
    color: #fff;
    border: none;
    border-radius: 40px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-left: 10px;
    height: 48px; /* Fixed height for better alignment */
    align-self: center; /* Force vertical centering */
}

.xue-ai-btn:hover {
    background: var(--xue-secondary);
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(36, 180, 166, 0.3);
}

.xue-chat-input-area .xue-search-bar {
    padding: 8px 12px;
    border-radius: 50px;
}

#xue-ai-chat-submit {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
}


/* ── CHIPS (QUICK & FOLLOWUP) ── */
.xue-quick-suggestions, .xue-chips-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 15px;
}

.xue-quick-chip, .xue-overview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 700;
    color: var(--xue-primary);
    font-size: 16px;
}

.xue-isabella-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--xue-primary);
    background-color: #fff;
    flex-shrink: 0;
}

.xue-quick-chip, .xue-followup-chip {
    padding: 10px 20px !important;
    border-radius: 50px !important;
    background: #ffffff !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border: 1px solid #e2e8f0 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    margin: 5px;
}

.xue-quick-chip:hover, .xue-followup-chip:hover {
    border-color: var(--xue-primary) !important;
    color: var(--xue-primary) !important;
    transform: translateY(-2px);
    background: #f0fdf9 !important;
    box-shadow: 0 6px 15px rgba(36, 180, 166, 0.15) !important;
}

/* ── LOADING (CENTERED) ── */
.xue-loading {
    text-align: center;
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.xue-loading-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.xue-loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--xue-primary);
    border-radius: 50%;
    animation: xue-bounce 1.4s infinite ease-in-out both;
}
.xue-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.xue-loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes xue-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* ── AI OVERVIEW & TYPING ── */
.xue-results {
    margin-top: 30px;
    animation: xueFadeUp 0.5s ease both;
}

.xue-ai-overview {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 20px;
    border-left: none;
    box-shadow: none;
}

/* ── CHAT HISTORY & MESSAGES ── */
.xue-chat-scrollable::-webkit-scrollbar { width: 4px; }
.xue-chat-scrollable::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.xue-msg-user {
    align-self: flex-end;
    background: var(--xue-primary);
    color: #fff;
    padding: 14px 24px;
    border-radius: 24px 24px 4px 24px;
    max-width: 85%;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(36, 180, 166, 0.2);
    animation: xueFadeUp 0.3s ease both;
    margin-left: auto;
}

/* ── NEW CONSOLIDATED CHAT PANEL ── */
.xue-chat-panel {
    display: flex;
    flex-direction: column;
    position: relative;
    background: #fff;
    border-radius: var(--xue-radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.04);
}


.xue-chat-scrollable {
    flex: 1;
    overflow-y: auto;
    padding-right: 15px;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
}
.xue-chat-scrollable::-webkit-scrollbar { width: 6px; }
.xue-chat-scrollable::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.xue-chat-input-area {
    margin-top: 15px;
    flex-shrink: 0;
    padding: 10px 0 20px 0;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.xue-listings-panel {
    display: flex;
    flex-direction: column;
    height: 70vh;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
    scrollbar-width: thin;
}
.xue-listings-panel::-webkit-scrollbar { width: 6px; }
.xue-listings-panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
/* Custom scrollbar for right panel */
.xue-listings-panel::-webkit-scrollbar {
    width: 6px;
}
.xue-listings-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.xue-msg-ai {
    align-self: flex-start;
    background: #f8fafc;
    color: var(--xue-text-main);
    padding: 24px;
    border-radius: 24px 24px 24px 4px;
    width: 100%;
    animation: xueFadeUp 0.3s ease both;
    border-left: 5px solid var(--xue-primary);
    position: relative;
    margin-bottom: 30px;
}

/* Constrain images in AI responses */
.xue-msg-ai img {
    max-width: 100% !important;
    height: auto !important;
    max-height: 350px;
    border-radius: 15px;
    margin: 15px 0;
    display: block;
    object-fit: cover;
}

.xue-msg-ai-active {
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    background: #fff;
}

.xue-typing::after {
    content: '|';
    display: inline-block;
    width: 2px;
    background-color: var(--xue-primary);
    animation: xue-blink 0.7s infinite;
}

@keyframes xue-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── IN-CHAT LISTINGS CAROUSEL ── */
.xue-listings-carousel-wrapper {
    margin-top: 20px;
    display: none;
}

.xue-carousel-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 5px;
}

.xue-carousel-nav span {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.xue-listings-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px;
    padding-top: 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    margin: 0 -10px;
    padding: 10px;
}

.xue-listings-carousel::-webkit-scrollbar {
    display: none;
}

.xue-listings-carousel .xue-listing-card {
    flex: 0 0 150px; /* Un poco más angosto */
    width: 150px;
    max-width: 150px;
    margin-bottom: 0;
    scroll-snap-align: start;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    min-height: auto; /* Permitir que se achique */
}

.xue-listings-carousel .xue-card-media {
    height: 60px; /* Ultra compacto */
}

.xue-listings-carousel .xue-card-heart, 
.xue-listings-carousel .xue-card-badges {
    display: none; /* Eliminar distractores en vista mini */
}

.xue-listings-carousel .xue-card-body {
    padding: 8px 10px;
}

.xue-listings-carousel .xue-card-title {
    font-size: 11px;
    margin-bottom: 4px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.xue-listings-carousel .xue-card-loc {
    font-size: 9px;
    margin-bottom: 5px;
}

.xue-listings-carousel .xue-card-footer {
    display: none; /* No necesitamos el footer/botón grande en vista mini */
}

.xue-listing-card {
    background: #fff;
    border-radius: var(--xue-radius-md);
    overflow: hidden;
    box-shadow: var(--xue-shadow);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    width: calc(50% - 6px);
    max-width: 220px;
    border: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    .xue-listing-card {
        width: 100%;
        max-width: 100%;
    }
}

.xue-listing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}

.xue-card-media {
    position: relative;
    height: 130px;
    overflow: hidden;
}

.xue-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.xue-card-badges {
    position: absolute;
    top: 15px; left: 15px;
    display: flex; flex-wrap: wrap; gap: 8px;
}

.xue-cat-badge {
    background: var(--xue-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.xue-card-heart {
    position: absolute;
    top: 15px; right: 15px;
    width: 32px; height: 32px;
    background: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--xue-primary);
}

.xue-card-body { padding: 15px; flex: 1; display: flex; flex-direction: column; }
.xue-card-title { font-size: 15px; font-weight: 700; margin: 0 0 8px; line-height: 1.3; }

.xue-card-loc {
    font-size: 13px;
    color: var(--xue-text-muted);
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 5px;
}

.xue-card-footer {
    margin-top: auto;
    padding-top: 10px;
}

.xue-view-more-pill {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.xue-listing-card:hover .xue-view-more-pill {
    background: var(--xue-primary);
    color: #fff;
}

.xue-card-footer {
    margin-top: auto; padding-top: 15px;
    border-top: 1px solid #f1f5f9;
    display: flex; justify-content: space-between; align-items: center;
}

.xue-followup {
    margin-top: 20px;
    text-align: center;
}

.xue-followup-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--xue-text-muted);
    margin-bottom: 8px;
    text-align: left;
}

.xue-chips-row {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 10px;
    padding-top: 5px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    flex-wrap: nowrap;
}

.xue-chips-row::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.xue-followup-chip {
    flex: 0 0 auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.xue-followup-chip:hover {
    background: #f8fafc;
    border-color: var(--xue-primary);
    color: var(--xue-primary);
}

/* VERSION TAG */
.xue-footer-version {
    text-align: center;
    font-size: 11px;
    color: #cbd5e1;
    margin-top: 50px;
    padding-bottom: 20px;
    letter-spacing: 0.5px;
}

/* ANIMATIONS */
@keyframes xueFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.xue-spin { animation: xue-spin 1s linear infinite; }
@keyframes xue-spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
    .xue-hero-title { font-size: 32px; }
    .xue-search-bar { padding: 5px 5px 5px 20px; }
    .xue-ai-btn { padding: 10px 20px; font-size: 14px; height: 44px; }
    .xue-ai-input { font-size: 15px; }
}

/* AI Mode Button (Home) - Unified & Robust */
body .xue-ia-mode-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 0 28px !important;
    border-radius: 50px !important;
    background: #fff !important;
    color: #1e293b !important;
    font-weight: 600 !important;
    border: 3px solid transparent !important;
    background-image: linear-gradient(#fff, #fff), 
                      linear-gradient(135deg, #4285f4, #9b72cb, #ea4335, #fbbc05, #34a853) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08) !important;
    transition: all 0.3s ease !important;
    margin-left: 10px !important;
    white-space: nowrap !important;
    height: 50px !important;
    min-width: 140px !important;
    position: relative !important;
    overflow: visible !important;
    font-size: 16px !important;
    z-index: 10 !important;
}



.xue-ia-mode-btn svg {
    flex-shrink: 0 !important;
    width: 20px !important;
    height: 20px !important;
    fill: #1e293b !important;
}

.xue-ia-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12) !important;
}

/* ── FLOATING ISABELLA WIDGET ── */
#isabella-exclusive-floating-container {
    position: fixed !important;
    bottom: 30px !important;
    left: 30px !important;
    right: auto !important;
    z-index: 99999 !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    font-family: inherit;
}

.xue-fab-trigger {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid transparent;
    background: linear-gradient(#fff, #fff) padding-box, 
                linear-gradient(135deg, #4285f4, #9b72cb, #ea4335, #fbbc05, #34a853) border-box !important;
}

.xue-fab-trigger:hover {
    transform: scale(1.1) rotate(5deg);
}

.xue-fab-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
}

.xue-fab-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #4285f4;
    opacity: 0.4;
    animation: xuePulse 2s infinite;
    z-index: -1;
}

@keyframes xuePulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.6); opacity: 0; }
}

.xue-floating-window {
    width: 380px;
    height: 550px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    animation: xueFabOpen 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0,0,0,0.05);
}

@keyframes xueFabOpen {
    0% { opacity: 0; transform: scale(0.5) translateY(50px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.xue-floating-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #4285f4, #9b72cb, #ea4335, #fbbc05, #34a853);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.xue-floating-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.xue-mini-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
}

.xue-floating-title-container {
    display: flex;
    flex-direction: column;
}

.xue-floating-title-container strong {
    font-size: 15px;
    line-height: 1;
}

.xue-online-status {
    font-size: 11px;
    opacity: 0.9;
}

.xue-close-floating {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.xue-floating-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fdfdfd;
}

.xue-floating-input-area {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
}

.xue-floating-input-area .xue-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 40px;
    padding: 2px 5px 2px 20px;
}

.xue-floating-input-area input {
    border: none !important;
    background: transparent !important;
    font-size: 14px;
    width: 100%;
    padding: 12px 0 !important;
    box-shadow: none !important;
}

.xue-floating-input-area .xue-submit-btn {
    background: #4285f4;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

@media (max-width: 500px) {
    .xue-floating-isabella {
        left: 15px;
        bottom: 15px;
        right: 15px;
        align-items: center;
    }
    .xue-floating-window {
        width: 100%;
        height: 70vh;
        transform-origin: bottom center;
    }
}
