/* AI Chat Styles - GeoMap Premium IA */

:root {
    --ai-primary: #667eea;
    --ai-secondary: #764ba2;
    --ai-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ai-glass: rgba(255, 255, 255, 0.9);
    --ai-glass-border: rgba(255, 255, 255, 0.2);
    --ai-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Floating Button */
#ai-chat-trigger {
    position: fixed;
    bottom: 25px;
    left: 80px;
    width: 60px;
    height: 60px;
    background: var(--ai-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--ai-shadow);
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#ai-chat-trigger:hover {
    transform: scale(1.1) rotate(5deg);
}

#ai-chat-trigger .ai-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--ai-primary);
    opacity: 0.5;
    animation: ai-pulse 2s infinite;
    z-index: -1;
}

@keyframes ai-pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Chat Container */
#ai-chat-container {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 550px;
    background: var(--ai-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--ai-glass-border);
    border-radius: 20px;
    box-shadow: var(--ai-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.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#ai-chat-container.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.ai-chat-header {
    background: var(--ai-gradient);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-header .ai-status {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

.ai-chat-close {
    cursor: pointer;
    font-size: 20px;
    opacity: 0.8;
}

/* Messages Area */
#ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(255, 255, 255, 0.5);
}

.ai-msg {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-msg.user {
    align-self: flex-end;
    background: var(--ai-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.ai-msg.bot {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Input Area */
.ai-chat-input-area {
    padding: 15px;
    background: white;
    display: flex;
    gap: 10px;
    border-top: 1px solid #eee;
}

.ai-chat-input-area input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 10px 18px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s;
}

.ai-chat-input-area input:focus {
    border-color: var(--ai-primary);
}

.ai-chat-send {
    width: 40px;
    height: 40px;
    background: var(--ai-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.ai-chat-send:active {
    transform: scale(0.9);
}

/* Typing Indicator */
.ai-typing {
    font-style: italic;
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    display: none;
}

/* Responsive Mobile */
@media (max-width: 480px) {
    #ai-chat-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    #ai-chat-trigger {
        bottom: 20px;
        left: 20px; /* Position inside/above the floating stats toggle on mobile? */
        /* Actually stats toggle is at bottom left 20px. Let's put AI at top right for mobile? */
        /* In many mobile maps, top right is good. But wait, drawing tools are there. */
        /* Let's keep it bottom left but offset it. */
        bottom: 80px;
        left: 20px;
    }
}

/* === NEW: Structured Result Cards (GuaruBot 2.0) === */

/* Grid for Property Cards */
.ai-property-grid {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

/* Individual Property Card */
.ai-property-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-property-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    border-color: var(--ai-primary);
}

/* Card Header */
.ai-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ai-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.ai-card-badge {
    font-size: 10px;
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Card Details */
.ai-card-details {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #475569;
}

.ai-card-detail-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-card-price {
    font-size: 14px;
    font-weight: 800;
    color: #059669;
    margin-top: 4px;
}

/* Analysis Table (For tables generated by AI) */
.ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin: 10px 0;
}

.ai-table th {
    text-align: left;
    background: #f8fafc;
    color: #64748b;
    padding: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.ai-table td {
    padding: 6px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.ai-table tr:last-child td {
    border-bottom: none;
}