/* ==========================================================================
   KAMPI - Akıllı Kampüs Asistanı Maskotu & Chatbot Widget
   ========================================================================== */

/* Sağ alttaki scroll-to-top ile çakışmayı önlemek için scroll-to-top sola çekilir */
#kt_scrolltop {
    right: 115px !important;
    z-index: 1030 !important;
}

/* Maskot Ana Kapsayıcı */
#kampi-mascot-container {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 1040;
    user-select: none;
    font-family: var(--bs-font-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

/* Yarı Gizlenen & Küçülüp Büyüyen Maskot Tetikleyici */
.kampi-trigger-wrapper {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Maskot Figürü - Şeffaf PNG Karakter Kesiti */
.kampi-avatar-figure {
    width: 86px;
    height: 120px;
    position: relative;
    background: transparent !important;
    /* Yarı gizlenen mod: hafif sağa ve alta batık durur */
    transform: translate(8px, 12px) scale(0.96);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.25));
    animation: kampiGentleFloat 4s ease-in-out infinite alternate;
}

.kampi-avatar-figure img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    display: block;
    pointer-events: none;
}

/* Hover'da Büyüme ve Dışarı Çıkma ("Küçülüp Büyüyen") */
.kampi-trigger-wrapper:hover .kampi-avatar-figure {
    transform: translate(-4px, -8px) scale(1.14) rotate(-2deg);
    filter: drop-shadow(0 16px 28px rgba(13, 110, 253, 0.38));
    animation: none;
}

/* Chat açıkken maskot duruşu */
#kampi-mascot-container.kampi-open .kampi-avatar-figure {
    transform: translate(0, 0) scale(1.05);
    filter: drop-shadow(0 12px 24px rgba(99, 102, 241, 0.35));
    animation: none;
}

/* Çevrimiçi / Online Yeşil Rozet */
.kampi-online-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    width: 15px;
    height: 15px;
    background-color: #10b981;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.7);
    z-index: 2;
    animation: kampiPulseBadge 2.2s infinite;
}

/* Sevimli Konuşma Balonu (Speech Bubble) */
.kampi-speech-bubble {
    position: absolute;
    bottom: 122px;
    right: 10px;
    background: #ffffff;
    color: #1e293b;
    padding: 9px 14px;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.06);
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.kampi-speech-bubble::after {
    content: "";
    position: absolute;
    bottom: -8px;
    right: 22px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

.kampi-speech-bubble.kampi-bubble-hidden {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: none;
}

/* Kampi Chat / Asistan Penceresi */
.kampi-chat-window {
    position: fixed;
    bottom: 96px;
    right: 20px;
    width: 390px;
    max-width: calc(100vw - 30px);
    height: 570px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.7) translateY(40px);
    transform-origin: bottom right;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    border: 1px solid rgba(226, 232, 240, 0.9);
    z-index: 1045;
}

#kampi-mascot-container.kampi-open .kampi-chat-window {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Chat Header */
.kampi-chat-header {
    background: linear-gradient(135deg, #0d9488 0%, #0284c7 50%, #4f46e5 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.kampi-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kampi-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    padding: 2px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.kampi-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.kampi-header-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kampi-header-subtitle {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.88);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.kampi-header-status-dot {
    width: 7px;
    height: 7px;
    background-color: #34d399;
    border-radius: 50%;
    display: inline-block;
}

.kampi-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.kampi-btn-header-action {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.kampi-btn-header-action:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: scale(1.05);
}

/* Chat Body (Mesaj Listesi) */
.kampi-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Hoş Geldin Kartı */
.kampi-welcome-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.kampi-welcome-mascot {
    width: 90px;
    height: 120px;
    margin: 0 auto 10px;
    background: transparent !important;
    animation: kampiGentleBob 3s ease-in-out infinite alternate;
}

.kampi-welcome-mascot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
    display: block;
}

.kampi-welcome-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.kampi-welcome-text {
    font-size: 12.5px;
    color: #475569;
    line-height: 1.45;
    margin-bottom: 12px;
}

/* Hızlı Öneri Butonları (Chips) */
.kampi-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.kampi-chip-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kampi-chip-btn:hover {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(14, 165, 233, 0.25);
}

/* Mesaj Balonları */
.kampi-message-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.kampi-message-row.user {
    justify-content: flex-end;
}

.kampi-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 2px;
}

.kampi-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.kampi-msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.kampi-message-row.bot .kampi-msg-bubble {
    background: #ffffff;
    color: #1e293b;
    border-top-left-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.kampi-message-row.user .kampi-msg-bubble {
    background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

/* Mesaj İçindeki Kartlar (Öğrenci, Modül vb.) */
.kampi-result-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.kampi-entity-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.kampi-entity-card:hover {
    background: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12);
    transform: translateY(-1px);
}

.kampi-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kampi-card-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0284c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.kampi-card-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.kampi-card-sub {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
}

.kampi-card-badge {
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 10px;
    background: #e2e8f0;
    color: #334155;
    font-weight: 600;
}

/* Mesaj İçi Hızlı Aksiyon Butonları */
.kampi-msg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.kampi-action-link {
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

/* Loading / Typing İndikatörü */
.kampi-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    width: fit-content;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.kampi-typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: kampiDotBounce 1.4s infinite ease-in-out both;
}

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

/* Chat Footer (Girdi Alanı) */
.kampi-chat-footer {
    padding: 10px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kampi-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.kampi-chat-input {
    width: 100%;
    padding: 10px 14px;
    padding-right: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.kampi-chat-input:focus {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.kampi-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.kampi-send-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.45);
}

.kampi-send-btn:active {
    transform: scale(0.96);
}

/* ==========================================================================
   Animasyonlar
   ========================================================================== */
@keyframes kampiGentleFloat {
    0% {
        transform: translate(14px, 14px) scale(0.96);
    }
    100% {
        transform: translate(12px, 8px) scale(1);
    }
}

@keyframes kampiGentleBob {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-6px);
    }
}

@keyframes kampiPulseBadge {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes kampiDotBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Mobil Uyumluluk */
@media (max-width: 576px) {
    #kampi-mascot-container {
        bottom: 10px;
        right: 10px;
    }
    .kampi-avatar-figure {
        width: 74px;
        height: 74px;
    }
    .kampi-chat-window {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 86px;
        height: 80vh;
    }
}

/* Rich Announcement Content (CKEditor rendering) */
.rich-announcement-content {
    line-height: 1.65;
    color: #1e293b;
    word-break: break-word;
}

.rich-announcement-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    display: block;
}

.rich-announcement-content table {
    width: 100% !important;
    border-collapse: collapse;
    margin: 12px 0;
}

.rich-announcement-content table td,
.rich-announcement-content table th {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
}

.rich-announcement-content p {
    margin-bottom: 0.75rem;
}

/* Okunmuş Duyuru Görsel İyileştirmesi */
.announcement-read {
    transition: opacity 0.2s ease;
}

.announcement-read:hover {
    opacity: 1 !important;
}
