/* ==========================================================================
   DUYEM AKILLI ASİSTAN & SİTE UX İYİLEŞTİRMELERİ
   Modern karanlık cam (glassmorphism) sohbet arayüzü, hızlı yanıt çipleri,
   yazıyor animasyonu, arıza kayıt kartı ve broşür lightbox iyileştirmeleri.
   ========================================================================== */

/* AI Chatbox Modern Upgrade (overrides basic styles cleanly) */
.ai-chatbox.duyem-ai-v2 {
    width: 375px;
    max-width: calc(100vw - 2rem);
    height: 530px;
    max-height: calc(100vh - 10rem);
    bottom: 6.75rem;
    right: 2rem;
    padding: 0 !important;
    background: rgba(9, 14, 26, 0.96);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(59, 130, 246, 0.42);
    border-radius: 22px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.78), 0 0 32px rgba(59, 130, 246, 0.2);
    overflow: hidden;
    z-index: 10050;
}

.ai-chatbox.duyem-ai-v2:hover {
    transform: translateY(0);
}

.ai-chatbox.duyem-ai-v2.open {
    transform: translateY(0) scale(1);
}

.ai-chatbox.duyem-ai-v2 .ai-chat-header {
    padding: 0.95rem 1.1rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.22), rgba(168, 85, 247, 0.14));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.duyem-ai-header-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.duyem-ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #050b14;
    border: 1px solid rgba(59, 130, 246, 0.55);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    flex-shrink: 0;
}

.duyem-ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 9px;
}

.duyem-ai-name {
    font-weight: 700;
    font-size: 0.96rem;
    color: #f8fafc;
    line-height: 1.2;
}

.duyem-ai-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    color: #93c5fd;
    margin-top: 2px;
}

.duyem-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.duyem-ai-hdr-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.duyem-ai-hdr-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    color: #fff;
    border-color: rgba(59, 130, 246, 0.5);
}

/* Chat body */
.ai-chatbox.duyem-ai-v2 .ai-chat-body {
    padding: 1rem;
    gap: 0.8rem;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.07), transparent 55%);
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.4) transparent;
}

.ai-chatbox.duyem-ai-v2 .ai-chat-body::-webkit-scrollbar {
    width: 5px;
}

.ai-chatbox.duyem-ai-v2 .ai-chat-body::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 999px;
}

/* Message Bubbles */
.ai-chatbox.duyem-ai-v2 .ai-message {
    max-width: 88%;
    padding: 0.78rem 0.98rem;
    border-radius: 16px;
    font-size: 0.89rem;
    line-height: 1.52;
    animation: duyemMsgIn 0.25s ease;
}

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

.ai-chatbox.duyem-ai-v2 .ai-message.bot {
    background: rgba(30, 41, 59, 0.88);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-bottom-left-radius: 4px;
}

.ai-chatbox.duyem-ai-v2 .ai-message.bot strong {
    color: #ffffff;
}

.ai-chatbox.duyem-ai-v2 .ai-message.user {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #ffffff;
    font-weight: 500;
    border-bottom-right-radius: 4px;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32);
}

.ai-chatbox.duyem-ai-v2 .ai-message p {
    margin: 0;
}

/* Emergency Alert Box inside Chat */
.duyem-chat-alert {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.42);
    color: #fecaca;
    font-size: 0.83rem;
}

/* Service Record Confirmation Card inside Chat */
.duyem-chat-ticket {
    margin-top: 0.6rem;
    padding: 0.85rem;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #e2e8f0;
    font-size: 0.83rem;
}

.duyem-chat-ticket-code {
    display: inline-block;
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
    padding: 0.22rem 0.65rem;
    border-radius: 8px;
    margin: 0.25rem 0 0.5rem 0;
}

.duyem-chat-ticket-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.22rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.duyem-chat-ticket-row:last-child {
    border-bottom: none;
}

.duyem-chat-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.duyem-chat-cta-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.75rem;
    border-radius: 9px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.2s;
}

.duyem-chat-cta-link.wa {
    background: #10b981;
    color: #fff;
}

.duyem-chat-cta-link.call {
    background: rgba(59, 130, 246, 0.22);
    border: 1px solid rgba(59, 130, 246, 0.45);
    color: #93c5fd;
}

