/**
 * AI Chat System Styles
 *
 * Bu dosya AI Chat floating widget için gerekli tüm CSS stillerini içerir.
 * Component: resources/views/components/ai/floating-widget.blade.php
 *
 * İçerik:
 * 1. Alpine.js x-cloak utility
 * 2. AI Robot Button Animations (wiggle, bounce, pulse)
 * 3. AI Message Bubbles (user/assistant role colors)
 * 4. AI Product/Category Link Styles
 *
 * @version 1.0.0
 * @package AI Content System
 */

/* ========================================
   Alpine.js Utility
   ======================================== */
[x-cloak] {
    display: none !important;
}

/* ========================================
   AI Robot Button Animations
   ======================================== */

/* V1 Classic Pulse Animation */
.v1-classic-button::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: inherit;
    z-index: -1;
    animation: pulse-v1 2s infinite;
}

@keyframes pulse-v1 {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        opacity: 0;
    }
}

/* Bubble Fade Animation */
@keyframes bubble-fade {
    0%, 100% {
        opacity: 0;
        transform: translateY(10px) scale(0.85);
    }
    20%, 80% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Wiggle Animation */
@keyframes wiggle {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* Slow Bounce Animation */
@keyframes bounce-slow {
    0%, 100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(-15px);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* Slow Pulse Animation */
@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Welcome Section Animations */
@keyframes ping-slow {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes bounce-subtle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes wiggle-subtle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-3deg);
    }
    75% {
        transform: rotate(3deg);
    }
}

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

/* Animation Utility Classes */
.animate-wiggle {
    animation: wiggle 2s ease-in-out infinite;
}

.animate-bounce-slow {
    animation: bounce-slow 3s ease-in-out infinite;
}

.animate-pulse-slow {
    animation: pulse-slow 4s ease-in-out infinite;
}

.animate-bubble-fade {
    animation: bubble-fade 3s infinite;
}

.animate-ping-slow {
    animation: ping-slow 3s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.animate-bounce-subtle {
    animation: bounce-subtle 2s ease-in-out infinite;
}

.animate-wiggle-subtle {
    animation: wiggle-subtle 2.5s ease-in-out infinite;
}

.animate-fade-in-up {
    animation: fade-in-up 0.6s ease-out forwards;
}

.animation-delay-100 {
    animation-delay: 0.1s;
    opacity: 0;
}

/* Input Animations */
@keyframes input-invite {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        opacity: 0.2;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.3;
    }
}

.animate-input-invite {
    animation: input-invite 2s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

/* ========================================
   AI Message Bubble Colors
   ======================================== */

/* USER MESSAGES - Always white text (both light and dark mode) */
.ai-floating-message-content[data-role="user"],
.ai-floating-message-content[data-role="user"] *,
.ai-floating-message-content[data-role="user"] p,
.ai-floating-message-content[data-role="user"] span,
.ai-floating-message-content[data-role="user"] strong,
.ai-floating-message-content[data-role="user"] em,
.ai-floating-message-content[data-role="user"] li,
.ai-floating-message-content[data-role="user"] ul,
.ai-floating-message-content[data-role="user"] ol,
.ai-floating-message-content[data-role="user"] h1,
.ai-floating-message-content[data-role="user"] h2,
.ai-floating-message-content[data-role="user"] h3 {
    color: white !important;
}

/* DARK MODE TEXT FIX - Assistant/System messages white in dark mode */
.dark .ai-floating-message-content[data-role="assistant"],
.dark .ai-floating-message-content[data-role="assistant"] *,
.dark .ai-floating-message-content[data-role="system"],
.dark .ai-floating-message-content[data-role="system"] * {
    color: white !important;
}

/* Links - Special colors */
.ai-floating-message-content[data-role="user"] a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: underline;
}

.dark .ai-floating-message-content a {
    color: #fb923c !important; /* orange-400 */
}

/* ========================================
   AI Product/Category Link Styles
   ======================================== */

/* Product Links - Blue with subtle background box */
.ai-product-link {
    color: #2563eb !important; /* blue-600 */
    text-decoration: none !important;
    display: inline-block;
    margin: 4px 0;
    padding: 6px 12px;
    background: rgba(37, 99, 235, 0.08); /* subtle blue bg */
    border-radius: 6px;
    border-left: 3px solid #2563eb;
    transition: all 0.2s ease;
    line-height: 1.5;
    font-weight: 600;
}

.ai-product-link:hover {
    color: #1d4ed8 !important; /* blue-700 */
    background: rgba(37, 99, 235, 0.15);
    border-left-color: #1d4ed8;
    transform: translateX(3px);
}

/* Category Links - Green with underline */
.ai-category-link {
    color: #059669 !important; /* emerald-600 */
    text-decoration: underline !important;
    text-underline-offset: 3px;
    display: block;
    margin: 6px 0;
    transition: all 0.2s ease;
    line-height: 1.6;
    font-weight: 600;
}

.ai-category-link:hover {
    color: #047857 !important; /* emerald-700 */
    text-decoration-thickness: 2px !important;
    transform: translateX(2px);
}

/* Standard Links - Orange (catch-all for markdown [text](url)) */
.ai-standard-link {
    color: #ea580c !important; /* orange-600 */
    text-decoration: underline !important;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.ai-standard-link:hover {
    color: #c2410c !important; /* orange-700 */
    text-decoration-thickness: 2px !important;
}

/* WhatsApp Links - Green with icon hint */
.ai-whatsapp-link {
    color: #16a34a !important; /* green-600 */
    text-decoration: underline !important;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    font-weight: 600;
}

.ai-whatsapp-link:hover {
    color: #15803d !important; /* green-700 */
    text-decoration-thickness: 2px !important;
}

.ai-whatsapp-link::before {
    content: "💬 ";
}

/* Email Links - Blue */
.ai-email-link {
    color: #0284c7 !important; /* sky-600 */
    text-decoration: underline !important;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.ai-email-link:hover {
    color: #0369a1 !important; /* sky-700 */
    text-decoration-thickness: 2px !important;
}

.ai-email-link::before {
    content: "📧 ";
}

/* Phone Links - Purple */
.ai-phone-link {
    color: #9333ea !important; /* purple-600 */
    text-decoration: underline !important;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.ai-phone-link:hover {
    color: #7e22ce !important; /* purple-700 */
    text-decoration-thickness: 2px !important;
}

.ai-phone-link::before {
    content: "📞 ";
}

/* Telegram Links - Blue */
.ai-telegram-link {
    color: #0088cc !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.ai-telegram-link:hover {
    color: #006699 !important;
    text-decoration-thickness: 2px !important;
}

/* Bold text inside links */
.ai-product-link strong,
.ai-category-link strong,
.ai-standard-link strong,
.ai-whatsapp-link strong,
.ai-email-link strong,
.ai-phone-link strong {
    font-weight: 700;
}

/* Dark mode link renkleri — SITE class-based toggle (.dark) ile uyumlu.
   ÖNCEDEN @media (prefers-color-scheme: dark) idi (OS bazlı), site html.dark ile çakışıyordu. */
.dark .ai-product-link {
    color: #60a5fa !important; /* blue-400 */
    background: rgba(96, 165, 250, 0.12);
    border-left-color: #60a5fa;
}
.dark .ai-product-link:hover {
    color: #93c5fd !important; /* blue-300 */
    background: rgba(96, 165, 250, 0.2);
    border-left-color: #93c5fd;
}
.dark .ai-category-link {
    color: #34d399 !important; /* emerald-400 */
}
.dark .ai-category-link:hover {
    color: #6ee7b7 !important; /* emerald-300 */
}
.dark .ai-standard-link {
    color: #fb923c !important; /* orange-400 */
}
.dark .ai-standard-link:hover {
    color: #fdba74 !important; /* orange-300 */
}
.dark .ai-whatsapp-link {
    color: #4ade80 !important; /* green-400 */
}
.dark .ai-whatsapp-link:hover {
    color: #86efac !important; /* green-300 */
}
.dark .ai-email-link {
    color: #38bdf8 !important; /* sky-400 */
}
.dark .ai-email-link:hover {
    color: #7dd3fc !important; /* sky-300 */
}
.dark .ai-phone-link {
    color: #c084fc !important; /* purple-400 */
}
.dark .ai-phone-link:hover {
    color: #e9d5ff !important; /* purple-200 */
}
.dark .ai-telegram-link {
    color: #38bdf8 !important;
}
.dark .ai-telegram-link:hover {
    color: #7dd3fc !important;
}

/* ========================================
   Özel Tooltip (ai-tip) — native title yerine, anında + şık
   data-tip="..." ile yazı; ai-tip-down (header) / ai-tip-up (input)
   ======================================== */
.ai-tip { position: relative; }

.ai-tip::after {
    content: attr(data-tip);
    position: absolute;
    right: 0;
    background: rgba(17, 24, 39, 0.97);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: .1px;
    padding: 5px 9px;
    border-radius: 7px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 60;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
    transition: opacity .14s ease, transform .14s ease;
}
.ai-tip::before {
    content: '';
    position: absolute;
    left: 50%;
    border: 5px solid transparent;
    pointer-events: none;
    opacity: 0;
    z-index: 60;
    transition: opacity .14s ease;
}

/* Aşağı açılan (header ikonları) — sağ kenara hizalı, sola doğru açılır (taşmaz) */
.ai-tip-down::after {
    top: calc(100% + 9px);
    transform: translateY(-3px);
}
.ai-tip-down::before {
    top: calc(100% + 4px);
    right: 50%;
    transform: translateX(50%);
    border-bottom-color: rgba(17, 24, 39, 0.97);
}
.ai-tip-down:hover::after { opacity: 1; transform: translateY(0); }
.ai-tip-down:hover::before { opacity: 1; }

/* Yukarı açılan (input mikrofon/gönder) — sağ kenara hizalı */
.ai-tip-up::after {
    bottom: calc(100% + 9px);
    transform: translateY(3px);
}
.ai-tip-up::before {
    bottom: calc(100% + 4px);
    right: 50%;
    transform: translateX(50%);
    border-top-color: rgba(17, 24, 39, 0.97);
}
.ai-tip-up:hover::after { opacity: 1; transform: translateY(0); }
.ai-tip-up:hover::before { opacity: 1; }

/* Mobilde tooltip gizle (dokunmada gereksiz) */
@media (max-width: 1023px) {
    .ai-tip::after, .ai-tip::before { display: none; }
}

/* ========================================
   "Düşünüyor" Zıplayan Noktalar (. .. ...)
   Noktalar sırayla yukarı zıplar + parlar (sol→sağ dalga)
   ======================================== */
.ai-thinking-dots {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    margin-left: 1px;
    height: 1em;
    line-height: 1;
}

.ai-thinking-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    transform: translateY(0);
    animation: ai-thinking-bounce 1.3s infinite ease-in-out;
}

.ai-thinking-dot:nth-child(1) { animation-delay: 0s; }
.ai-thinking-dot:nth-child(2) { animation-delay: 0.18s; }
.ai-thinking-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes ai-thinking-bounce {
    0%, 70%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    35% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ai-thinking-dot { animation: ai-thinking-pulse 1.4s infinite ease-in-out; }
    @keyframes ai-thinking-pulse {
        0%, 100% { opacity: 0.35; }
        50% { opacity: 1; }
    }
}

/* ========================================
   Rotating Suggestions (Placeholder Animation)
   ======================================== */

/* Fade animation for rotating suggestions */
@keyframes suggestion-fade {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    10%, 90% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Container for rotating suggestions */
.rotating-suggestion-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Individual rotating suggestions */
.rotating-suggestion {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    transform: translateY(10px);
}

/* Active suggestion (visible) */
.rotating-suggestion.active {
    opacity: 1;
    transform: translateY(0);
}

/* ====================================================================
 * WIDGET TİPOGRAFİSİ — host temadan BAĞIMSIZ (her tenant'ta tutarlı)
 * Widget Ubuntu fontunu kendi yükler (floating-widget.blade <link>).
 * Böylece varilsan gibi farklı body fontu olan temalarda da turkbilisim
 * ile birebir aynı, temiz tipografi görünür. input/button/textarea
 * varsayılan olarak font miras almaz → açıkça dahil edildi.
 * ==================================================================== */
.ai-chat-root,
.ai-chat-root input,
.ai-chat-root textarea,
.ai-chat-root button,
.ai-chat-root select,
.ai-chat-root .ai-floating-message-content {
    font-family: 'Ubuntu', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
/* Mesaj metni: temiz okunur satır yüksekliği + paragraf boşluğu
   (host temanın p/li margin sızıntısını sıfırla → padding/margin tutarlı) */
.ai-chat-root .ai-floating-message-content {
    line-height: 1.6;
}
.ai-chat-root .ai-floating-message-content p {
    margin: 0 0 0.6em;
}
.ai-chat-root .ai-floating-message-content p:last-child {
    margin-bottom: 0;
}
