/**
 * Silivri Haber Hattı - Akıllı Karga Maskot & Sesli AI Asistanı (Karga AI)
 * Ultra-Modern SVG Animasyon, Chatbot & Etkileşim CSS
 */

:root {
    --karga-primary: #dc2626;
    --karga-dark: #0f172a;
    --karga-beak: #f59e0b;
    --karga-beak-dark: #d97706;
}

/* Ana Konteyner (Yüzen Maskot) */
.karga-mascot-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

/* Karga Buton / Sahne Alanı */
.karga-stage {
    position: relative;
    width: 98px;
    height: 98px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}

/* 3D Canvas Kapsayıcısı */
.karga-3d-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.karga-3d-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    outline: none;
}

.karga-stage:hover {
    transform: scale(1.1) translateY(-4px);
}

.karga-stage:active {
    transform: scale(0.95);
}

/* Karga Rozeti (GAK! Baloncuğu) */
.karga-badge-tag {
    position: absolute;
    top: -4px;
    left: -4px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.4);
    letter-spacing: 0.5px;
    animation: kargaPulse 2.5s infinite;
    pointer-events: none;
}

@keyframes kargaPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* SVG Karakter Parçaları & Animasyonları */
.karga-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Doğal Nefes Alma & Tüneme */
.karga-body-group {
    animation: kargaBreathe 3.5s ease-in-out infinite;
    transform-origin: 50% 85%;
}

@keyframes kargaBreathe {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50% { transform: translateY(-2.5px) scaleY(1.025); }
}

/* Kafa Hareketi */
.karga-head-group {
    transform-origin: 50% 45%;
    transition: transform 0.25s ease-out;
}

.karga-stage:hover .karga-head-group {
    transform: rotate(7deg);
}

/* Göz Kırpma */
.karga-eyelid {
    transform-origin: 50% 30%;
    transition: transform 0.1s ease;
    transform: scaleY(0);
}

.karga-eyelid.blinking {
    transform: scaleY(1) !important;
}

/* Kanat Çırpma */
.karga-wing-left {
    transform-origin: 30% 55%;
    transition: transform 0.2s ease;
}

.karga-wing-right {
    transform-origin: 70% 55%;
    transition: transform 0.2s ease;
}

.karga-stage.flapping .karga-wing-left {
    animation: kargaWingFlapLeft 0.2s ease-in-out 3;
}

.karga-stage.flapping .karga-wing-right {
    animation: kargaWingFlapRight 0.2s ease-in-out 3;
}

@keyframes kargaWingFlapLeft {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-35deg) translateY(-8px); }
}

@keyframes kargaWingFlapRight {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(35deg) translateY(-8px); }
}

/* Konuşma Sırasında Gaga Hareketi (Lip-Sync) */
.karga-beak-lower {
    transform-origin: 65% 38%;
    transition: transform 0.08s ease;
}

.karga-stage.speaking .karga-beak-lower {
    animation: kargaBeakTalk 0.16s ease-in-out infinite alternate;
}

@keyframes kargaBeakTalk {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(20deg); }
}

/* Zıplama & Heyecan Hareketi */
.karga-stage.excited {
    animation: kargaHop 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) 1;
}

@keyframes kargaHop {
    0%, 100% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-16px) scale(1.08) rotate(-4deg); }
    60% { transform: translateY(-6px) scale(1.02) rotate(3deg); }
}

/* ======================================================== */
/* 💬 AI CHATBOT & SESLİ ASİSTAN PENCERESİ */
/* ======================================================== */
.karga-speech-box {
    position: absolute;
    bottom: 110px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 30px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.24), 0 0 0 1px rgba(0, 0, 0, 0.08);
    display: none;
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 9995;
    overflow: hidden;
    user-select: text;
    -webkit-user-select: text;
}

.karga-speech-box.show {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Konuşma Balonu Oku */
.karga-speech-box::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 36px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.04);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

/* Header */
.karga-speech-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    border-bottom: 1px solid #f1f5f9;
}

.karga-speech-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.karga-avatar-mini {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.karga-name {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}

.karga-status-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #16a34a;
    font-weight: 600;
    margin-top: -1px;
}

.karga-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25);
    animation: kargaStatusPulse 2s infinite;
}

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

/* Header Action Buttons */
.karga-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.karga-icon-btn,
.karga-speech-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 13px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.karga-icon-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.karga-speech-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Ses Spektrumu / Dalga Göstergesi */
.karga-wave-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 14px;
    margin-left: 4px;
}

.karga-wave-bar {
    width: 3px;
    height: 100%;
    background: #dc2626;
    border-radius: 2px;
    animation: kargaWaveAnim 0.5s ease-in-out infinite alternate;
}

.karga-wave-bar:nth-child(2) { animation-delay: 0.12s; }
.karga-wave-bar:nth-child(3) { animation-delay: 0.24s; }
.karga-wave-bar:nth-child(4) { animation-delay: 0.36s; }

@keyframes kargaWaveAnim {
    0% { height: 25%; }
    100% { height: 100%; }
}

/* 💬 Mesajlaşma Alanı (Scrollable) */
.karga-chat-messages {
    padding: 12px 14px;
    max-height: 220px;
    min-height: 100px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fdfdfd;
}

.karga-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.karga-chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.karga-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.karga-msg {
    display: flex;
    flex-direction: column;
    max-width: 90%;
    animation: kargaMsgIn 0.25s ease forwards;
}

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

.karga-msg-bot {
    align-self: flex-start;
}

