/* ========================================
   AI CHATBOT WIDGET STYLES
   Renk: #64748B (Slate Gri-Mavi)
   z-index: 1002 (hamburger 1001, WhatsApp 1000 ustunde)
   ======================================== */

/* ----- TRIGGER BUTONU ----- */
.chatbot-trigger {
    position: fixed;
    bottom: 90px;
    right: 25px;
    width: 56px;
    height: 56px;
    background: #64748B;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 1002;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    outline: none;
}

.chatbot-trigger i {
    pointer-events: none;
}

.chatbot-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(100, 116, 139, 0.5);
}

.chatbot-trigger.hidden {
    display: none;
}

/* Pulse animasyon (dikkat cekme) */
.chatbot-trigger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #64748B;
    z-index: -1;
    animation: chatbotPulse 2s infinite;
    opacity: 0;
    pointer-events: none;
}

@keyframes chatbotPulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* ----- SOHBET PANELI ----- */
.chatbot-panel {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 25px;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    flex-direction: column;
    font-family: verdana, sans-serif;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.chatbot-panel.open {
    display: flex;
    animation: chatbotSlideUp 0.3s ease;
}

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

/* ----- HEADER ----- */
.chatbot-header {
    background: #64748B;
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.chatbot-title {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.3px;
}

.chatbot-subtitle {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 1px;
}

.chatbot-header-actions {
    display: flex;
    gap: 6px;
}

.chatbot-header-actions button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-btn-sync {
    background: rgba(16, 185, 129, 0.4) !important;
}
.chatbot-btn-sync:hover {
    background: rgba(16, 185, 129, 0.7) !important;
}

/* ----- MESAJLAR ALANI ----- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

/* Scrollbar stil */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* ----- MESAJ BALONLARI ----- */
.chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 155%;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chatbot-msg.bot {
    background: #ffffff;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

.chatbot-msg.user {
    background: #64748B;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ----- YAZMA GOSTERGESI ----- */
.chatbot-typing {
    align-self: flex-start;
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.chatbot-typing .dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: chatbotBounce 1.4s infinite ease-in-out both;
}

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

@keyframes chatbotBounce {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ----- HIZLI YANITLAR ----- */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 14px 10px;
    background: #f8fafc;
}

.chatbot-quick-reply {
    background: #ffffff;
    border: 1px solid #64748B;
    color: #64748B;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 12px;
    font-family: verdana, sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chatbot-quick-reply:hover {
    background: #64748B;
    color: white;
}

/* ----- GIRIS ALANI ----- */
.chatbot-input-area {
    display: flex;
    padding: 10px 12px;
    gap: 8px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    flex-shrink: 0;
}

.chatbot-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 22px;
    font-size: 13px;
    font-family: verdana, sans-serif;
    outline: none;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s;
}

.chatbot-input-area input:focus {
    border-color: #64748B;
    background: #ffffff;
}

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

.chatbot-send-btn {
    background: #64748B;
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    background: #475569;
}

.chatbot-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* ----- FATURA OZET KUTUSU ----- */
.chatbot-invoice {
    background: #f0f4f8;
    border: 1px solid #64748B;
    border-radius: 10px;
    padding: 12px;
    margin: 6px 0;
    font-size: 12px;
    color: #1e293b;
}

.chatbot-invoice-title {
    font-weight: bold;
    font-size: 13px;
    color: #64748B;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #cbd5e1;
}

.chatbot-invoice table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
}

.chatbot-invoice th {
    background: #64748B;
    color: white;
    padding: 5px 8px;
    text-align: left;
    font-size: 11px;
    font-weight: bold;
}

.chatbot-invoice td {
    padding: 4px 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 11px;
}

.chatbot-invoice tr:last-child td {
    border-bottom: none;
}

.chatbot-invoice-totals {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #cbd5e1;
    font-size: 12px;
}

.chatbot-invoice-totals .total-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.chatbot-invoice-totals .grand-total {
    font-weight: bold;
    font-size: 14px;
    color: #64748B;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 2px solid #64748B;
}

/* ----- PDF INDIRME BUTONU ----- */
.chatbot-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #64748B;
    color: white;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-family: verdana, sans-serif;
    cursor: pointer;
    border: none;
    margin-top: 8px;
    transition: background 0.2s;
}

.chatbot-pdf-btn:hover {
    background: #475569;
}

.chatbot-pdf-btn i {
    font-size: 14px;
}

/* ----- MOBIL RESPONSIVE ----- */
@media all and (max-width: 768px) {
    .chatbot-trigger {
        bottom: 75px;
        right: 15px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .chatbot-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
        max-height: 100dvh;
    }

    .chatbot-messages {
        padding: 10px;
    }

    .chatbot-msg {
        max-width: 90%;
        font-size: 14px;
    }

    .chatbot-quick-reply {
        font-size: 13px;
        padding: 8px 14px;
    }

    .chatbot-input-area input {
        font-size: 16px; /* iOS zoom engellemek icin */
    }
}

/* ============================================================
   AUTH BAR — Login / Sign Up / Logged-in State
   ============================================================ */
.chatbot-auth-bar {
    border-top: 1px solid rgba(100, 116, 139, 0.2);
    padding: 6px 12px;
    background: #f8fafc;
    flex-shrink: 0;
}

.chatbot-auth-guest,
.chatbot-auth-member {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-auth-guest button,
.chatbot-auth-member button {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.chatbot-auth-login {
    background: #1e40af !important;
    border-color: #1e40af !important;
    color: #fff !important;
    font-weight: 600;
}

.chatbot-auth-login:hover {
    background: #1d3a9e !important;
}

.chatbot-auth-signup:hover {
    background: #e2e8f0 !important;
}

.chatbot-auth-sep {
    color: #94a3b8;
    font-size: 13px;
}

/* Logged-in state */
.chatbot-auth-name {
    flex: 1;
    font-size: 12px;
    color: #1e40af;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-auth-logout {
    font-size: 11px !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
}

.chatbot-auth-logout:hover {
    color: #ef4444 !important;
    border-color: #ef4444 !important;
}

/* ============================================================
   LOGIN OVERLAY — Mesajların üzerinde yüzen form
   ============================================================ */
.chatbot-login-overlay {
    position: absolute;
    inset: 52px 0 0 0; /* header yüksekliği kadar aşağıdan başla */
    background: rgba(248, 250, 252, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 0 0 16px 16px;
    backdrop-filter: blur(4px);
}

.chatbot-login-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px 22px 20px;
    width: calc(100% - 40px);
    max-width: 320px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.chatbot-login-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.chatbot-login-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 16px;
}

.chatbot-login-username,
.chatbot-login-password {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    margin-bottom: 10px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.chatbot-login-username:focus,
.chatbot-login-password:focus {
    border-color: #1e40af;
    background: #fff;
}

.chatbot-login-error {
    font-size: 12px;
    color: #ef4444;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 10px;
}

.chatbot-login-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.chatbot-login-cancel {
    flex: 1;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s;
}

.chatbot-login-cancel:hover {
    background: #e2e8f0;
}

.chatbot-login-submit {
    flex: 2;
    background: #1e40af;
    border: none;
    border-radius: 8px;
    padding: 9px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

.chatbot-login-submit:hover {
    background: #1d3a9e;
}

.chatbot-login-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

/* İndirim satırı faturada */
.discount-row span {
    color: #16a34a;
    font-weight: 600;
}

.discount-value {
    color: #16a34a !important;
}
