/* ============================================
   orea.ashency.fr — Mobile-First Stylesheet
   Mode clair (crème) par défaut + mode sombre
   Chat en bleu marine Groupe Ippolito
   ============================================ */

/* ---- Theme Variables ---- */

:root {
    /* Ippolito navy blue (from groupe-ippolito.com) */
    --navy: #1c1b4b;
    --navy-light: #252466;
    --navy-dark: #14133a;
    --gold: #c9a84c;
    --gold-dim: #a68a3a;

    /* Light mode (default) */
    --bg: #f5f0e8;
    --bg-secondary: #ece6da;
    --surface: #ffffff;
    --border: #ddd6c8;
    --border-subtle: #e8e2d6;
    --text: #1a1a2e;
    --text-dim: #5a5870;
    --text-muted: #8a8698;
    --shadow: 0 2px 16px rgba(28, 27, 75, 0.08);

    /* Chat colors (navy) */
    --chat-bg: var(--navy);
    --chat-header-bg: var(--navy-dark);
    --chat-border: var(--navy-light);
    --chat-text: #f0f0f5;
    --chat-text-dim: #a8a6c0;
    --chat-input-bg: var(--navy-dark);
    --chat-input-border: #33316a;
    --chat-bot-bg: rgba(255, 255, 255, 0.06);
    --chat-bot-border: rgba(255, 255, 255, 0.08);
    --chat-user-bg: rgba(201, 168, 76, 0.12);
    --chat-user-border: rgba(201, 168, 76, 0.2);

    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Dark mode ---- */

[data-theme="dark"] {
    --bg: #0d0d14;
    --bg-secondary: #12121c;
    --surface: #16162a;
    --border: #2a2946;
    --border-subtle: #1e1e36;
    --text: #e8e8f0;
    --text-dim: #8a8a9e;
    --text-muted: #5a5a70;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.3);

    --chat-input-bg: #12113a;
    --chat-input-border: #2a2860;
}

/* ---- Reset ---- */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ---- Page Layout ---- */

.page {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 16px;
}

/* ---- Header ---- */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    flex-shrink: 0;
}

.header-logo {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.header-logo:hover {
    color: var(--gold-dim);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-location {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* ---- Theme Toggle ---- */

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-dim);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
    color: var(--gold);
    border-color: var(--gold-dim);
}

.theme-label {
    font-size: 0.65rem;
    font-weight: 400;
    white-space: nowrap;
}

/* Show sun in dark mode, moon in light mode */
.icon-sun {
    display: none;
}

.icon-moon {
    display: block;
}

[data-theme="dark"] .icon-sun {
    display: block;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

/* ---- Title Block ---- */

.title-block {
    text-align: center;
    padding: 6px 0 10px;
    flex-shrink: 0;
}

.title-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
}

.title-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: 0.06em;
    line-height: 1.2;
}

[data-theme="dark"] .title-name {
    color: var(--gold);
}

.title-group {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 300;
    margin-top: 2px;
}

/* ---- Main / Chat Container ---- */

.main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 6px;
}

.chat-container {
    flex: 1;
    min-height: 0;
    display: flex;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--chat-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* ---- Chat Header ---- */

.chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--chat-header-bg);
    border-bottom: 1px solid var(--chat-border);
    flex-shrink: 0;
}

.chat-header-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
}

.chat-header-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--chat-text);
}

.chat-header-badge {
    font-size: 0.65rem;
    color: var(--chat-text-dim);
    margin-left: auto;
    font-weight: 300;
}

/* ---- Chat Messages ---- */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

/* ---- Message Bubbles ---- */

.message {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    line-height: 1.55;
    word-wrap: break-word;
    animation: fadeIn 0.25s ease-out;
}

.message-bot {
    align-self: flex-start;
    background: var(--chat-bot-bg);
    border: 1px solid var(--chat-bot-border);
    color: var(--chat-text);
}

.message-user {
    align-self: flex-end;
    background: var(--chat-user-bg);
    border: 1px solid var(--chat-user-border);
    color: var(--chat-text);
}

.message-typing {
    align-self: flex-start;
    background: var(--chat-bot-bg);
    border: 1px solid var(--chat-bot-border);
    padding: 10px 18px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--chat-text-dim);
    animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

/* ---- Chat Input ---- */

.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--chat-border);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: var(--chat-input-bg);
    border: 1px solid var(--chat-input-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--chat-text);
    font-family: var(--font);
    font-size: 0.875rem;
    line-height: 1.4;
    resize: none;
    outline: none;
    max-height: 100px;
    transition: border-color 0.2s;
}

.chat-input::placeholder {
    color: var(--chat-text-dim);
}

.chat-input:focus {
    border-color: var(--gold-dim);
}

.chat-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--gold);
    color: var(--navy-dark);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, opacity 0.2s;
}

.chat-send:hover {
    background: var(--gold-dim);
}

.chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Footer ---- */

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    flex-shrink: 0;
}

.footer a {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 300;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--text-dim);
}

/* ---- Animations ---- */

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* ============================================
   RESPONSIVE — Desktop (min 640px)
   ============================================ */

@media (min-width: 640px) {
    .page {
        padding: 20px 24px;
    }

    .title-block {
        padding: 10px 0 14px;
    }

    .title-name {
        font-size: 1.5rem;
    }

    .chat-header {
        padding: 12px 18px;
    }

    .chat-messages {
        padding: 18px;
        gap: 12px;
    }

    .message {
        max-width: 80%;
        font-size: 0.9rem;
    }

    .chat-input-area {
        padding: 12px 16px;
    }
}

/* ============================================
   RESPONSIVE — Small mobile (max 380px)
   iPhone SE, petits écrans
   ============================================ */

@media (max-width: 380px) {
    .page {
        padding: 8px 10px;
    }

    .title-name {
        font-size: 1rem;
    }

    .title-label {
        font-size: 0.65rem;
    }

    .chat-header {
        padding: 8px 10px;
    }

    .chat-messages {
        padding: 10px;
        gap: 8px;
    }

    .message {
        max-width: 92%;
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    .chat-input-area {
        padding: 8px;
        gap: 6px;
    }

    .chat-input {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    .chat-send {
        width: 36px;
        height: 36px;
    }
}
