/* 
   Hello Valencia AI Chat & Recommendations Styles
   Extracted from development style.css
*/

/* Chat widget refreshed styles */
.chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-family: inherit;
}

.chat-widget[data-unread="true"] .chat-toggle::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff7b54;
    box-shadow: 0 0 0 6px rgba(255, 123, 84, 0.2);
    pointer-events: none;
}

.chat-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #1d1d1b 0%, #31312f 100%);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 36px rgba(0, 0, 0, 0.22);
}

.chat-toggle__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.chat-toggle__label {
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.chat-widget[data-state="open"] .chat-toggle {
    opacity: 0.85;
}

.chat-window {
    width: min(360px, calc(100vw - 40px));
    height: 520px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.25);
    border: 1px solid #efede7;
    overflow: hidden;
    animation: chat-pop 0.28s ease-out;
}

.chat-window[hidden] {
    display: none !important;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, #1d1d1b 0%, #3a3a35 100%);
    color: #fff;
}

.chat-header__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-header__title {
    font-size: 1rem;
    font-weight: 600;
}

.chat-header__status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    opacity: 0.85;
}

.chat-header__indicator {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.2);
}

.chat-close {
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-close:hover,
.chat-close:focus {
    background: rgba(255, 255, 255, 0.24);
    outline: none;
}

.chat-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: linear-gradient(180deg, #faf8f3 0%, #f5f1ea 100%);
}

.chat-body::-webkit-scrollbar {
    width: 8px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(29, 29, 27, 0.2);
    border-radius: 999px;
}

.chat-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    animation: chat-fade 0.3s ease;
}

.chat-row.user {
    justify-content: flex-end;
}

.chat-row.assistant {
    justify-content: flex-start;
}

.chat-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1d1d1b;
    color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

.chat-avatar svg {
    width: 18px;
    height: 18px;
}

.chat-message {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.94rem;
    line-height: 1.55;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
    background: #fff;
    color: #1d1d1b;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- AI Recommendations --- */
.ai-recommendations {
    margin-top: 3rem;
    padding: clamp(1.5rem, 2vw + 1rem, 2.5rem);
    background: linear-gradient(135deg, rgba(248, 244, 235, 0.85) 0%, rgba(255, 255, 255, 0.95) 100%);
    border: 1px solid rgba(203, 187, 160, 0.32);
    border-radius: 18px;
    box-shadow: 0 24px 48px -28px rgba(29, 29, 27, 0.35);
}

.ai-recommendations__header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.6rem;
}

.ai-recommendations__header h3 {
    margin: 0;
    font-size: clamp(1.4rem, 1.2vw + 1.1rem, 1.8rem);
    font-weight: 700;
    color: #1d1d1b;
}

.ai-recommendations__header p {
    margin: 0;
    font-size: 0.95rem;
    color: #6e665a;
}

.ai-recommendations__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(1rem, 1.2rem, 1.5rem);
    align-items: stretch;
}

.ai-recommendations__item {
    list-style: none;
}

.ai-recommendations__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 18px 34px -20px rgba(29, 29, 27, 0.45);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ai-recommendations__link:hover,
.ai-recommendations__link:focus {
    transform: translateY(-6px);
    box-shadow: 0 28px 46px -22px rgba(29, 29, 27, 0.55);
}

.ai-recommendations__media {
    position: relative;
    width: 100%;
    padding-top: 62%;
    overflow: hidden;
    background: #f2e9da;
}

.ai-recommendations__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.ai-recommendations__link:hover .ai-recommendations__media img,
.ai-recommendations__link:focus .ai-recommendations__media img {
    transform: scale(1.06);
}

.ai-recommendations__media--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(29, 29, 27, 0.28);
    font-size: 2.5rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ai-recommendations__placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.ai-recommendations__content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.2rem 1.3rem 1.35rem;
}

.ai-recommendations__title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.45;
    color: #1d1d1b;
}

.ai-recommendations__cta {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.87rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #9a7b4e;
    text-transform: uppercase;
}

