/**
 * Cintu Realty Search - Styles
 * Widget de recherche immobilier conversationnel
 */

.crs-widget {
    --crs-primary: #1F4E78;
    --crs-primary-dark: #163a5a;
    --crs-bg: #ffffff;
    --crs-bg-soft: #f7f8fa;
    --crs-border: #e5e7eb;
    --crs-text: #1a1a1a;
    --crs-text-soft: #6b7280;
    --crs-bubble-user: #1F4E78;
    --crs-bubble-user-text: #ffffff;
    --crs-bubble-ai: #f1f5f9;
    --crs-bubble-ai-text: #1a1a1a;
    --crs-radius: 16px;
    --crs-radius-sm: 12px;
    --crs-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --crs-shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.04);

    max-width: 760px;
    margin: 40px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--crs-text);
    background: var(--crs-bg);
    border-radius: var(--crs-radius);
    box-shadow: var(--crs-shadow);
    overflow: hidden;
}

/* HERO */
.crs-hero {
    background: linear-gradient(135deg, var(--crs-primary) 0%, var(--crs-primary-dark) 100%);
    color: white;
    padding: 40px 32px 32px;
    text-align: center;
}

.crs-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    color: white;
    line-height: 1.2;
}

.crs-subtitle {
    font-size: 15px;
    margin: 0;
    opacity: 0.9;
    line-height: 1.5;
    color: white;
}

/* CHAT */
.crs-chat {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.crs-messages {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 8px;
}

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

.crs-messages::-webkit-scrollbar-thumb {
    background: var(--crs-border);
    border-radius: 3px;
}

.crs-message {
    display: flex;
    gap: 10px;
    animation: crs-fade-in 0.3s ease-out;
}

.crs-message-user {
    flex-direction: row-reverse;
}

.crs-message-user .crs-bubble {
    background: var(--crs-bubble-user);
    color: var(--crs-bubble-user-text);
    border-bottom-right-radius: 4px;
}

.crs-message-assistant .crs-bubble {
    background: var(--crs-bubble-ai);
    color: var(--crs-bubble-ai-text);
    border-bottom-left-radius: 4px;
}

.crs-bubble {
    padding: 12px 16px;
    border-radius: var(--crs-radius-sm);
    max-width: 80%;
    line-height: 1.5;
    font-size: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.crs-avatar {
    width: 36px;
    height: 36px;
    background: var(--crs-bg-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--crs-primary);
}

.crs-message-user .crs-avatar {
    display: none;
}

/* INDICATEUR DE FRAPPE */
.crs-typing {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.crs-typing span {
    width: 8px;
    height: 8px;
    background: var(--crs-text-soft);
    border-radius: 50%;
    animation: crs-typing 1.4s infinite ease-in-out;
}

.crs-typing span:nth-child(2) { animation-delay: 0.2s; }
.crs-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes crs-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* INPUT */
.crs-input-zone {
    display: flex;
    gap: 10px;
    background: var(--crs-bg-soft);
    border-radius: var(--crs-radius-sm);
    padding: 8px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.crs-input-zone:focus-within {
    border-color: var(--crs-primary);
    background: white;
}

.crs-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    color: var(--crs-text);
    line-height: 1.5;
    min-height: 24px;
    max-height: 120px;
}

.crs-input::placeholder {
    color: var(--crs-text-soft);
}

.crs-send-btn {
    background: var(--crs-primary);
    color: white;
    border: none;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    align-self: flex-end;
}

.crs-send-btn:hover {
    background: var(--crs-primary-dark);
    transform: scale(1.05);
}

.crs-send-btn:disabled {
    background: var(--crs-border);
    cursor: not-allowed;
    transform: none;
}

/* FORMULAIRE EMAIL */
.crs-email-form {
    margin-top: 8px;
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    border: 2px solid var(--crs-primary);
    border-radius: var(--crs-radius-sm);
    animation: crs-slide-up 0.4s ease-out;
}

.crs-email-title {
    font-size: 18px;
    margin: 0 0 8px;
    color: var(--crs-primary);
    font-weight: 700;
}

.crs-email-text {
    font-size: 14px;
    margin: 0 0 16px;
    color: var(--crs-text-soft);
    line-height: 1.5;
}

.crs-email-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

#crs-email-input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid var(--crs-border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

#crs-email-input:focus {
    border-color: var(--crs-primary);
}

#crs-email-submit {
    width: auto;
    height: auto;
    padding: 0 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.crs-email-legal {
    font-size: 12px;
    color: var(--crs-text-soft);
    margin: 0;
    line-height: 1.4;
}

/* SUCCÈS */
.crs-success {
    text-align: center;
    padding: 40px 24px;
    animation: crs-fade-in 0.4s ease-out;
}

.crs-success-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.crs-success h3 {
    font-size: 22px;
    margin: 0 0 8px;
    color: var(--crs-primary);
}

.crs-success p {
    font-size: 15px;
    color: var(--crs-text-soft);
    margin: 0;
    line-height: 1.5;
}

/* ANIMATIONS */
@keyframes crs-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes crs-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .crs-widget {
        margin: 20px 12px;
        border-radius: 12px;
    }

    .crs-hero {
        padding: 28px 20px 24px;
    }

    .crs-title {
        font-size: 22px;
    }

    .crs-subtitle {
        font-size: 14px;
    }

    .crs-chat {
        padding: 16px;
    }

    .crs-bubble {
        font-size: 14px;
        max-width: 88%;
    }

    .crs-email-row {
        flex-direction: column;
    }

    #crs-email-submit {
        width: 100%;
    }
}

/* ÉTAT DÉSACTIVÉ */
.crs-input-zone.crs-disabled {
    opacity: 0.5;
    pointer-events: none;
}
