/**
 * Güvenim — AI Chat Widget Stylesheet
 */
:root {
    --chat-primary: #3b82f6;
    --chat-primary-hover: #1d4ed8;
    --chat-bg: rgba(255, 255, 255, 0.96);
    --chat-border: rgba(226, 232, 240, 0.85);
    --chat-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.25), 0 8px 24px -4px rgba(15, 23, 42, 0.15);
    --chat-radius: 24px;
    --chat-text-dark: #0f172a;
    --chat-text-muted: #64748b;
}

/* Floating Launcher Button */
.ai-chat-launcher:not(.fsm-option-item) {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

.ai-chat-launcher:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.5);
}

.ai-chat-launcher i {
    color: #fff;
    width: 28px;
    height: 28px;
    transition: transform 0.3s;
}

.ai-chat-launcher.active i {
    transform: rotate(90deg);
}

/* Chat Widget Container */
.ai-chat-widget {
    position: fixed;
    bottom: 130px; /* Bir tık yukarıda konumlandırma uyumu */
    right: 30px;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 160px);
    background: var(--chat-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.ai-chat-widget.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

body.sitebot-chat-open .floating-support-menu {
    opacity: 0;
    pointer-events: none;
}

/* Chat Header */
.ai-chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-chat-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

.ai-chat-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.ai-chat-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-chat-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.ai-chat-close {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.ai-chat-close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    background-color: #f8fafc;
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 16px 16px;
}

/* Message Bubble */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant:has(.sitebot-actions),
.chat-message.assistant:has(.sitebot-results),
.chat-message.assistant:has(.sitebot-custom-card),
.chat-message.assistant:has(.sitebot-lead-form) {
    max-width: 100%;
    width: 100%;
    flex-direction: column;
    gap: 9px;
}

.sitebot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.sitebot-action {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 11px;
    border: 1px solid #cfe2ed;
    border-radius: 999px;
    background: #fff;
    color: #12304a;
    font: 700 11.5px/1.2 inherit;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .045);
    transition: .2s ease;
}

.sitebot-action:hover {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(120deg, #0aa783, #2582ed);
    transform: translateY(-1px);
}

.sitebot-action svg { width: 14px; height: 14px; }

.sitebot-results {
    display: grid;
    gap: 8px;
    width: 100%;
}

.sitebot-result-card {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e0e9ee;
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    color: #10243a;
    text-decoration: none;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .055);
    transition: .22s ease;
}

