/* ============================================================
   Minikod Akademi — Site Asistanı (Chatbot) Widget
   Bağımsız stil dosyası: tema (vendor) dosyalarına dokunmaz.
   Tüm kurallar #mk-chatbot kökü altında kapsüllenmiştir.
   ============================================================ */

#mk-chatbot,
#mk-chatbot * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#mk-chatbot {
    --mk-primary: #8d1783;        /* Minikod mor/magenta (site paleti) */
    --mk-primary-dark: #791d6f;
    --mk-primary-light: #f9ebf7;
    --mk-bg: #ffffff;
    --mk-text: #212529;
    --mk-muted: #6c757d;
    --mk-border: #eddfe9;
    --mk-user-bubble: #8d1783;
    --mk-bot-bubble: #f7f0f5;
    --mk-whatsapp: #25d366;
    --mk-radius: 16px;
    --mk-shadow: 0 10px 40px rgba(90, 15, 80, 0.22);

    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    color: var(--mk-text);
    font-size: 14.5px;
    line-height: 1.45;
}

/* ---------- Açma/kapatma balon butonu ---------- */
#mk-chatbot .mk-fab {
    position: relative;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mk-primary), var(--mk-primary-dark));
    color: #fff;
    cursor: pointer;
    box-shadow: var(--mk-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s ease, box-shadow .18s ease;
}

#mk-chatbot .mk-fab:hover { transform: scale(1.06); }
#mk-chatbot .mk-fab:focus-visible {
    outline: 3px solid #d98fce;
    outline-offset: 3px;
}

#mk-chatbot .mk-fab svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    pointer-events: none;
}

#mk-chatbot .mk-fab .mk-icon-close { display: none; }
#mk-chatbot.mk-open .mk-fab .mk-icon-chat { display: none; }
#mk-chatbot.mk-open .mk-fab .mk-icon-close { display: block; }

/* Okunmamış mesaj rozeti */
#mk-chatbot .mk-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #dc3545;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

#mk-chatbot .mk-badge.mk-show { display: flex; }

/* ---------- Panel ---------- */
#mk-chatbot .mk-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    background: var(--mk-bg);
    border-radius: var(--mk-radius);
    box-shadow: var(--mk-shadow);
    border: 1px solid var(--mk-border);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
}

#mk-chatbot.mk-open .mk-panel {
    display: flex;
    animation: mk-pop .18s ease-out;
}

@keyframes mk-pop {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Başlık ---------- */
#mk-chatbot .mk-header {
    background: linear-gradient(135deg, var(--mk-primary), var(--mk-primary-dark));
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#mk-chatbot .mk-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#mk-chatbot .mk-avatar svg { width: 22px; height: 22px; fill: #fff; }

#mk-chatbot .mk-header-info { flex: 1; min-width: 0; }

#mk-chatbot .mk-header-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff !important;
}

#mk-chatbot .mk-header-status {
    font-size: 12px;
    color: rgba(255, 255, 255, .85);
    display: flex;
    align-items: center;
    gap: 5px;
}

#mk-chatbot .mk-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

#mk-chatbot .mk-header-actions { display: flex; gap: 4px; }

#mk-chatbot .mk-header-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

#mk-chatbot .mk-header-btn:hover { background: rgba(255, 255, 255, .16); }
#mk-chatbot .mk-header-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
#mk-chatbot .mk-header-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Mesaj alanı ---------- */
#mk-chatbot .mk-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background: #fdfafc;
}

#mk-chatbot .mk-msg {
    max-width: 84%;
    padding: 10px 13px;
    border-radius: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-line;
    animation: mk-msg-in .16s ease-out;
}

@keyframes mk-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

#mk-chatbot .mk-msg-bot {
    align-self: flex-start;
    background: var(--mk-bot-bubble);
    color: var(--mk-text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--mk-border);
}

#mk-chatbot .mk-msg-user {
    align-self: flex-end;
    background: var(--mk-user-bubble);
    color: #fff;
    border-bottom-right-radius: 4px;
}

#mk-chatbot .mk-msg a {
    color: var(--mk-primary-dark) !important;
    font-weight: 600;
    text-decoration: underline;
}

#mk-chatbot .mk-msg-user a { color: #fff !important; }

#mk-chatbot .mk-msg strong { font-weight: 700; }

