/* kapsul-chatbot.css - Kapsül Premium AI Asistan Arayüzü */

:root {
    --primary-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --secondary-gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
    --accent-glow: rgba(99, 102, 241, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(255, 255, 255, 0.6);
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.03);
    --premium-shadow: 0 20px 40px -15px rgba(31, 38, 135, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* ── Kayan Buton (Floating Action Button) ── */
#kapsul-chatbot-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease-in-out;
    animation: breathing-glow 3s infinite ease-in-out;
}

#kapsul-chatbot-fab:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 35px rgba(168, 85, 247, 0.6);
}

#kapsul-chatbot-fab:active {
    transform: scale(0.95);
}

/* Nefes alan parıltı animasyonu */
@keyframes breathing-glow {
    0% {
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4), 0 0 0 0px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 12px 35px rgba(168, 85, 247, 0.6), 0 0 0 12px rgba(168, 85, 247, 0);
    }
    100% {
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4), 0 0 0 0px rgba(99, 102, 241, 0);
    }
}

/* Okunmamış Mesaj Bildirimi */
.chatbot-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: linear-gradient(135deg, #ff4757, #ff6b81);
    color: white;
    font-size: 11px;
    font-weight: 800;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(255, 71, 87, 0.3);
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-badge.show {
    opacity: 1;
    transform: scale(1);
}

/* ── Chat Penceresi Container (Premium Glassmorphism) ── */
#kapsul-chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 400px;
    height: 640px;
    max-height: 82vh;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 24px;
    box-shadow: var(--premium-shadow);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px) scale(0.92);
    transform-origin: bottom right;
    transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

#kapsul-chatbot-window.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Mobil Uyumluluk */
@media (max-width: 480px) {
    #kapsul-chatbot-window {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 95px;
        height: calc(100vh - 125px);
        max-height: 85vh;
        border-radius: 20px;
    }
    #kapsul-chatbot-fab {
        bottom: 20px;
        right: 20px;
    }
}

/* ── Header Tasarımı ── */
.chatbot-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(168, 85, 247, 0.95));
    padding: 18px 22px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    z-index: 2;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: transform 0.3s ease;
}

.chatbot-avatar img {
    transition: transform 0.5s ease;
}

#kapsul-chatbot-window.open .chatbot-avatar img {
    transform: scale(1.05);
}

.chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
}

/* Aktif AI Yeşil Durum Noktası (Pulse Dot) */
.chatbot-title h3::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-dot 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.chatbot-title p {
    margin: 3px 0 0 0;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.85;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    line-height: 1;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* ── Limit Çubuğu ── */
.chatbot-limit-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    background: rgba(99, 102, 241, 0.05);
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
}

.chatbot-limit-track {
    flex: 1;
    height: 5px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 99px;
    overflow: hidden;
}

.chatbot-limit-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease;
}

.chatbot-limit-label {
    font-size: 10px;
    font-weight: 700;
    color: #4b5563;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Mesaj Alanı (Messages Container) ── */
.chatbot-messages {
    flex: 1;
    padding: 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(249, 250, 251, 0.4);
    scroll-behavior: smooth;
}

/* Özel Scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
}
.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* ── Mesaj Balonları (Message Bubbles) ── */
.chat-message {
    max-width: 82%;
    padding: 13px 17px;
    border-radius: 20px;
    font-size: 13.5px;
    line-height: 1.55;
    animation: messageSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    word-wrap: break-word;
    box-sizing: border-box;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(15px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bot Balonları - Premium Glass Style */
.chat-message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(230, 230, 250, 0.8);
}

/* Öğrenci Balonları - Premium Purple Gradient */
.chat-message.user {
    align-self: flex-end;
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.35);
    font-weight: 500;
}

/* Yazıyor (Typing) Göstergesi */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid rgba(230, 230, 250, 0.8);
    animation: indicatorFadeIn 0.25s ease;
}

@keyframes indicatorFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* ── Giriş Alanı (Floating Pill Input) ── */
.chatbot-input-container {
    padding: 16px 20px 20px 20px;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    gap: 12px;
    align-items: center;
    backdrop-filter: blur(10px);
}

.chatbot-input {
    flex: 1;
    border: 1.5px solid rgba(99, 102, 241, 0.12);
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.chatbot-input:focus {
    border-color: #8b5cf6;
    background: #ffffff;
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.01);
}

.chatbot-input::placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

/* Gönder Butonu */
.chatbot-send {
    background: var(--primary-gradient);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.chatbot-send:hover {
    background: var(--secondary-gradient);
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.chatbot-send:active {
    transform: scale(0.94);
}

.chatbot-send:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: scale(1) rotate(0);
    box-shadow: none;
}

.chatbot-send svg {
    margin-left: 2px;
    transition: transform 0.25s ease;
}

.chatbot-send:hover svg {
    transform: translate(1px, -1px);
}

/* ── Toast Bildirimleri (Glassmorphic Edge Glow) ── */
.chatbot-toast-item {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    border-radius: 12px !important;
    font-weight: 600;
    letter-spacing: -0.1px;
    margin-right: 15px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(8px) scale(0.92); }
}

/* ── Bot Mesajı Markdown & Zengin Biçimlendirme Stilleri ── */
.chat-message.bot p {
    margin: 0 0 8px;
}

.chat-message.bot p:last-child {
    margin-bottom: 0;
}

.chat-message.bot ul, .chat-message.bot ol {
    margin: 6px 0 6px 20px;
    padding: 0;
}

.chat-message.bot li {
    margin-bottom: 4px;
}

.chat-message.bot li:last-child {
    margin-bottom: 0;
}

/* Kod ve Vurgu Tasarımları */
.chat-message.bot code {
    background: rgba(99, 102, 241, 0.09);
    color: #4f46e5;
    font-family: 'Consolas', 'Courier New', Courier, monospace;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 12px;
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.chat-message.bot strong {
    color: #4f46e5;
    font-weight: 700;
}

/* Bağlantılar (Links) */
.chat-message.bot a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1.5px solid rgba(99, 102, 241, 0.2);
    transition: all 0.2s ease;
}

.chat-message.bot a:hover {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}
