/* Vedic Guide chatbot — compact floating widget, theme-aware */
.guide-chatbot-root {
    --gc-accent: var(--accent-color, #ff7a3d);
    --gc-bg: rgba(18, 18, 18, 0.96);
    --gc-surface: rgba(255, 255, 255, 0.06);
    --gc-border: rgba(255, 255, 255, 0.12);
    --gc-text: var(--text-color, #ffffff);
    --gc-muted: var(--text-secondary, rgba(255, 255, 255, 0.65));
    --gc-bot-bubble: rgba(255, 122, 61, 0.12);
    --gc-user-bubble: rgba(255, 255, 255, 0.1);
    --gc-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 9990;
    font-family: 'Inter', 'Twkeverett', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    pointer-events: none;
}

body.light-theme .guide-chatbot-root {
    --gc-bg: rgba(254, 249, 243, 0.98);
    --gc-surface: rgba(44, 24, 16, 0.04);
    --gc-border: rgba(44, 24, 16, 0.12);
    --gc-text: var(--text-color, #2c1810);
    --gc-muted: var(--text-secondary, rgba(44, 24, 16, 0.65));
    --gc-bot-bubble: rgba(255, 122, 61, 0.1);
    --gc-user-bubble: rgba(44, 24, 16, 0.06);
    --gc-shadow: 0 12px 40px rgba(44, 24, 16, 0.15);
}

.guide-chatbot-root * {
    box-sizing: border-box;
}

.guide-chatbot-root.is-open,
.guide-chatbot-root .guide-chatbot-launcher {
    pointer-events: auto;
}

/* Launcher button */
.guide-chatbot-launcher {
    width: 3.5rem;
    height: 3.5rem;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gc-accent) 0%, #e85d04 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: var(--gc-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.guide-chatbot-icon {
    width: 1.45rem;
    height: 1.45rem;
    display: block;
}

.guide-chatbot-launcher .guide-chatbot-icon {
    width: 1.55rem;
    height: 1.55rem;
}

.guide-chatbot-launcher:hover {
    transform: scale(1.05);
}

.guide-chatbot-launcher:focus-visible {
    outline: 2px solid var(--gc-accent);
    outline-offset: 3px;
}

.guide-chatbot-launcher-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 0.65rem;
    height: 0.65rem;
    background: #22c55e;
    border: 2px solid #fff;
    border-radius: 50%;
}

.guide-chatbot-root.is-open .guide-chatbot-launcher {
    display: none;
}

/* Panel */
.guide-chatbot-panel {
    display: none;
    flex-direction: column;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    height: 28rem;
    max-height: min(70vh, 32rem);
    background: var(--gc-bg);
    border: 1px solid var(--gc-border);
    border-radius: 1rem;
    box-shadow: var(--gc-shadow);
    overflow: hidden;
    backdrop-filter: blur(12px);
    animation: guideChatSlideUp 0.25s ease;
}

.guide-chatbot-root.is-open .guide-chatbot-panel {
    display: flex;
}

@keyframes guideChatSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.guide-chatbot-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gc-border);
    background: var(--gc-surface);
    flex-shrink: 0;
}

.guide-chatbot-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gc-accent), #e85d04);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.guide-chatbot-avatar .guide-chatbot-icon {
    width: 1rem;
    height: 1rem;
}

.guide-chatbot-header-text {
    flex: 1;
    min-width: 0;
}

.guide-chatbot-header-text strong {
    display: block;
    font-size: 0.9rem;
    color: var(--gc-text);
    line-height: 1.2;
}

.guide-chatbot-header-text span {
    font-size: 0.72rem;
    color: var(--gc-muted);
}

.guide-chatbot-header-actions {
    display: flex;
    gap: 0.25rem;
}

.guide-chatbot-icon-btn {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--gc-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
}

.guide-chatbot-icon-btn:hover {
    background: var(--gc-surface);
    color: var(--gc-text);
}

/* Messages */
.guide-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    scroll-behavior: smooth;
}

.guide-chatbot-msg {
    max-width: 92%;
    padding: 0.6rem 0.8rem;
    border-radius: 0.85rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--gc-text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.guide-chatbot-msg--bot {
    align-self: flex-start;
    background: var(--gc-bot-bubble);
    border-bottom-left-radius: 0.25rem;
}

.guide-chatbot-msg--user {
    align-self: flex-end;
    background: var(--gc-user-bubble);
    border-bottom-right-radius: 0.25rem;
}

.guide-chatbot-msg strong {
    color: var(--gc-accent);
    font-weight: 600;
}

.guide-chatbot-msg--typing {
    align-self: flex-start;
    background: var(--gc-bot-bubble);
    padding: 0.55rem 0.85rem;
}

.guide-chatbot-typing-dots {
    display: inline-flex;
    gap: 4px;
}

.guide-chatbot-typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--gc-muted);
    border-radius: 50%;
    animation: guideChatBounce 1.2s infinite ease-in-out;
}

