* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    direction: rtl;
    overflow: auto;
    min-height: 100vh;
    width: 100vw;
}

/* Background with blurred blue sky */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #87CEEB 0%, #4A90E2 50%, #87CEEB 100%);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.4) 0%, transparent 60%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    filter: blur(25px);
    z-index: -1;
    transform: scale(1.15);
    opacity: 0.9;
}

/* Backdrop Overlay - Hidden permanently, no overlay when chatbot is open */
.chat-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    backdrop-filter: none;
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    display: none;
    transition: none;
}

.chat-backdrop.chatbot-visible {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.chat-backdrop.chatbot-hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

/* Floating Chat Toggle Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(74, 144, 226, 0.5);
}

.chat-toggle-btn:active {
    transform: scale(0.95);
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    stroke: white;
    transition: all 0.3s ease;
}

.chat-toggle-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    padding: 4px;
    transition: all 0.3s ease;
}

.chat-toggle-btn.active {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
}

.chat-toggle-btn.hidden {
    display: none !important;
}

/* Chatbot Window - Floating Widget */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    backdrop-filter: none;
    display: flex;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.chatbot-window.chatbot-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.chatbot-window.chatbot-hidden {
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }
    
    .chatbot-window.chatbot-visible {
        transform: translateY(0);
    }
    
    .chatbot-window.chatbot-hidden {
        transform: translateY(100%);
    }
    
    .chat-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .chat-toggle-btn.hidden {
        display: none !important;
    }
    
    .chat-toggle-btn svg {
        width: 26px;
        height: 26px;
    }
}

/* Chatbot Header */
.chatbot-header {
    background: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 64px;
    direction: rtl;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.header-share-btn {
    background: transparent;
    border: none;
    color: #333;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.header-share-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.header-share-btn:active {
    transform: scale(0.95);
}

.header-share-btn svg {
    width: 20px;
    height: 20px;
    stroke: #666;
    fill: none;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-direction: row-reverse;
}

.header-title-text {
    color: #1a1a1a;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-bot-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    background: linear-gradient(135deg, #9b59b6 0%, #e67e22 50%, #3498db 100%);
    padding: 2px;
}

.header-placeholder {
    width: 32px;
    height: 32px;
}

.header-close-btn {
    background: transparent;
    border: none;
    color: #333;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.header-close-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.header-close-btn:active {
    transform: scale(0.95);
}

.header-close-btn svg {
    width: 20px;
    height: 20px;
    stroke: #666;
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    max-height: 100%;
    box-sizing: border-box;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.message {
    display: flex;
    animation: fadeIn 0.3s ease;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

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

.user-message {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.bot-message {
    justify-content: flex-start;
}

.bot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-avatar svg {
    width: 100%;
    height: 100%;
    fill: #333;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
    font-size: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    hyphens: auto;
}

.user-message .message-content {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.bot-message .message-content {
    background: #ffffff;
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
    font-size: 15px;
    overflow: hidden;
    hyphens: auto;
}

.bot-message .message-content emoji {
    font-size: 16px;
    margin-left: 3px;
    margin-right: 3px;
}

.bot-message.has-property-cards {
    flex-direction: column;
    align-items: stretch;
}

.message-content.has-property-cards {
    max-width: 100%;
    padding: 12px 0;
    overflow: visible;
}

.message-content.has-property-cards > *:not(.property-cards-container) {
    padding: 0 16px;
}

.message-content.has-property-cards .property-cards-container {
    margin: 0;
    padding: 12px 16px;
    width: 100%;
}

/* Chatbot Input */
.chatbot-input-container {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    border-radius: 0 0 24px 24px;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.input-wrapper {
    width: 100%;
    max-width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    box-sizing: border-box;
    overflow: hidden;
}

.input-wrapper:focus-within {
    background: #ffffff;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.chatbot-input {
    flex: 1;
    padding: 12px 50px 12px 16px;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
    direction: rtl;
    text-align: right;
    font-family: inherit;
    background: transparent;
    color: #333;
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-input::placeholder {
    color: #999;
    text-align: right;
}

.chatbot-input:focus {
    background: white;
    outline: none;
}

.input-icons {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    pointer-events: none;
    padding: 0 8px;
    direction: rtl;
}

.input-icons button {
    pointer-events: all;
}

.chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.chatbot-send svg {
    width: 18px;
    height: 18px;
    stroke: white;
    fill: none;
}

.chatbot-send:hover {
    background: linear-gradient(135deg, #357ABD 0%, #4A90E2 100%);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
    transform: translateY(-1px);
}

.chatbot-send:active {
    transform: translateY(0) scale(0.95);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading indicator */
.typing-indicator {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.typing-indicator-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border: 1px solid rgba(74, 144, 226, 0.15);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
    min-width: 90px;
    position: relative;
    overflow: hidden;
}

.typing-indicator-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 144, 226, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.typing-indicator-content .loading-gif {
    width: 40px;
    height: 40px;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

/* Property Cards Container - Horizontal Carousel */
.property-cards-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin: 8px 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #4ECDC4 transparent;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.property-cards-container::-webkit-scrollbar {
    height: 4px;
}

.property-cards-container::-webkit-scrollbar-track {
    background: transparent;
}

.property-cards-container::-webkit-scrollbar-thumb {
    background: #4ECDC4;
    border-radius: 2px;
}

/* Property Cards */
.property-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.property-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    border-color: #4A90E2;
}

.property-card-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
}

.property-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.property-card:hover .property-card-image img {
    transform: scale(1.05);
}

.property-card-content {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.property-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.property-card-address,
.property-card-location {
    font-size: 12px;
    color: #666;
    margin: 4px 0;
    line-height: 1.4;
}

.property-card-prices {
    font-size: 14px;
    font-weight: 600;
    color: #4A90E2;
    margin: 8px 0;
    padding: 6px 8px;
    background: #f0f7ff;
    border-radius: 6px;
    line-height: 1.3;
}

.property-card-details {
    font-size: 12px;
    color: #555;
    margin: 6px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.property-card-features {
    font-size: 11px;
    color: #4ECDC4;
    margin: 6px 0;
    padding: 4px 8px;
    background: #f0fffe;
    border-radius: 4px;
    display: inline-block;
    line-height: 1.3;
}

.property-card-phone {
    font-size: 11px;
    color: #333;
    margin: 6px 0;
    font-weight: 500;
}

.property-card-description {
    font-size: 11px;
    color: #777;
    margin: 6px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.property-card-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.property-card-link {
    padding: 10px 16px;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    text-align: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
    cursor: pointer;
}

.property-card-link.contact-btn {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.property-card:hover .property-card-link {
    background: linear-gradient(135deg, #357ABD 0%, #4A90E2 100%);
    transform: scale(1.02);
}

.property-card:hover .property-card-link.contact-btn {
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
}

/* Ensure property cards are displayed properly in messages */
.bot-message .message-content {
    max-width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .property-cards-container {
        gap: 8px;
    }
    
    .property-card {
        width: 260px;
        min-width: 260px;
    }
    
    .property-card-image {
        height: 140px;
    }
    
    .property-card-title {
        font-size: 14px;
    }
    
    .property-card-content {
        padding: 10px;
    }
}