.ai-recommendations__cta::after {
    content: "\2192";
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.ai-recommendations__link:hover .ai-recommendations__cta::after,
.ai-recommendations__link:focus .ai-recommendations__cta::after {
    transform: translateX(4px);
}

@media (max-width: 640px) {
    .ai-recommendations {
        margin-top: 2.2rem;
        padding: 1.4rem 1.2rem 1.6rem;
    }

    .ai-recommendations__list {
        grid-template-columns: 1fr;
    }
}

.chat-message p {
    margin: 0;
}

.chat-message p+p {
    margin-top: 0.75em;
}

.chat-message.user {
    background: linear-gradient(135deg, #1d1d1b 0%, #494945 100%);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.chat-message.assistant {
    border: 1px solid #ece5d8;
    border-bottom-left-radius: 6px;
}

.chat-message strong {
    font-weight: 700;
}

.chat-message em {
    font-style: italic;
}

.chat-message code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background: rgba(29, 29, 27, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
}

.chat-message ul {
    margin: 10px 0 0;
    padding-left: 20px;
    list-style: disc;
}

.chat-message li {
    margin-bottom: 6px;
}

.chat-message a {
    color: #1d1d1b;
    font-weight: 600;
    text-decoration: underline;
}

.chat-message.user a {
    color: #fff;
}

.chat-row.is-loading .chat-message {
    border: 1px dashed #d6cfc2;
    background: rgba(250, 248, 243, 0.85);
    color: #8a816f;
    box-shadow: none;
}

.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
    animation: chat-typing 1.1s infinite ease-in-out;
}

.chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

.chat-sources {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #ece5d8;
    font-size: 0.82rem;
    color: #6d6453;
}

.chat-sources span {
    display: block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.chat-sources ul {
    margin: 0;
    padding-left: 18px;
}

.chat-sources li {
    margin-bottom: 4px;
}

.chat-footer {
    padding: 16px 18px 20px;
    background: #fff;
    border-top: 1px solid #efede7;
}

#chat-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

#chat-input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #dcd6c8;
    border-radius: 14px;
    font-size: 0.94rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#chat-input:focus {
    outline: none;
    border-color: #1d1d1b;
    box-shadow: 0 0 0 3px rgba(29, 29, 27, 0.15);
}

.chat-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1d1d1b;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.chat-submit:hover {
    background: #333331;
    transform: translateY(-1px);
}

.chat-submit svg {
    width: 18px;
    height: 18px;
}

.chat-submit[data-loading="true"] {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.chat-submit[data-loading="true"]::after {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: chat-spin 0.8s linear infinite;
}

@keyframes chat-pop {
    from {
        transform: translateY(12px) scale(0.98);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes chat-fade {
    from {
        transform: translateY(6px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes chat-typing {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }

    40% {
        transform: translateY(-3px);
        opacity: 0.8;
    }
}

@keyframes chat-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .chat-widget {
        right: 16px;
        bottom: 16px;
        gap: 10px;
    }

    .chat-window {
        width: calc(100vw - 32px);
        height: 70vh;
    }

    .chat-body {
        padding: 14px;
    }

    .chat-toggle {
        padding: 10px 16px;
    }

    .chat-toggle__label {
        font-size: 0.85rem;
    }
}

/* ========================================
   AI Chat Rating System Styles  
   ======================================== */
.chat-rating {
    margin-top: 12px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #cbbba0;
    width: 100%;
}

.rating-question {
    font-size: 13px;
    color: #1d1d1b;
    margin-bottom: 8px;
    font-weight: 500;
}

.rating-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.rating-btn {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.rating-btn:hover:not(:disabled) {
    background-color: #f2e9da;
    border-color: #cbbba0;
    transform: translateY(-1px);
}

.rating-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rating-feedback {
    margin-top: 12px;
}

.rating-feedback textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.rating-feedback textarea:focus {
    outline: none;
    border-color: #cbbba0;
}

.rating-submit {
    margin-top: 8px;
    padding: 6px 16px;
    background-color: #cbbba0;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.rating-submit:hover {
    background-color: #b8aa8d;
}

.rating-thanks {
    color: #1d1d1b;
    font-size: 13px;
    font-weight: 500;
    padding: 8px;
    text-align: center;
}

/* Streaming indicator */
.is-streaming .chat-message {
    position: relative;
}

.is-streaming .chat-message::after {
    content: "●";
    display: inline-block;
    margin-left: 4px;
    animation: pulse 1.5s ease-in-out infinite;
    color: #cbbba0;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* Inline link styling in chat */
.chat-message a[data-analytics="ai_chat_inline"] {
    color: #cbbba0;
    text-decoration: underline;
    font-weight: 500;
}

.chat-message a[data-analytics="ai_chat_inline"]:hover {
    color: #b8aa8d;
}