/* static/css/chatbot_2026.css */

/* Variables - Lila Branding (Master Strategy v5.0) */
:root {
    /* Map to Global Lila Variables if available, else fallback */
    --ai-primary: var(--lila-primary, #a78bfa);
    /* Lila (Soft Purple) */
    --ai-primary-hover: var(--lila-primary-hover, #8b5cf6);
    --ai-accent: var(--lila-secondary, #38bdf8);
    /* Neon Blue-ish */

    --ai-bg: var(--lila-glass-bg, rgba(255, 255, 255, 0.90));
    /* Glass */
    --ai-border: var(--lila-glass-border, rgba(255, 255, 255, 0.6));
    --ai-text: var(--lila-text-primary, #334155);
    --ai-text-light: var(--lila-text-secondary, #64748b);
    --ai-shadow: var(--lila-glass-shadow, 0 10px 40px -10px rgba(139, 92, 246, 0.15));
    /* Purple shadow */

    --ai-radius: var(--lila-radius-lg, 24px);

    --ai-msg-user-bg: var(--lila-primary, #8b5cf6);
    /* Lila Dark */
    --ai-msg-user-text: #ffffff;
    --ai-msg-model-bg: var(--lila-bg-secondary, #f8fafc);
    --ai-msg-model-text: var(--lila-text-primary, #334155);
}

/* --- SMART DOCK (Bottom Right) --- */
.smart-dock-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1035 !important;
    display: flex;
    justify-content: flex-end;
}

/* ... content ... */

/* --- MAIN WINDOW --- */
.ai-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 1035 !important;
    width: 420px;
    /* Slightly wider */
    height: 700px;
    /* Taller as requested */
    max-height: 85vh;
    /* Responsive cap */
    max-width: calc(100vw - 40px);
    /* Mobile Safe Width */

    background: var(--ai-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);

    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    box-shadow: var(--ai-shadow);

    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Animation (Pop up) */
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Hidden state */
.ai-window.hidden {
    display: none;
    pointer-events: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- HEADER --- */
.ai-header {
    height: 80px;
    /* Taller header for the sphere */
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;

    /* Subtle gradient bg */
    background: linear-gradient(to right, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
}

.ai-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* LILA MAGIC SPHERE */
.lila-sphere {
    width: 48px;
    height: 48px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lila-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--ai-accent), var(--ai-primary));
    box-shadow: 0 0 20px var(--ai-primary);
    filter: blur(0px);
    opacity: 0.9;
    animation: breathe 3s infinite ease-in-out;
}

/* Inner glow ring */
.lila-sphere::after {
    content: '';
    position: absolute;
    width: 120%;
    height: 120%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    filter: blur(4px);
    animation: rotateRing 6s infinite linear;
    opacity: 0.6;
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--ai-primary);
    }

    50% {
        transform: scale(0.95);
        box-shadow: 0 0 35px var(--ai-primary-hover);
    }
}

@keyframes rotateRing {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.05);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

.ai-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ai-text);
    letter-spacing: -0.02em;
}

.ai-status {
    font-size: 0.8rem;
    color: var(--ai-primary);
    font-weight: 500;
}

.ai-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--ai-text-light);
    cursor: pointer;
}

/* Body */
.ai-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Messages */
.ai-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message-user {
    align-self: flex-end;
    background: var(--ai-msg-user-bg);
    color: var(--ai-msg-user-text);
    border-bottom-right-radius: 4px;
}

.ai-message-model {
    align-self: flex-start;
    background: var(--ai-msg-model-bg);
    color: var(--ai-msg-model-text);
    border-bottom-left-radius: 4px;
}

/* Chips */
.ai-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.ai-chip {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--ai-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chip:hover {
    background: #eef2ff;
    border-color: var(--ai-primary);
}

/* Footer */
.ai-footer {
    padding: 16px;
    background: rgba(255, 255, 255, 0.8);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-input-wrapper {
    display: flex;
    gap: 10px;
    background: #ffffff;
    padding: 8px 12px;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition: border 0.2s;
}

.ai-input-wrapper:focus-within {
    border-color: var(--ai-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

#chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    background: transparent;
}

/* Fix Send Button (Specific Fixes) */
.ai-send-btn {
    background: var(--ai-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;

    /* FIXES */
    opacity: 1 !important;
    pointer-events: auto !important;
}

.ai-send-btn svg {
    pointer-events: none;
    /* Crucial: Let click pass to button */
}

.ai-send-btn:hover {
    transform: scale(1.1);
    background: var(--ai-primary-hover);
}

.ai-footer-note {
    text-align: center;
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 8px;
}

/* ==========================================================================
   [2026-01] TYPING INDICATOR - Lila is thinking...
   ========================================================================== */

.lila-typing-indicator {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    animation: fadeInUp 0.3s ease-out;
}

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

.lila-typing-indicator .typing-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.lila-typing-indicator .typing-avatar img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.lila-typing-indicator .typing-content {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ai-msg-model-bg, #f8fafc);
    padding: 12px 20px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.lila-typing-indicator .typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lila-typing-indicator .typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ai-primary, #a78bfa);
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.lila-typing-indicator .typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.lila-typing-indicator .typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.lila-typing-indicator .typing-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.lila-typing-indicator .typing-text {
    font-size: 0.85rem;
    color: var(--ai-text-light, #64748b);
    font-style: italic;
}

/* Pulse glow effect on avatar */
.lila-typing-indicator .typing-avatar::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    animation: pulseGlow 2s infinite;
    z-index: -1;
}

@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .lila-typing-indicator .typing-content {
        background: rgba(30, 41, 59, 0.8);
    }

    .lila-typing-indicator .typing-text {
        color: rgba(255, 255, 255, 0.7);
    }
}

/* ============================================
   [2026-01] REGENERATE BUTTON & ANIMATION
   ============================================ */

/* Regenerate button specific styles */
.lila-regenerate-btn {
    transition: all 0.2s ease !important;
}

.lila-regenerate-btn:hover {
    color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.1) !important;
    transform: rotate(15deg);
}

.lila-regenerate-btn:active {
    transform: rotate(180deg);
}

/* Spin animation for loading state */
@keyframes lila-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.lila-spin {
    animation: lila-spin 1s linear infinite;
}

/* Regenerating message state */
.lila-regenerating {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: var(--ai-text-light, #64748b);
    font-style: italic;
    font-size: 14px;
}

.lila-regenerating::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #f59e0b;
    border-top-color: transparent;
    border-radius: 50%;
    animation: lila-spin 0.8s linear infinite;
}

/* Regeneration count badge */
.lila-regeneration-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 6px;
    padding: 2px 8px;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Action button container enhancements */
/* [FIX 2026-01] Feedback butonları her zaman görünür olmalı */
.ai-msg-actions {
    opacity: 0.6;  /* Varsayılan: yarı görünür */
    transition: opacity 0.2s ease;
}

.ai-message-model:hover .ai-msg-actions {
    opacity: 1;  /* Hover'da tam görünür */
}

/* Feedback buttons should always be fully visible */
.ai-msg-actions .lila-feedback-container {
    opacity: 1 !important;
}

/* Always show on touch devices */
@media (hover: none) {
    .ai-msg-actions {
        opacity: 1;
    }
}

/* Dark mode for regenerate */
@media (prefers-color-scheme: dark) {
    .lila-regenerating {
        color: rgba(255, 255, 255, 0.6);
    }

    .lila-regeneration-badge {
        background: rgba(245, 158, 11, 0.15);
        border-color: rgba(245, 158, 11, 0.3);
        color: #fbbf24;
    }
}