.guide-chatbot-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.guide-chatbot-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes guideChatBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-4px); opacity: 1; }
}

/* Quick chips */
.guide-chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0.85rem 0.65rem;
    flex-shrink: 0;
}

.guide-chatbot-chip {
    border: 1px solid var(--gc-border);
    background: var(--gc-surface);
    color: var(--gc-text);
    font-size: 0.72rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    line-height: 1.3;
}

.guide-chatbot-chip:hover {
    border-color: var(--gc-accent);
    background: rgba(255, 122, 61, 0.1);
}

/* Action buttons inside messages area */
.guide-chatbot-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-self: flex-start;
    max-width: 92%;
}

.guide-chatbot-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 0.55rem;
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--gc-border);
    background: var(--gc-surface);
    color: var(--gc-text);
    transition: background 0.15s, border-color 0.15s;
}

.guide-chatbot-action:hover {
    border-color: var(--gc-accent);
    color: var(--gc-accent);
}

.guide-chatbot-action--primary {
    background: var(--gc-accent);
    border-color: var(--gc-accent);
    color: #fff;
}

.guide-chatbot-action--primary:hover {
    background: #ff8f5a;
    border-color: #ff8f5a;
    color: #fff;
}

/* Registration inline form */
.guide-chatbot-signup {
    align-self: stretch;
    padding: 0.75rem;
    margin: 0 0.85rem 0.65rem;
    background: var(--gc-surface);
    border: 1px solid var(--gc-border);
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.guide-chatbot-signup h4 {
    margin: 0 0 0.25rem;
    font-size: 0.82rem;
    color: var(--gc-text);
}

.guide-chatbot-signup p {
    margin: 0 0 0.65rem;
    font-size: 0.72rem;
    color: var(--gc-muted);
    line-height: 1.4;
}

.guide-chatbot-signup label {
    display: block;
    font-size: 0.68rem;
    color: var(--gc-muted);
    margin-bottom: 0.2rem;
}

.guide-chatbot-signup input,
.guide-chatbot-signup select {
    width: 100%;
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--gc-border);
    border-radius: 0.45rem;
    background: transparent;
    color: var(--gc-text);
    font-size: 0.78rem;
}

.guide-chatbot-signup input:focus,
.guide-chatbot-signup select:focus {
    outline: none;
    border-color: var(--gc-accent);
}

.guide-chatbot-signup-submit {
    width: 100%;
    padding: 0.5rem;
    border: none;
    border-radius: 0.45rem;
    background: var(--gc-accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.guide-chatbot-signup-submit:hover {
    background: #ff8f5a;
}

.guide-chatbot-signup-skip {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--gc-muted);
    font-size: 0.72rem;
    cursor: pointer;
    text-align: center;
}

.guide-chatbot-signup-skip:hover {
    color: var(--gc-text);
}

/* Input bar */
.guide-chatbot-input-bar {
    display: flex;
    gap: 0.45rem;
    padding: 0.65rem 0.85rem;
    border-top: 1px solid var(--gc-border);
    background: var(--gc-surface);
    flex-shrink: 0;
}

.guide-chatbot-input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gc-border);
    border-radius: 999px;
    background: transparent;
    color: var(--gc-text);
    font-size: 0.8rem;
}

.guide-chatbot-input:focus {
    outline: none;
    border-color: var(--gc-accent);
}

.guide-chatbot-input::placeholder {
    color: var(--gc-muted);
}

.guide-chatbot-send {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--gc-accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.guide-chatbot-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.guide-chatbot-page-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.65rem;
    color: var(--gc-muted);
    padding: 0 0.85rem 0.35rem;
    flex-shrink: 0;
}

.guide-chatbot-page-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-chatbot-clear {
    flex-shrink: 0;
    padding: 0.1rem 0.35rem;
    border: none;
    border-radius: 0.3rem;
    background: transparent;
    color: var(--gc-muted);
    font-size: 0.62rem;
    line-height: 1.3;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.guide-chatbot-clear:hover {
    opacity: 1;
    color: var(--gc-accent);
    background: var(--gc-surface);
}

/* Mobile */
@media (max-width: 480px) {
    .guide-chatbot-root {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .guide-chatbot-panel {
        width: calc(100vw - 1.5rem);
        height: min(70vh, 26rem);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .guide-chatbot-panel {
        animation: none;
    }

    .guide-chatbot-typing-dots span {
        animation: none;
        opacity: 0.6;
    }
}