.duyem-chat-cta-link:hover {
    opacity: 0.9;
}

/* Feedback micro-bar (👍 / 👎) */
.duyem-msg-feedback {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.45rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.73rem;
    color: #94a3b8;
}

.duyem-fb-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    border-radius: 6px;
    padding: 0.14rem 0.42rem;
    font-size: 0.74rem;
    cursor: pointer;
    transition: all 0.2s;
}

.duyem-fb-btn:hover {
    color: #fff;
    border-color: rgba(59, 130, 246, 0.5);
}

.duyem-fb-btn.up.selected {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #34d399;
}

.duyem-fb-btn.down.selected {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fbbf24;
}

/* Quick Reply Chips Bar */
.duyem-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    padding: 0.55rem 0.85rem;
    background: rgba(15, 23, 42, 0.92);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    max-height: 82px;
    overflow-y: auto;
}

.duyem-qr-chip {
    padding: 0.36rem 0.72rem;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.38);
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
    font-family: var(--font-main);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.duyem-qr-chip:hover {
    background: #2563eb;
    border-color: #3b82f6;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Typing Dots Indicator */
.duyem-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.7rem 1rem !important;
}

.duyem-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #60a5fa;
    animation: duyemTypingBounce 1.2s infinite ease-in-out;
}

.duyem-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.duyem-typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes duyemTypingBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.45; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* Chat Input Footer */
.ai-chatbox.duyem-ai-v2 .ai-chat-footer {
    padding: 0.75rem 0.85rem;
    background: rgba(2, 6, 23, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    align-items: center;
}

.ai-chatbox.duyem-ai-v2 .ai-chat-footer input {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font-family: var(--font-main);
    font-size: 0.88rem;
}

.ai-chatbox.duyem-ai-v2 .ai-chat-footer input::placeholder {
    color: #94a3b8;
}

.ai-chatbox.duyem-ai-v2 .ai-chat-footer input:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.ai-chatbox.duyem-ai-v2 .ai-chat-footer button {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    transition: transform 0.2s ease;
}

.ai-chatbox.duyem-ai-v2 .ai-chat-footer button:hover {
    transform: scale(1.06);
}

/* Gentle Proactive Bot Nudge Tooltip */
.duyem-bot-nudge {
    position: fixed;
    right: 6.5rem;
    bottom: 7.05rem;
    z-index: 1001;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(59, 130, 246, 0.55);
    color: #f8fafc;
    padding: 0.68rem 0.95rem;
    border-radius: 14px;
    border-bottom-right-radius: 4px;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 18px rgba(59, 130, 246, 0.22);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 265px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.duyem-bot-nudge::after {
    content: "";
    position: absolute;
    right: -7px;
    bottom: 14px;
    width: 12px;
    height: 12px;
    background: rgba(15, 23, 42, 0.96);
    border-right: 1px solid rgba(59, 130, 246, 0.55);
    border-bottom: 1px solid rgba(59, 130, 246, 0.55);
    transform: rotate(-45deg);
}

.duyem-bot-nudge.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.duyem-bot-nudge-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
    flex-shrink: 0;
}

.duyem-bot-nudge-close:hover {
    color: #fff;
}

/* Subtle Scroll-To-Top Button (Bottom-Left, zero clash with right floating buttons) */
.duyem-scroll-top {
    position: fixed;
    left: 1.75rem;
    bottom: 2rem;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(59, 130, 246, 0.4);
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    color: #93c5fd;
    font-size: 1rem;
    cursor: pointer;
    z-index: 990;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: all 0.3s ease;
}

.duyem-scroll-top.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.duyem-scroll-top:hover {
    background: var(--neon-blue);
    color: #fff;
    transform: translateY(-3px);
}

/* Contact form inline confirmation banner */
.duyem-contact-feedback {
    display: none;
    margin-top: 1rem;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #a7f3d0;
    font-size: 0.92rem;
    text-align: center;
}

@media (max-width: 768px) {
    .ai-chatbox.duyem-ai-v2 {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 5.5rem;
        width: auto;
        height: 70vh;
        max-height: 520px;
    }
    .duyem-bot-nudge {
        display: none;
    }
    .duyem-scroll-top {
        left: 1rem;
        bottom: 1rem;
        width: 42px;
        height: 42px;
    }
}