.sitebot-result-card:hover { border-color: #7dd3c7; transform: translateY(-2px); }
.sitebot-result-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #078e76; background: #eafbf6; }
.sitebot-result-icon svg { width: 18px; height: 18px; }
.sitebot-result-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sitebot-result-copy strong { font-size: 12.5px; line-height: 1.28; }
.sitebot-result-copy small { color: #64748b; font-size: 10.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sitebot-result-copy em { color: #078e76; font-size: 9.5px; font-style: normal; font-weight: 750; }
.sitebot-result-arrow { width: 15px; color: #94a3b8; }

.sitebot-custom-card{width:100%;overflow:hidden;border:1px solid #dbe7ef;border-radius:17px;background:#fff;box-shadow:0 10px 25px rgba(15,23,42,.09)}
.sitebot-custom-card img{display:block;width:100%;max-height:145px;object-fit:cover}
.sitebot-custom-card-copy{padding:15px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.sitebot-custom-card-copy>span{padding:5px 8px;border-radius:999px;background:rgba(14,165,233,.12);color:#0369a1;font-size:9px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}
.sitebot-custom-card-copy>strong{font-size:16px;line-height:1.25;color:#0f172a}.sitebot-custom-card-copy p{margin:0;color:#64748b;font-size:11.5px;line-height:1.5}
.sitebot-custom-card.theme-gradient{border:0;background:linear-gradient(135deg,#ecfdf5,#eff6ff)}
.sitebot-custom-card.theme-dark{border-color:#24324a;background:linear-gradient(135deg,#071426,#172554)}
.sitebot-custom-card.theme-dark .sitebot-custom-card-copy>strong{color:#fff}.sitebot-custom-card.theme-dark .sitebot-custom-card-copy p{color:#bfcee0}.sitebot-custom-card.theme-dark .sitebot-custom-card-copy>span{color:#67e8f9;background:rgba(6,182,212,.15)}
.sitebot-custom-card.theme-success{border-color:#a7f3d0;background:linear-gradient(135deg,#ecfdf5,#f0fdfa)}

.sitebot-lead-form{width:100%;padding:14px;box-sizing:border-box;border:1px solid #dce7ee;border-radius:17px;background:#fff;box-shadow:0 9px 24px rgba(15,23,42,.075)}
.sitebot-lead-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.sitebot-lead-head>span{width:34px;height:34px;display:grid;place-items:center;flex:0 0 auto;border-radius:10px;color:#fff;background:linear-gradient(135deg,#0aa783,#2582ed)}.sitebot-lead-head svg{width:16px}.sitebot-lead-head div{min-width:0;display:flex;flex-direction:column;gap:2px}.sitebot-lead-head strong{font-size:13px;color:#0f172a}.sitebot-lead-head small{color:#64748b;font-size:10px;line-height:1.35}
.sitebot-lead-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.sitebot-lead-fields label{min-width:0;display:flex;flex-direction:column;gap:4px}.sitebot-lead-fields label.wide{grid-column:1/-1}.sitebot-lead-fields label>span{font-size:9.5px;font-weight:800;color:#475569}.sitebot-lead-fields input,.sitebot-lead-fields textarea{width:100%;min-width:0;box-sizing:border-box;padding:9px 10px;border:1px solid #dbe4ec;border-radius:10px;background:#f8fafc;color:#0f172a;font:500 11px/1.4 inherit;outline:none;resize:vertical}.sitebot-lead-fields input:focus,.sitebot-lead-fields textarea:focus{border-color:#0ea5e9;box-shadow:0 0 0 3px rgba(14,165,233,.1);background:#fff}.sitebot-hp{position:absolute!important;left:-10000px!important;width:1px!important;height:1px!important}
.sitebot-lead-submit{width:100%;min-height:39px;margin-top:10px;display:flex;align-items:center;justify-content:center;gap:7px;border:0;border-radius:11px;color:#fff;background:linear-gradient(120deg,#0aa783,#2582ed);font:800 11.5px/1 inherit;cursor:pointer;box-shadow:0 7px 18px rgba(37,130,237,.18)}.sitebot-lead-submit svg{width:14px}.sitebot-lead-submit:disabled{opacity:.7;cursor:wait}.sitebot-lead-status{min-height:0;margin-top:7px;color:#64748b;font-size:10px;line-height:1.4}.sitebot-lead-status.success{padding:8px;border-radius:9px;color:#047857;background:#ecfdf5}.sitebot-lead-status.error{padding:8px;border-radius:9px;color:#b91c1c;background:#fef2f2}

@media(max-width:480px){.sitebot-lead-fields{grid-template-columns:minmax(0,1fr)}.sitebot-lead-fields label.wide{grid-column:auto}}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-message.assistant .chat-bubble {
    background: #ffffff;
    color: var(--chat-text-dark);
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.02);
    border: 1px solid rgba(226, 232, 240, 0.6);
    max-width: 100%;
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.15);
}

/* Text formatting inside bubble */
.chat-bubble p {
    margin: 0 0 8px;
}
.chat-bubble p:last-child {
    margin-bottom: 0;
}
.chat-bubble strong {
    font-weight: 700;
}
.chat-bubble ul, .chat-bubble ol {
    margin: 6px 0;
    padding-left: 20px;
}

/* Suggested Links / Buttons inside Chat */
.ai-recommendation-card {
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--chat-text-dark);
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.ai-recommendation-card:hover {
    background: #f8fafc;
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.05);
}

.ai-recommendation-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.ai-recommendation-info {
    flex: 1;
}

.ai-recommendation-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.ai-recommendation-desc {
    font-size: 11px;
    color: var(--chat-text-muted);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

/* Chat Input Footer */
.ai-chat-footer {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-chat-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
}

.ai-chat-input {
    width: 100%;
    padding: 12px 18px;
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
    transition: all 0.3s;
    background: #f8fafc;
}

.ai-chat-input:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.ai-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
    flex-shrink: 0;
}

.ai-chat-send:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    transform: scale(1.05);
}

.ai-chat-send i {
    width: 18px;
    height: 18px;
}

/* Scrollbar Style */
.ai-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Responsive adjustment */
@media (max-width: 480px) {
    .ai-chat-widget {
        right: 15px;
        bottom: calc(112px + env(safe-area-inset-bottom));
        width: calc(100% - 30px);
        height: min(520px, calc(100dvh - 150px));
    }
    .ai-chat-launcher {
        right: 15px;
        bottom: 20px;
    }
    .ai-chat-messages { padding: 14px; gap: 13px; }
    .sitebot-actions { gap: 6px; }
    .sitebot-action { min-height: 34px; padding: 7px 10px; font-size: 11px; }
}

/* =======================================================================
   AI BUNDLE GALLERY & CART ACTIONS
   ======================================================================= */
.ai-product-gallery {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 8px;
    margin: 8px 0;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--chat-primary) rgba(0,0,0,0.05);
}

.ai-product-gallery::-webkit-scrollbar {
    height: 6px;
}
.ai-product-gallery::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
}
.ai-product-gallery::-webkit-scrollbar-thumb {
    background: var(--chat-primary);
    border-radius: 10px;
}

.ai-product-gallery .ai-product-card-container {
    flex: 0 0 240px; /* Her kart sabit 240px genişliğinde olsun */
    scroll-snap-align: start;
}

.ai-product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ai-product-info {
    flex: 1; /* Alt kısmın uzamasını sağla */
    display: flex;
    flex-direction: column;
}

.ai-product-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Adet Seçici */
.ai-qty-selector {
    display: flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    height: 36px;
}
.ai-qty-btn {
    width: 36px;
    height: 100%;
    background: #f8fafc;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}
.ai-qty-btn:hover {
    background: #e2e8f0;
}
.ai-qty-input {
    flex: 1;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    -moz-appearance: textfield;
}
.ai-qty-input::-webkit-outer-spin-button,
.ai-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Aksiyon Butonları */
.ai-product-buttons {
    display: flex;
    gap: 8px;
}
.btn-ai-view {
    flex: 1;
    background: #f1f5f9;
    color: #334155;
    border: none;
    border-radius: 8px;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}
.btn-ai-view:hover {
    background: #e2e8f0;
}
.btn-ai-cart {
    flex: 2;
    background: var(--chat-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}
.btn-ai-cart:hover {
    background: #4338ca;
}
.btn-ai-cart i {
    width: 14px;
    height: 14px;
}
.btn-ai-view i {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   AI Product Cards (Chat İçin Ürün Listeleme)
   ========================================================================== */

.ai-product-card-container {
    margin: 8px 8px 8px 0;
    width: 220px;
    display: inline-block;
    vertical-align: top;
}

.ai-product-card {
    background: #ffffff;
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--chat-text-dark);
}

.ai-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.ai-product-img-wrapper {
    position: relative;
    width: 100%;
    height: 160px;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ai-product-card:hover .ai-product-img {
    transform: scale(1.05);
}

.ai-product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-product-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--chat-text-dark);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-product-price-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-product-old-price {
    font-size: 12px;
    color: var(--chat-text-muted);
    text-decoration: line-through;
}

.ai-product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--chat-primary);
}

.ai-product-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    background: #f1f5f9;
    color: var(--chat-primary);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ai-product-btn i {
    width: 14px;
    height: 14px;
}

.ai-product-card:hover .ai-product-btn {
    background: var(--chat-primary);
    color: #ffffff;
}

.ai-product-card-error {
    background: #fef2f2;
    color: #ef4444;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px dashed #fca5a5;
    text-align: center;
}

/* Skeleton Yükleme Animasyonu */
.ai-product-skeleton {
    background: #ffffff;
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    overflow: hidden;
    padding-bottom: 12px;
}

.ai-skeleton-img {
    width: 100%;
    height: 160px;
    background: #e2e8f0;
    animation: pulse 1.5s infinite ease-in-out;
}

.ai-skeleton-text {
    height: 16px;
    background: #e2e8f0;
    margin: 12px 12px 0;
    border-radius: 4px;
    width: 80%;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { opacity: 0.6; }
}
