/* ─── RVParkShop Modern Chat Widget ─── */
:root {
    --rv-forest: #2f6f3e;
    --rv-forest-dark: #245730;
    --rv-forest-light: #ecfdf5;
    --rv-amber: #F5A623;
    --rv-amber-dark: #c7871a;
    --rv-navy: #1B2A3D;
    --rv-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0,0,0,0.08);
}

/* Floating Launch Button */
#rv-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rv-forest) 0%, #1e4a28 100%);
    color: #ffffff;
    border: none;
    box-shadow: var(--rv-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
}

#rv-chat-launcher:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 16px 40px rgba(47, 111, 62, 0.4);
}

#rv-chat-launcher .launcher-icon {
    font-size: 26px;
    transition: transform 0.3s ease;
}

#rv-chat-launcher .close-icon {
    display: none;
    font-size: 24px;
}

#rv-chat-launcher.is-open .launcher-icon {
    display: none;
}

#rv-chat-launcher.is-open .close-icon {
    display: block;
}

/* Chat Badge / Pulse Indicator */
.rv-chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    background-color: var(--rv-amber);
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: rv-pulse 2s infinite;
}

@keyframes rv-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(245, 166, 35, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 166, 35, 0); }
}

/* Chat Main Window */
#rv-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 99998;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: var(--rv-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#rv-chat-window.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Window Header */
.rv-chat-header {
    background: linear-gradient(135deg, var(--rv-forest) 0%, #1e4a28 100%);
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.rv-chat-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rv-chat-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.rv-chat-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.rv-chat-subtitle {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
}

.rv-chat-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rv-chat-btn-icon {
    background: transparent;
    border: none;
    color: #ffffff;
    opacity: 0.8;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: opacity 0.2s, background-color 0.2s;
}

.rv-chat-btn-icon:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.15);
}

/* Chat Messages Container */
.rv-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background-color: #f8fafc;
}

/* Welcome Area */
.rv-chat-welcome {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.rv-welcome-icon {
    font-size: 32px;
    color: var(--rv-forest);
    margin-bottom: 8px;
}

.rv-welcome-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.rv-welcome-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 12px;
}

.rv-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.rv-quick-btn {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rv-quick-btn:hover {
    background-color: var(--rv-forest-light);
    border-color: var(--rv-forest);
    color: var(--rv-forest);
}

/* Message Bubbles */
.rv-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: rv-fade-in 0.25s ease forwards;
}

@keyframes rv-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.rv-message.is-user {
    align-self: flex-end;
    align-items: flex-end;
}

.rv-message.is-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.rv-bubble {
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.5;
    border-radius: 16px;
    word-break: break-word;
}

.rv-message.is-user .rv-bubble {
    background: var(--rv-forest);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.rv-message.is-assistant .rv-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.rv-bubble a {
    color: #0284c7;
    font-weight: 600;
    text-decoration: underline;
}

.rv-bubble strong {
    font-weight: 700;
}

.rv-bubble ul {
    margin: 6px 0;
    padding-left: 18px;
}

.rv-bubble li {
    margin-bottom: 3px;
}

.rv-msg-meta {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Thumbs Feedback */
.rv-msg-feedback {
    display: inline-flex;
    gap: 6px;
}

.rv-feedback-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
    transition: color 0.2s;
}

.rv-feedback-btn:hover {
    color: var(--rv-forest);
}

/* Rich Listing Cards inside Chat */
.rv-chat-listing-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.rv-chat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    gap: 10px;
    padding: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.rv-chat-card-img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    background-color: #e2e8f0;
    flex-shrink: 0;
}

.rv-chat-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.rv-chat-card-title {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rv-chat-card-loc {
    font-size: 11px;
    color: #64748b;
}

.rv-chat-card-price {
    font-size: 12px;
    font-weight: 800;
    color: var(--rv-forest);
}

.rv-chat-card-btn {
    display: inline-block;
    background: var(--rv-forest);
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-align: center;
    align-self: flex-start;
    margin-top: 2px;
}

/* Typing Indicator */
.rv-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    width: fit-content;
}

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

.rv-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.rv-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Chat Footer / Input */
.rv-chat-footer {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.rv-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rv-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
    background-color: #f8fafc;
}

.rv-chat-input:focus {
    border-color: var(--rv-forest);
    background-color: #ffffff;
}

.rv-chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--rv-forest);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.rv-chat-send-btn:hover {
    background: var(--rv-forest-dark);
    transform: scale(1.05);
}

.rv-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.rv-chat-disclaimer {
    font-size: 9.5px;
    color: #94a3b8;
    text-align: center;
    margin-top: 6px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #rv-chat-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}
