/* ── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    font-size: 16px;          /* iOS : évite le zoom auto sur les inputs */
}

/* ── Topbar ───────────────────────────────────────────────────────────── */
.topbar {
    background: white;
    border-bottom: 6px solid #FFC20F;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo { height: 60px; }

.brand {
    font-size: 24px;
    font-weight: 900;
    color: #26001D;
}

/* ── Page layout ──────────────────────────────────────────────────────── */
.page {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

/* ── Hero banner ──────────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, #26001D, #090C0D);
    color: white;
    padding: 40px;
    border-radius: 25px;
    margin-bottom: 25px;
}

.hero h1 {
    margin-top: 0;
    font-size: 42px;
}

.hero p {
    color: #f3f4f6;
    line-height: 1.8;
    margin-bottom: 0;
}

/* ── Chat container ───────────────────────────────────────────────────── */
.chat-box {
    background: white;
    border-radius: 25px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}

/* ── Messages area ────────────────────────────────────────────────────── */
.chat-messages {
    flex: 1;
    height: 500px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;   /* Task 5: iOS smooth scroll */
    background: #f9fafb;
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 16px;
    scroll-behavior: smooth;
}

/* ── Message bubbles ──────────────────────────────────────────────────── */
.message {
    padding: 14px 18px;
    border-radius: 18px;
    margin-bottom: 15px;
    max-width: 80%;
    line-height: 1.7;
    animation: fadeIn .3s ease;
    word-break: break-word;
}

/* User messages: plain text, pre-line keeps manual line breaks */
.message.user {
    background: #FFC20F;
    margin-left: auto;
    white-space: pre-line;
}

/* Bot messages: rendered as HTML — no pre-line needed */
.message.bot {
    background: #e5e7eb;
}

.timestamp {
    font-size: 11px;
    opacity: 0.65;
    margin-top: 8px;
}

/* ── Task 1: Contact rows ─────────────────────────────────────────────── */
.contact-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin: 3px 0;
    font-size: 14px;
}

.contact-icon { flex-shrink: 0; font-size: 13px; }

.contact-label {
    font-weight: 700;
    color: #374151;
    min-width: 78px;
    flex-shrink: 0;
}

.contact-value { color: #1d3557; }

.contact-value a {
    color: #1d3557;
    text-decoration: underline;
    word-break: break-all;
}

/* ── Task 1: Bot list ─────────────────────────────────────────────────── */
.bot-list {
    margin: 4px 0 4px 0;
    padding-left: 20px;
}

.bot-list li { margin-bottom: 3px; }

/* ── Task 1: Bot paragraphs ───────────────────────────────────────────── */
.bot-para {
    margin: 3px 0;
}

/* ── Task 1: Section headings inside bot response ────────────────────── */
.bot-heading {
    font-weight: 700;
    color: #26001D;
    margin: 10px 0 4px;
    font-size: 15px;
    border-bottom: 2px solid #FFC20F;
    padding-bottom: 3px;
    display: inline-block;
}

.bot-separator { border: none; border-top: 1px solid #d1d5db; margin: 10px 0; }

/* ── Task 2: Typing indicator ─────────────────────────────────────────── */
.typing-bubble { min-height: 44px; padding: 14px 18px; }

.typing {
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing span {
    width: 9px;
    height: 9px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

/* ── Task 4: Suggestion chips ─────────────────────────────────────────── */
.chips-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 16px;
}

.chip {
    background: white;
    border: 2px solid #26001D;
    color: #26001D;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s, color .18s, transform .1s;
    font-family: inherit;
}

.chip:hover, .chip:focus {
    background: #26001D;
    color: white;
    transform: translateY(-1px);
    outline: none;
}

/* ── Chat input area ──────────────────────────────────────────────────── */
.chat-input-area {
    background: white;
    padding-top: 4px;
}

.chat-form {
    display: flex;
    gap: 10px;
}

.chat-form input {
    flex: 1;
    padding: 15px;
    border-radius: 14px;
    border: 1px solid #d1d5db;
    font-size: 16px;        /* Task 5: évite le zoom iOS */
    font-family: inherit;
    transition: border-color .2s;
}

.chat-form input:focus {
    outline: none;
    border-color: #26001D;
}

.chat-form button {
    background: #26001D;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background .2s, transform .1s;
    font-family: inherit;
    font-size: 16px;
    white-space: nowrap;
}

.chat-form button:hover { background: #3f0a33; transform: translateY(-1px); }
.chat-form button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.reset-btn {
    display: inline-block;
    margin-top: 14px;
    color: #6b7280;
    text-decoration: none;
    font-size: 13px;
}

.reset-btn:hover { color: #26001D; }

/* ── Animations ───────────────────────────────────────────────────────── */
@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-6px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* ── Task 5: Mobile responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .hero h1 { font-size: 28px; }
    .hero     { padding: 25px 20px; }

    .page {
        margin: 10px auto;
        padding: 0 12px;
    }

    .chat-box {
        padding: 16px;
        border-radius: 18px;
    }

    .chat-messages {
        height: calc(100svh - 300px);
        min-height: 200px;
    }

    .chat-input-area {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 12px 0 6px;
        border-top: 1px solid #e5e7eb;
        z-index: 10;
    }

    .chat-form { flex-direction: column; }
    .chat-form button { width: 100%; }

    .message { max-width: 100%; }

    .topbar {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .chips-area { gap: 6px; }
    .chip { font-size: 12px; padding: 5px 12px; }
}
