/* Outfit Font imported efficiently via preconnect links in head */

#atlas-ai-chat-window {
    position: fixed;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    z-index: 9999999;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom right;
}

/* --- MULTI-RESPONSIVE --- */

/* MASAÜSTÜ */
@media (min-width: 992px) {
    #atlas-ai-chat-window {
        width: 420px;
        height: 650px;
        bottom: 90px;
        right: 30px;
        border-radius: 28px;
    }
}

/* TABLET */
@media (min-width: 481px) and (max-width: 991px) {
    #atlas-ai-chat-window {
        width: 380px;
        height: 70vh;
        bottom: 100px;
        right: 25px;
        border-radius: 24px;
    }
}

/* MOBİL */
@media (max-width: 480px) {
    #atlas-ai-chat-window {
        width: 100% !important;
        height: 100% !important;
        bottom: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
        max-height: 100% !important;
    }
}

#atlas-ai-chat-window.hidden {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    pointer-events: none;
}

.atlas-ai-header {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.atlas-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.atlas-avatar-wrapper {
    position: relative;
    width: 45px;
    height: 45px;
}

.atlas-header-avatar {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    padding: 2px;
    border: 1px solid rgba(255,255,255,0.1);
    object-fit: cover;
}

.atlas-status-pulse {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #1e293b;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.atlas-header-text h3 { 
    margin: 0; 
    font-size: 17px; 
    font-weight: 600; 
    background: linear-gradient(90deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.atlas-status-text {
    font-size: 11px;
    opacity: 0.8;
    color: #10b981;
    font-weight: 600;
}

#atlas-ai-close-chat {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.3s ease;
}

#atlas-ai-close-chat:hover {
    color: white;
    transform: rotate(90deg);
}

#atlas-ai-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.atlas-ai-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    animation: slideUp 0.3s ease;
    position: relative;
}

.user-message {
    background: linear-gradient(135deg, var(--atlas-primary, #3b82f6), var(--atlas-primary-dark, #2563eb));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.ai-message {
    background: #ffffff;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.msg-time {
    font-size: 10px;
    opacity: 0.5;
    display: block;
    margin-top: 4px;
}

.atlas-ai-input-wrapper {
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0,0,0,0.05);
}

.atlas-ai-input-container {
    background: #f1f5f9;
    border-radius: 16px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.atlas-ai-input-container:focus-within {
    background: white;
    border-color: var(--atlas-primary, #3b82f6);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

#atlas-ai-input {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 5px;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    color: #1e293b;
}

#atlas-ai-mic-btn, #atlas-ai-send-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #64748b;
}

#atlas-ai-mic-btn:hover { background: #e2e8f0; color: #1e293b; }
#atlas-ai-mic-btn.mic-active {
    background: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

#atlas-ai-send-btn {
    background: #1e293b;
    color: white;
}

#atlas-ai-send-btn:hover {
    background: #0f172a;
    transform: scale(1.05);
}

#atlas-ai-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border-radius: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 36px rgba(0,0,0,0.25);
    z-index: 9999999;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#atlas-ai-launcher:hover { transform: scale(1.1) rotate(5deg); }

.atlas-launcher-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* --- ELITE SALES COMPONENTS --- */

.atlas-product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    animation: slideUp 0.4s ease;
    max-width: 280px;
}

.atlas-product-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.atlas-product-card .product-info {
    padding: 12px;
}

.atlas-product-card h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    color: #1e293b;
    font-weight: 600;
}

.atlas-product-card .price {
    display: block;
    font-size: 16px;
    color: #2563eb;
    font-weight: 700;
    margin-bottom: 12px;
}

.product-actions {
    display: flex;
    gap: 8px;
}

