/* =========================================
   Alanya Ortak Kuruluş AI Chat Widget
   ========================================= */

/* Floating Button */
#ai-chat-btn {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0000ff, #0055ff);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,255,0.4);
    cursor: pointer;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    outline: none;
}
#ai-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0,0,255,0.5);
}
#ai-chat-btn svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}
#ai-chat-btn .ai-notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    background: #ff3b30;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%   { transform: scale(1); opacity: 1; }
    50%  { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Chat Window */
#ai-chat-window {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 360px;
    max-height: 580px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 99999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Roboto', sans-serif;
    animation: slideUp 0.3s ease;
}
#ai-chat-window.open {
    display: flex;
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, #0000ff, #0055ff);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    flex-shrink: 0;
}
.ai-chat-header-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.ai-chat-header-info {
    flex: 1;
    min-width: 0;
}
.ai-chat-header-title {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-chat-header-status {
    font-size: 11px;
    opacity: 0.85;
}
.ai-chat-header-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    flex-shrink: 0;
}
.ai-chat-header-close:hover { opacity: 1; }

/* Messages */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f5f7fb;
    scroll-behavior: smooth;
}
.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: #c5c5c5; border-radius: 4px; }

/* Bubble */
.ai-bubble {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-bubble.bot {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.ai-bubble.user {
    background: linear-gradient(135deg, #0000ff, #0055ff);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Quick Reply Buttons */
.ai-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 6px;
    align-self: flex-start;
    max-width: 100%;
}
.ai-qr-btn {
    background: #fff;
    border: 1.5px solid #0000ff;
    color: #0000ff;
    border-radius: 20px;
    padding: 6px 13px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    font-family: 'Roboto', sans-serif;
}
.ai-qr-btn:hover {
    background: #0000ff;
    color: #fff;
}

/* Typing indicator */
.ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    padding: 10px 14px;
    background: #fff;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.ai-typing span {
    width: 7px;
    height: 7px;
    background: #0000ff;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* Property Card */
.ai-property-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-self: flex-start;
    width: 100%;
    max-width: 300px;
    font-size: 12px;
    animation: fadeIn 0.3s ease;
}
.ai-property-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}
.ai-property-card-body {
    padding: 9px 11px;
}
.ai-property-card-title {
    font-weight: 600;
    font-size: 12px;
    color: #222;
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ai-property-card-price {
    color: #0000ff;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
}
.ai-property-card-code {
    color: #999;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-family: monospace;
}
.ai-property-card-meta {
    color: #777;
    font-size: 11px;
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.ai-property-card-btn {
    display: block;
    text-align: center;
    background: linear-gradient(135deg, #0000ff, #0055ff);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    transition: opacity 0.2s;
}
.ai-property-card-btn:hover { opacity: 0.88; }

/* View All Button */
.ai-view-all-btn {
    display: block;
    text-align: center;
    background: #f0f4ff;
    color: #0000ff !important;
    text-decoration: none !important;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 700;
    border: 1.5px solid #0000ff;
    align-self: flex-start;
    width: 100%;
    max-width: 300px;
    transition: background 0.2s;
    cursor: pointer;
}
.ai-view-all-btn:hover { background: #dde8ff; }

/* Live Chat Button */
.ai-live-chat-btn {
    display: block;
    text-align: center;
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    font-weight: 700;
    align-self: flex-start;
    width: 100%;
    max-width: 300px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Roboto', sans-serif;
    box-shadow: 0 2px 10px rgba(0, 206, 201, 0.3);
    animation: fadeIn 0.3s ease;
}
.ai-live-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 206, 201, 0.4);
}

/* Restart Button */
.ai-restart-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 11px;
    cursor: pointer;
    align-self: center;
    text-decoration: underline;
    padding: 4px 8px;
    font-family: 'Roboto', sans-serif;
}
.ai-restart-btn:hover { color: #0000ff; }

/* Input area */
.ai-chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
}
.ai-chat-input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    font-family: 'Roboto', sans-serif;
    transition: border-color 0.2s;
}
.ai-chat-input:focus { border-color: #0000ff; }
.ai-chat-send-btn {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0000ff, #0055ff);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.ai-chat-send-btn:hover { transform: scale(1.1); }
.ai-chat-send-btn svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* RTL support for Arabic/Persian */
[lang="ar"] #ai-chat-window,
[lang="fa"] #ai-chat-window {
    right: auto;
    left: 20px;
    direction: rtl;
    text-align: right;
}
[lang="ar"] #ai-chat-btn,
[lang="fa"] #ai-chat-btn {
    right: auto;
    left: 20px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #ai-chat-window {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 150px;
        max-height: 70vh;
    }
    #ai-chat-btn {
        bottom: 80px;
        right: 12px;
    }
}
