/**
 * Noble Cleaning Services - AI Chatbot Stylesheet
 * High-end Glassmorphism, Floating Trigger, and Responsive Interactive Chatbot UI
 */

:root {
    --chat-primary: #0d3b66;
    --chat-primary-dark: #07223d;
    --chat-primary-light: #1e5a96;
    --chat-accent: #f4a261;
    --chat-accent-hover: #e76f51;
    --chat-bg: #ffffff;
    --chat-bubble-user: #0d3b66;
    --chat-bubble-bot: #f1f5f9;
    --chat-text: #1e293b;
    --chat-muted: #64748b;
    --chat-success: #10b981;
    --chat-border: #e2e8f0;
    --chat-shadow: 0 20px 45px -10px rgba(13, 59, 102, 0.25), 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Floating Launcher Trigger */
.noble-chat-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: #ffffff;
    padding: 12px 20px 12px 14px;
    border-radius: 50px;
    box-shadow: 0 12px 30px rgba(13, 59, 102, 0.35);
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    text-decoration: none;
}

.noble-chat-trigger:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 18px 36px rgba(13, 59, 102, 0.45);
    border-color: rgba(244, 162, 97, 0.6);
}

.noble-chat-trigger-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-accent) 0%, var(--chat-accent-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(244, 162, 97, 0.4);
    position: relative;
    flex-shrink: 0;
}

.noble-chat-trigger-icon::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--chat-success);
    border: 2px solid var(--chat-primary-dark);
    border-radius: 50%;
    animation: noblePulse 2s infinite;
}

@keyframes noblePulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.noble-chat-trigger-label {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.25;
}

.noble-chat-trigger-title {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.2px;
    color: #ffffff;
}

.noble-chat-trigger-sub {
    font-size: 0.75rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.noble-chat-trigger-sub i {
    color: #fcd34d;
}

/* Chat Main Window */
.noble-chat-window {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 410px;
    max-width: calc(100vw - 32px);
    height: 640px;
    max-height: calc(100vh - 100px);
    background: var(--chat-bg);
    border-radius: 24px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid rgba(226, 232, 240, 0.8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.noble-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.noble-chat-header {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.noble-chat-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.noble-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f4a261 0%, #e76f51 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #ffffff;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.noble-chat-online-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--chat-success);
    border: 2px solid var(--chat-primary);
    border-radius: 50%;
}

.noble-chat-header-info h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.noble-chat-header-info span {
    font-size: 0.78rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.noble-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.noble-chat-btn-icon {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.noble-chat-btn-icon:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Chat Messages Stream */
.noble-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.noble-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.noble-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Chat Message Bubbles */
.noble-chat-msg {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: nobleFadeIn 0.3s ease;
}

@keyframes nobleFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.noble-chat-msg.bot {
    align-self: flex-start;
}

.noble-chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.noble-chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--chat-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 4px;
}

.noble-chat-msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
}

.noble-chat-msg.bot .noble-chat-msg-bubble {
    background: #ffffff;
    color: var(--chat-text);
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.noble-chat-msg.user .noble-chat-msg-bubble {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-light) 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(13, 59, 102, 0.2);
}

.noble-chat-msg-bubble p {
    margin: 0 0 8px 0;
}
.noble-chat-msg-bubble p:last-child {
    margin-bottom: 0;
}

.noble-chat-msg-bubble ul {
    margin: 6px 0;
    padding-left: 20px;
}

.noble-chat-msg-bubble li {
    margin-bottom: 4px;
}

.noble-chat-msg-time {
    font-size: 0.68rem;
    color: var(--chat-muted);
    margin-top: 4px;
    display: block;
    text-align: right;
}

.noble-chat-msg.user .noble-chat-msg-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Typing Indicator */
.noble-chat-typing {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    border-top-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    margin-bottom: 6px;
}

.noble-chat-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: nobleTyping 1.4s infinite ease-in-out both;
}

.noble-chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.noble-chat-typing span:nth-child(2) { animation-delay: -0.16s; }
.noble-chat-typing span:nth-child(3) { animation-delay: 0s; }

@keyframes nobleTyping {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; background: var(--chat-primary); }
}

/* Quick Suggestion Pills */
.noble-chat-suggestions {
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

.noble-chat-suggestions::-webkit-scrollbar {
    height: 4px;
}
.noble-chat-suggestions::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}

.noble-chat-pill {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--chat-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.noble-chat-pill:hover {
    background: var(--chat-primary);
    color: #ffffff;
    border-color: var(--chat-primary);
    transform: translateY(-1px);
}

/* Interactive Quote Card in Chat */
.noble-chat-quote-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--chat-accent);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.noble-chat-quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.noble-chat-quote-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--chat-primary);
}

.noble-chat-quote-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: #047857;
}

.noble-chat-quote-details {
    font-size: 0.8rem;
    color: var(--chat-muted);
    line-height: 1.4;
    margin-bottom: 10px;
}

.noble-chat-quote-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.noble-chat-quote-btn:hover {
    background: var(--chat-accent-hover);
    transform: translateY(-1px);
}

/* Interactive Booking Confirmed Card */
.noble-chat-booking-card {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 14px;
    padding: 14px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}

.noble-chat-booking-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #065f46;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.noble-chat-booking-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #064e3b;
    margin-bottom: 6px;
}

.noble-chat-booking-rows {
    font-size: 0.82rem;
    color: #065f46;
    line-height: 1.5;
    margin-bottom: 8px;
}

.noble-chat-booking-paynote {
    background: #ffffff;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #047857;
    border: 1px solid #a7f3d0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Chat Input Footer */
.noble-chat-footer {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.noble-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.noble-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--chat-text);
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.noble-chat-input:focus {
    border-color: var(--chat-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(13, 59, 102, 0.12);
}

.noble-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.noble-chat-send-btn:hover {
    background: var(--chat-accent-hover);
    transform: scale(1.05);
}

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

.noble-chat-micro-disclaimer {
    font-size: 0.68rem;
    color: #94a3b8;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .noble-chat-trigger {
        bottom: 82px; /* Above the mobile sticky bar */
        right: 14px;
        padding: 8px 14px 8px 8px;
        max-width: calc(100vw - 28px);
        box-sizing: border-box;
    }
    .noble-chat-trigger-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .noble-chat-trigger-title {
        font-size: 0.82rem;
    }
    .noble-chat-trigger-sub {
        font-size: 0.68rem;
    }

    .noble-chat-window {
        bottom: 74px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: calc(100vw - 16px);
        box-sizing: border-box;
        height: calc(100vh - 140px);
        max-height: 560px;
    }
}

@media (max-width: 480px) {
    .noble-chat-trigger {
        bottom: 80px;
        right: 10px;
        padding: 6px 12px 6px 6px;
        gap: 8px;
    }
    .noble-chat-trigger-sub {
        display: none;
    }
    .noble-chat-header {
        padding: 12px 14px;
    }
    .noble-chat-messages {
        padding: 12px;
    }
    .noble-chat-footer {
        padding: 10px 12px;
    }
}