.add-to-cart-btn {
    flex: 2;
    background: #1e293b;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-to-cart-btn:hover { background: #0f172a; }
.add-to-cart-btn.success { background: #10b981; }

.view-btn {
    flex: 1;
    background: #f1f5f9;
    color: #64748b;
    text-decoration: none;
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    transition: all 0.2s ease;
}

.view-btn:hover { background: #e2e8f0; color: #1e293b; }

.atlas-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #25d366;
    color: white;
    border: none;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.atlas-whatsapp-btn svg { fill: white; }

/* --- PROACTIVE WELCOME BUBBLE --- */
#atlas-ai-welcome-bubble {
    position: fixed;
    bottom: 105px;
    right: 25px;
    max-width: 320px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: white;
    padding: 16px 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 9999999;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

#atlas-ai-welcome-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 24px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #0f172a transparent;
    display: block;
    width: 0;
}

#atlas-ai-welcome-bubble.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}

.atlas-welcome-close {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.atlas-welcome-close:hover {
    opacity: 1;
}

/* --- PREMIUM AI PROPOSAL CARD --- */
.atlas-proposal-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(245, 158, 11, 0.2); /* Gold border trace */
    border-radius: 16px;
    padding: 16px;
    margin: 12px 0;
    font-family: 'Outfit', sans-serif;
    color: #f8fafc;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    animation: fadeInScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.atlas-proposal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f59e0b, #d97706); /* Gold top highlight */
}

.proposal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    border: 1px solid rgba(245, 158, 11, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-pulse {
    width: 6px;
    height: 6px;
    background: #f59e0b;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    animation: goldPulse 1.6s infinite;
}

.atlas-proposal-card h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
}

.proposal-metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.proposal-metrics .metric {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.proposal-metrics .metric-icon {
    font-size: 16px;
}

.proposal-metrics .metric-text {
    display: flex;
    flex-direction: column;
}

.proposal-metrics .metric-text .label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
}

.proposal-metrics .metric-text .value {
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
}

.proposal-desc {
    font-size: 13px;
    line-height: 1.4;
    color: #cbd5e1;
    margin: 0 0 14px 0;
}

.proposal-cta-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    border: none;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
    display: block;
    text-align: center;
}

.proposal-cta-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

.proposal-cta-btn:active:not(:disabled) {
    transform: translateY(0);
}

.proposal-cta-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    cursor: default;
    box-shadow: none;
}

@keyframes goldPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ─── MARKDOWN RENDERER ──────────────────────────────────────────────────── */

.atlas-md-para {
    display: block;
    line-height: 1.6;
    margin-bottom: 4px;
}

.atlas-md-spacer {
    height: 6px;
}

/* Bölüm başlığı (### veya ##) */
.atlas-md-heading {
    font-size: 13px;
    font-weight: 700;
    color: var(--atlas-primary, #3b82f6);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 8px 0 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin: 6px 0 4px 0;
    display: block;
}

/* Liste konteyneri */
.atlas-md-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 4px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Her liste satırı */
.atlas-md-li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: slideUp 0.25s ease both;
}

/* Numaralı liste rozeti — mavi degrade */
.atlas-md-num {
    min-width: 22px;
    height: 22px;
    background: linear-gradient(135deg, var(--atlas-primary, #3b82f6), var(--atlas-primary-dark, #2563eb));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Madde işareti noktası — yeşil parlaklık */
.atlas-md-dot {
    min-width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
    flex-shrink: 0;
    margin-top: 6px;
}

/* Liste metni */
.atlas-md-text {
    font-size: 14px;
    color: #1e293b;
    line-height: 1.55;
    flex: 1;
}

/* Bold ve italic */
.ai-message strong {
    color: #1e3a5f;
    font-weight: 700;
}

.ai-message em {
    color: #475569;
    font-style: italic;
}

/* --- TYPING ANIMATION (LOADING INDICATOR) --- */
.atlas-ai-message.loading-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 15px 18px !important;
    min-height: 44px;
    background: #f0f2f5;
    border-radius: 18px 18px 18px 4px;
}

.atlas-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #8c9aaf;
    border-radius: 50%;
    animation: atlasTypingBounce 1.4s infinite ease-in-out both;
}

.atlas-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.atlas-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes atlasTypingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- HEYGEN LIVE AVATAR WEBRTC MODULE --- */
.atlas-avatar-wrapper video#atlas-ai-avatar-video {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    background: #000;
}

/* Mod 1 (Avatar Modu) Aktifse Arayüzü Özelleştir */
.atlas-ai-chat-window.avatar-mode-active .atlas-avatar-wrapper {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    border: 3px solid var(--atlas-primary, #3b82f6) !important;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
    overflow: hidden !important;
}

.atlas-ai-chat-window.avatar-mode-active .atlas-header-avatar {
    border-radius: 50% !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    padding: 0 !important;
    border: none !important;
}

.atlas-ai-chat-window.avatar-mode-active .atlas-avatar-wrapper video#atlas-ai-avatar-video {
    border-radius: 50% !important;
}

.atlas-ai-chat-window.avatar-mode-active .atlas-status-pulse {
    bottom: 2px !important;
    right: 2px !important;
    border-color: #1e293b !important;
}

/* Yükleniyor / Spinner Efekti */
.atlas-avatar-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.05);
    border-top: 3px solid var(--atlas-primary, #3b82f6);
    animation: atlas-spin 1s linear infinite;
    display: none;
    pointer-events: none;
    box-sizing: border-box;
}

.atlas-avatar-wrapper.loading .atlas-avatar-spinner {
    display: block;
}

@keyframes atlas-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}