.karga-msg-user {
    align-self: flex-end;
}

.karga-msg-bubble {
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.45;
    word-break: break-word;
}

.karga-msg-bot .karga-msg-bubble {
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 3px;
}

.karga-msg-bot .karga-msg-bubble a {
    color: #dc2626;
    font-weight: 700;
    text-decoration: underline;
}

.karga-msg-user .karga-msg-bubble {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #ffffff;
    border-bottom-right-radius: 3px;
}

/* Tekrar Dinle Butonu */
.karga-replay-btn {
    align-self: flex-start;
    margin-top: 3px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    padding: 1px 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.karga-replay-btn:hover {
    color: #dc2626;
}

/* Yazıyor / Düşünüyor Animasyonu */
.karga-typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 11px;
    color: #64748b;
    background: #f8fafc;
    border-top: 1px dashed #e2e8f0;
}

.typing-dots {
    display: inline-flex;
    gap: 3px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #dc2626;
    animation: typingBounce 1s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* 🏷️ Hızlı Öneri Çipleri */
.karga-chips-scroll {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    white-space: nowrap;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    scrollbar-width: none;
}

.karga-chips-scroll::-webkit-scrollbar {
    display: none;
}

.karga-chip {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
}

.karga-chip:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
    transform: translateY(-1px);
}

.karga-chip-whatsapp {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #16a34a;
}

.karga-chip-whatsapp:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

/* ⌨️ İnteraktif Input & Mikrofon Barı */
.karga-input-form {
    padding: 8px 12px 10px 12px;
    background: #ffffff;
}

.karga-input-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 3px 6px 3px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.karga-input-wrap:focus-within {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
    background: #ffffff;
}

.karga-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 12px;
    color: #0f172a;
    padding: 6px 0;
}

.karga-input::placeholder {
    color: #94a3b8;
}

.karga-mic-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.karga-mic-btn:hover {
    background: #cbd5e1;
    color: #0f172a;
}

/* Mikrofon Dinleme Aktifken Pulsing Kırmızı Halka */
.karga-mic-btn.recording {
    background: #dc2626 !important;
    color: #ffffff !important;
    animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.karga-send-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #dc2626;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
}

.karga-send-btn:hover {
    background: #b91c1c;
    transform: scale(1.08);
}

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

/* Footer Bilgi */
.karga-speech-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px 8px 14px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    font-size: 10px;
    color: #64748b;
}

/* Uyku Modu (Gizlendiğinde Mini Buton) */
.karga-mascot-container.sleeping .karga-stage {
    display: none;
}

.karga-mascot-container.sleeping .karga-wake-btn {
    display: flex;
}

.karga-wake-btn {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0f172a;
    color: #f59e0b;
    border: 2px solid #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.karga-wake-btn:hover {
    transform: scale(1.12);
    background: #dc2626;
    color: #ffffff;
}

/* Mobil Uyumluluk */
@media (max-width: 768px) {
    .karga-mascot-container {
        bottom: 16px;
        right: 12px;
    }
    
    .karga-stage {
        width: 76px;
        height: 76px;
    }

    .karga-speech-box {
        width: 310px;
        bottom: 95px;
        right: -4px;
    }

    .karga-chat-messages {
        max-height: 180px;
    }
}

/* ======================================================== */
/* 🎙️ KARŞILIKLI CANLI SESLİ SOHBET & 3 DAKİKA LİMİTİ STİLLERİ */
/* ======================================================== */
.karga-voice-session-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    color: #991b1b;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.15);
    animation: kargaVoicePillPulse 2s infinite ease-in-out;
}

@keyframes kargaVoicePillPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15); }
}

.karga-voice-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #dc2626;
    animation: kargaVoiceDotBlink 1s infinite;
}

@keyframes kargaVoiceDotBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.85); }
}

.karga-voice-timer-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
    font-size: 11.5px;
    color: #b91c1c;
    letter-spacing: 0.5px;
}

.karga-voice-stop-btn {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    border-radius: 9999px;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.karga-voice-stop-btn:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

/* Canlı Sesli Sohbet & Çok Dilli Eylem Çubuğu */
.karga-voice-cta-wrap {
    padding: 6px 12px 6px 12px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.karga-voice-action-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.karga-voice-live-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border: 1px solid #334155;
    border-radius: 10px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.12);
}

.karga-voice-btn-left {
    display: flex;
    align-items: center;
    gap: 7px;
}

.karga-live-mic-pulse {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.15);
    color: #ef4444;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    transition: all 0.2s ease;
}

.karga-voice-btn-label {
    letter-spacing: 0.2px;
}

.karga-voice-live-btn:hover {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.karga-voice-live-btn.active {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    border-color: #ef4444;
    animation: kargaVoiceBtnPulse 1.8s infinite;
}

.karga-voice-live-btn.active .karga-live-mic-pulse {
    background: #ffffff;
    color: #dc2626;
    animation: kargaVoiceDotBlink 0.9s infinite;
}

@keyframes kargaVoiceBtnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
    50% { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.2); }
}

.karga-voice-live-badge {
    background: #dc2626;
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.karga-voice-live-btn.active .karga-voice-live-badge {
    background: #ffffff;
    color: #dc2626;
}

/* Çok Dilli Seçici Haplar (TR, EN, DE) */
.karga-lang-pill-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 2px 0;
}

.karga-lang-chip {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.karga-lang-chip:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

.karga-lang-chip.active {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.25);
}

