/* ===== CHAT WIDGET ===== */
#chatWidget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
    font-family: 'Inter', -apple-system, sans-serif;
}

/* Açma butonu */
#chatToggleBtn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FE2C55, #c9002f);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(254,44,85,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
#chatToggleBtn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(254,44,85,0.65);
}
#chatToggleBtn svg {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    min-width: 28px !important;
    fill: white !important;
    flex-shrink: 0;
}

/* Bildirim badge */
#chatBadge {
    position: absolute;
    top: -4px; right: -4px;
    width: 20px; height: 20px;
    background: #FE2C55;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    border: 2px solid #000;
}

/* Panel */
#chatPanel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    max-height: 580px;
    background: #111;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    box-shadow: 0 16px 60px rgba(0,0,0,0.7);
    animation: chatSlideUp 0.25s ease;
    z-index: 99991;
}
@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* Header */
#chatHeader {
    background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
#chatHeaderAvatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #FE2C55;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
#chatHeaderInfo { flex: 1; }
#chatHeaderName { color: #fff; font-size: 15px; font-weight: 700; }
#chatHeaderStatus { color: #25D366; font-size: 12px; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
#chatHeaderStatus::before {
    content: ''; width: 7px; height: 7px;
    background: #25D366; border-radius: 50%;
    animation: chatPulse 2s ease-in-out infinite;
}
@keyframes chatPulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
#chatCloseBtn {
    background: none; border: none; color: #666; cursor: pointer;
    font-size: 20px; padding: 4px; transition: color 0.2s;
}
#chatCloseBtn:hover { color: #fff; }

/* Body */
#chatBody {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 280px;
    max-height: 380px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

/* Mesaj balonları */
.chat-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    animation: msgFadeIn 0.2s ease;
    word-break: break-word;
}
@keyframes msgFadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.chat-msg.user {
    background: linear-gradient(135deg, #FE2C55, #c9002f);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-msg.agent {
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,0.08);
    color: #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.chat-msg.system {
    background: rgba(37,211,102,0.08);
    border: 1px solid rgba(37,211,102,0.15);
    color: #25D366;
    font-size: 12px;
    align-self: center;
    border-radius: 20px;
    padding: 6px 14px;
    text-align: center;
}
.chat-msg-time {
    font-size: 10px;
    opacity: 0.45;
    margin-top: 3px;
    display: block;
}

/* Typing indicator */
#chatTyping {
    display: none;
    align-self: flex-start;
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 10px 14px;
    gap: 5px;
    align-items: center;
}
#chatTyping span {
    width: 7px; height: 7px;
    background: #666;
    border-radius: 50%;
    animation: typingDot 1.2s ease-in-out infinite;
}
#chatTyping span:nth-child(2) { animation-delay: 0.2s; }
#chatTyping span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot { 0%,60%,100% { transform:translateY(0); } 30% { transform:translateY(-5px); background:#FE2C55; } }

/* Footer (input) */
#chatFooter {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    gap: 10px;
    background: #0d0d0d;
}
#chatInput {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 10px 16px;
    color: #fff;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
}
#chatInput:focus { border-color: rgba(254,44,85,0.5); }
#chatInput::placeholder { color: #555; }
#chatSendBtn {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #FE2C55, #c9002f);
    border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: transform 0.15s, opacity 0.2s;
    align-self: flex-end;
}
#chatSendBtn:hover { transform: scale(1.08); }
#chatSendBtn:disabled { opacity: 0.4; cursor: default; transform: none; }
#chatSendBtn svg { width: 18px; height: 18px; fill: white; }

/* FAQ Ekranı */
#chatFaqScreen {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#chatFaqScreen h4 {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.faq-item {
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.faq-item:hover { background: #222; border-color: rgba(254,44,85,0.3); }
.faq-q { color: #fff; font-size: 13px; font-weight: 500; }
.faq-a { color: #888; font-size: 12px; margin-top: 6px; line-height: 1.5; display: none; }
.faq-item.open .faq-a { display: block; }
.faq-item.open { border-color: rgba(254,44,85,0.4); background: #1e1018; }

#connectAgentBtn {
    background: linear-gradient(135deg, #FE2C55, #c9002f);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    transition: opacity 0.2s;
    width: 100%;
}
#connectAgentBtn:hover { opacity: 0.88; }

@media (max-width: 400px) {
    #chatPanel { width: calc(100vw - 24px); right: -12px; }
}