/* ---------- Yazıyor göstergesi ---------- */
#mk-chatbot .mk-typing {
    align-self: flex-start;
    background: var(--mk-bot-bubble);
    border: 1px solid var(--mk-border);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 12px 16px;
    display: flex;
    gap: 5px;
}

#mk-chatbot .mk-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mk-muted);
    animation: mk-blink 1.2s infinite;
}

#mk-chatbot .mk-typing span:nth-child(2) { animation-delay: .2s; }
#mk-chatbot .mk-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes mk-blink {
    0%, 70%, 100% { opacity: .3; transform: translateY(0); }
    35%           { opacity: 1;  transform: translateY(-3px); }
}

/* ---------- Hızlı yanıt çipleri ---------- */
#mk-chatbot .mk-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-self: flex-start;
    max-width: 95%;
}

#mk-chatbot .mk-chip {
    border: 1.5px solid var(--mk-primary);
    background: #fff;
    color: var(--mk-primary-dark);
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-height: 34px;
    transition: background .15s, color .15s;
}

#mk-chatbot .mk-chip:hover,
#mk-chatbot .mk-chip:focus-visible {
    background: var(--mk-primary);
    color: #fff;
    outline: none;
}

/* ---------- Aksiyon butonları (WhatsApp / telefon / link) ---------- */
#mk-chatbot .mk-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    align-self: flex-start;
    max-width: 84%;
    width: 260px;
}

#mk-chatbot .mk-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    min-height: 42px;
    transition: filter .15s, transform .1s;
}

#mk-chatbot .mk-action-btn:hover { filter: brightness(.94); transform: translateY(-1px); }
#mk-chatbot .mk-action-btn:focus-visible { outline: 3px solid #d98fce; outline-offset: 2px; }
#mk-chatbot .mk-action-btn svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

#mk-chatbot .mk-action-whatsapp { background: var(--mk-whatsapp); color: #fff !important; }
#mk-chatbot .mk-action-phone    { background: var(--mk-primary); color: #fff !important; }
#mk-chatbot .mk-action-link     { background: var(--mk-primary-light); color: var(--mk-primary-dark) !important; border: 1.5px solid var(--mk-primary); }

/* ---------- Giriş alanı ---------- */
#mk-chatbot .mk-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--mk-border);
    background: #fff;
    flex-shrink: 0;
}

#mk-chatbot .mk-input {
    flex: 1;
    border: 1.5px solid var(--mk-border);
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 14.5px;
    color: var(--mk-text);
    background: #fff;
    outline: none;
    min-height: 42px;
    transition: border-color .15s;
}

#mk-chatbot .mk-input:focus { border-color: var(--mk-primary); }
#mk-chatbot .mk-input::placeholder { color: #a5a1b5; }

#mk-chatbot .mk-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--mk-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .1s;
}

#mk-chatbot .mk-send:hover { background: var(--mk-primary-dark); transform: scale(1.05); }
#mk-chatbot .mk-send:focus-visible { outline: 3px solid #d98fce; outline-offset: 2px; }
#mk-chatbot .mk-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#mk-chatbot .mk-send svg { width: 19px; height: 19px; fill: currentColor; }

/* ---------- Alt bilgi ---------- */
#mk-chatbot .mk-footer {
    text-align: center;
    font-size: 11px;
    color: var(--mk-muted);
    padding: 5px 10px 8px;
    background: #fff;
    flex-shrink: 0;
}

/* ---------- Mobil ---------- */
@media (max-width: 480px) {
    #mk-chatbot { right: 12px; bottom: 12px; }

    #mk-chatbot .mk-panel {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: 84px;
        width: auto;
        height: calc(100vh - 100px);
        height: calc(100dvh - 100px);
    }

    #mk-chatbot .mk-fab { width: 54px; height: 54px; }
}

/* ---------- Erişilebilirlik ---------- */
@media (prefers-reduced-motion: reduce) {
    #mk-chatbot *,
    #mk-chatbot .mk-panel,
    #mk-chatbot .mk-msg {
        animation: none !important;
        transition: none !important;
    }
    #mk-chatbot .mk-messages { scroll-behavior: auto; }
}

#mk-chatbot .mk-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Yazdırma çıktısında gizle (raporlar chatbot ile yazdırılmasın) */
@media print {
    #mk-chatbot { display: none !important; }
}
