/* ===================================================
   ChatGPT Canlı Destek Botu - CSS
   =================================================== */

/* ── Toggle Butonu ──────────────────────────────── */
#chat-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.45);
    z-index: 9990;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}
#chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.6);
}
#chat-toggle.active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
#chat-toggle .chat-btn-icon {
    position: relative;
    z-index: 1;
}

/* Pulse halkası */
#chat-toggle .chat-btn-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.4);
    animation: chatPulse 2.5s ease-out infinite;
}
@keyframes chatPulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.9); opacity: 0; }
}

/* Bildirim rozeti */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    font-family: 'Inter', sans-serif;
}

/* ── Chat Penceresi ─────────────────────────────── */
#chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 370px;
    max-height: 580px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 9989;
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

/* Açık/kapalı animasyon */
#chat-window.chat-closed {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}
#chat-window.chat-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Header ─────────────────────────────────────── */
.chat-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}
.chat-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
}
.chat-status {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    animation: statusPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.chat-header-actions {
    display: flex;
    gap: 8px;
}
.chat-header-actions button {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: background 0.2s;
}
.chat-header-actions button:hover {
    background: rgba(255,255,255,0.3);
}

/* ── Mesaja Alanı ───────────────────────────────── */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* ── Mesaj Baloncukları ─────────────────────────── */
.chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: msgSlideIn 0.3s ease forwards;
}
@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.user {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-bottom: 18px;
}
.chat-msg.bot .msg-avatar {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}
.chat-msg.user .msg-avatar {
    background: #e2e8f0;
    color: #64748b;
}

.msg-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.chat-msg.user .msg-content {
    align-items: flex-end;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.55;
    word-break: break-word;
}
.chat-msg.bot .msg-bubble {
    background: white;
    color: #1e293b;
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.chat-msg.user .msg-bubble {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 16px 4px 16px 16px;
}
.chat-msg.user .msg-bubble a { color: rgba(255,255,255,0.9); }

.msg-time {
    font-size: 0.68rem;
    color: #94a3b8;
    padding: 0 2px;
}

/* ── Yazıyor Göstergesi ─────────────────────────── */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typingDot 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
    0%, 80%, 100% { transform: scale(1); opacity: 0.5; }
    40% { transform: scale(1.3); opacity: 1; }
}

/* ── Hızlı Yanıtlar ─────────────────────────────── */
.chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px 8px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.quick-reply {
    padding: 6px 12px;
    border-radius: 99px;
    border: 1.5px solid #c7d2fe;
    background: white;
    color: #6366f1;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}
.quick-reply:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
    transform: translateY(-1px);
}

/* ── Input Alanı ────────────────────────────────── */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: white;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
#chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    background: #f8fafc;
    color: #1e293b;
}
#chat-input:focus {
    border-color: #6366f1;
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
#chat-input::placeholder { color: #94a3b8; }

#chat-send {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
#chat-send:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}
#chat-send:disabled { cursor: not-allowed; }

/* ── Demo live badge ────────────────────────────── */
.demo-live-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #22c55e;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 99px;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 480px) {
    #chat-window {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 84px;
        max-height: 70vh;
        border-radius: 16px;
    }
    #chat-toggle {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 1.2rem;
    }
}
