/* Chatbot Floating Container */
#chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: 'Inter', -apple-system, sans-serif;
}
#chatbot-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.4),
                0 4px 12px -2px rgba(15, 23, 42, 0.2);
    cursor: pointer;
    transition: transform 0.35s var(--ease-spring), background 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.15);
    outline: none;
}
#chatbot-bubble:hover {
    transform: scale(1.08) rotate(-6deg);
    background: var(--accent);
}
#chatbot-bubble svg {
    width: 24px;
    height: 24px;
}
#chatbot-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 520px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    box-shadow: 0 30px 60px -15px rgba(15, 23, 42, 0.20),
                0 12px 24px -6px rgba(15, 23, 42, 0.10);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden; /* fully out of the render tree when closed: no backdrop blur to composite */
    transition: transform 0.4s var(--ease-spring), opacity 0.3s, visibility 0s linear 0.4s;
    transform-origin: bottom right;
}
@media (max-width: 480px) {
    #chatbot-window {
        width: calc(100vw - 48px);
        height: 460px;
        right: -12px;
    }
}
#chatbot-window.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
    visibility: visible;
    transition-delay: 0s;
}

/* Chat Header */
.chat-header {
    background: var(--ink);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-header-avatar {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-header-details {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.chat-header-details strong {
    font-size: 14px;
    font-weight: 700;
}
.chat-header-details span {
    font-size: 10px;
    color: #10B981;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.chat-header-details span .dot {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: chat-dot-pulse 2s infinite;
}
@keyframes chat-dot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.8); opacity: 0.5; }
}
.chat-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 8px;
    transition: color 0.2s;
}
.chat-close:hover {
    color: #fff;
}

/* Logs */
.chat-logs {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.chat-msg.bot {
    align-self: flex-start;
}
.chat-msg.user {
    align-self: flex-end;
}
.chat-bubble {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.45;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}
.chat-msg.bot .chat-bubble {
    background: #F1F5F9;
    color: var(--text);
    border-bottom-left-radius: 4px;
}
.chat-msg.user .chat-bubble {
    background: var(--ink);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Graphical reasoning box */
.chat-reasoning {
    align-self: flex-start;
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 85%;
    margin-bottom: 6px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    transition: opacity 0.3s;
}
.chat-reasoning-step {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}
.chat-reasoning-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-dark);
    flex-shrink: 0;
}
.chat-reasoning-icon.loading {
    animation: chat-spin 1s linear infinite;
}
@keyframes chat-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Chatbot custom rich layout classes */
.chat-founder-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.chat-founder-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}
.chat-founder-avatar.yk {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
}
.chat-founder-avatar.jk {
    background: linear-gradient(135deg, #10B981, #06B6D4);
}
.chat-founder-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.chat-founder-info strong {
    font-size: 13px;
    color: var(--text);
}
.chat-founder-info span {
    font-size: 11px;
    color: var(--text-muted);
}
.chat-action-btn {
    display: inline-block;
    background: var(--ink);
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 6px;
    transition: background 0.2s;
}
.chat-action-btn:hover {
    background: var(--accent);
}

/* App List */
.chat-app-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.chat-app-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s;
}
.chat-app-item:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.chat-app-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.chat-app-details {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.chat-app-details strong {
    font-size: 13px;
    color: var(--text);
}
.chat-app-details span {
    font-size: 11px;
    color: var(--text-muted);
}

/* RAG / Services */
.chat-rag-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.chat-rag-step-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
}
.chat-rag-step-mini svg {
    width: 14px;
    height: 14px;
    color: var(--accent-dark);
    flex-shrink: 0;
}
.chat-services-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}
.chat-service-tag {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text);
    font-weight: 500;
}
.chat-service-tag svg {
    width: 12px;
    height: 12px;
    color: var(--accent-dark);
    flex-shrink: 0;
}

/* Location */
.chat-location-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
}
.chat-location-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-dark);
    flex-shrink: 0;
}
.chat-location-card strong {
    font-size: 13px;
    color: var(--text);
    display: block;
}
.chat-location-card span {
    font-size: 11px;
    color: var(--text-muted);
}

/* Suggestions */
.chat-suggestions {
    padding: 8px 16px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}
.chat-suggest-btn {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.chat-suggest-btn .btn-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}
.chat-suggest-btn:hover {
    border-color: var(--accent);
    color: var(--ink);
    background: var(--accent-light);
}

/* Input area */
.chat-input-area {
    padding: 10px 16px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background: #fff;
    flex-shrink: 0;
}
.chat-input-field {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 8px 14px;
    font-size: 12.5px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.chat-input-field:focus {
    border-color: var(--accent);
}
.chat-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    outline: none;
}
.chat-send-btn:hover {
    background: var(--accent);
}
.chat-send-btn svg {
    width: 14px;
    height: 14px;
}

/* Typing Indicator Styling */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #F1F5F9;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 80%;
    margin-bottom: 4px;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #94A3B8;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
