/* ====================================================================== */
/*  maestro-ai.css - Diet Maestro AI page (/maestro-ai, maestroAi.jsp)    */
/*                                                                         */
/*  Replaces the floating chat widget that used to be in footer.css on     */
/*  every page. Same tokens as consultation.css / cart.css so the page     */
/*  sits with the rest of the funnel. Scoped under .ai-page.               */
/* ====================================================================== */

:root {
    --ai-primary:       #0e9d63;
    --ai-primary-dark:  #0a7d4f;
    --ai-accent:        #15b88a;
    --ai-gold:          #d97706;
    --ai-ink:           #0f172a;
    --ai-text:          #334155;
    --ai-muted:         #64748b;
    --ai-border:        #e2e8f0;
    --ai-bg-page:       #f6faf8;
    --ai-bg-soft:       #f8fafc;
    --ai-bg-tint:       #eefaf6;
    --ai-shadow-lg:     0 20px 60px rgba(13, 38, 28, 0.10);
    --ai-shadow-md:     0 10px 30px rgba(13, 38, 28, 0.08);
    --ai-grad-primary:  linear-gradient(135deg, #0e9d63 0%, #15b88a 100%);
    --ai-grad-hero:     linear-gradient(160deg, rgba(5,20,12,0.84) 0%, rgba(5,20,12,0.68) 55%, rgba(10,60,35,0.60) 100%);
}

/* ---------------------------------------------------------------------- */
/*  Base                                                                   */
/* ---------------------------------------------------------------------- */

.ai-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ai-text);
    background: var(--ai-bg-page);
}

.ai-page *,
.ai-page *:before,
.ai-page *:after {
    box-sizing: border-box;
}

/* ---------------------------------------------------------------------- */
/*  Hero band                                                              */
/* ---------------------------------------------------------------------- */

.ai-page .page-title {
    padding-top: 170px;
    padding-bottom: 60px;
}

.ai-page .page-title:before {
    background: var(--ai-grad-hero);
}

.ai-page .ai-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    border-radius: 100px;
    background: rgba(5, 20, 12, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 18px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.ai-page .ai-eyebrow .fa {
    color: #fbbf24;
}

.ai-page .page-title h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.75em;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: #ffffff;
    margin: 0 auto 12px;
    max-width: 760px;
}

.ai-page .page-title h1 .accent {
    color: #fbbf24;
}

.ai-page .page-title h3,
.ai-page .page-title h3.styled-font {
    font-family: 'Inter', sans-serif;
    font-size: 1.08em;
    font-weight: 400;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.86);
    max-width: 640px;
    margin: 0 auto;
}

/* ---------------------------------------------------------------------- */
/*  Section + grid                                                         */
/* ---------------------------------------------------------------------- */

.ai-page .ai-section {
    position: relative;
    padding: 48px 0 80px;
    background: var(--ai-bg-page);
}

.ai-page .ai-section .row {
    display: flex;
    flex-wrap: wrap;
}

.ai-page .ai-section .row > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

/* ---------------------------------------------------------------------- */
/*  Chat panel                                                             */
/* ---------------------------------------------------------------------- */

.ai-page .ai-chat {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--ai-border);
    border-radius: 22px;
    box-shadow: var(--ai-shadow-lg);
    overflow: hidden;
    margin-bottom: 30px;
    /* tall enough to feel like a real chat, never taller than the viewport */
    height: calc(100vh - 230px);
    min-height: 560px;
    max-height: 820px;
}

.ai-page .ai-chat__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 24px;
    border-bottom: 1px solid #eef2f6;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
    flex: 0 0 auto;
}

.ai-page .ai-avatar {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--ai-grad-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(14,157,99,0.3);
}

.ai-page .ai-avatar svg {
    width: 24px;
    height: 24px;
}

.ai-page .ai-chat__title {
    margin: 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.3em;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ai-ink);
}

.ai-page .ai-chat__sub {
    margin: 2px 0 0;
    font-size: 0.84em;
    color: var(--ai-muted);
}

.ai-page .ai-chat__badge {
    margin-left: auto;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 100px;
    background: var(--ai-bg-tint);
    border: 1px solid rgba(14,157,99,0.3);
    color: var(--ai-primary-dark);
    font-size: 0.74em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ai-page .ai-chat__badge:before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ai-primary);
    box-shadow: 0 0 0 3px rgba(14,157,99,0.18);
}

/* intent strip: what this page is (general advice) and what it is not (a plan) */
.ai-page .ai-intent {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 24px;
    background: #fffaf2;
    border-bottom: 1px solid rgba(217,119,6,0.22);
    font-size: 0.88em;
    line-height: 1.5;
    color: var(--ai-text);
}

.ai-page .ai-intent > .fa {
    flex: 0 0 auto;
    margin-top: 3px;
    color: var(--ai-gold);
}

.ai-page .ai-intent p {
    margin: 0;
}

.ai-page .ai-intent strong {
    color: var(--ai-ink);
    font-weight: 700;
}

.ai-page .ai-intent a {
    display: inline-block;
    margin-left: 4px;
    color: var(--ai-primary-dark);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(10,125,79,0.35);
    text-underline-offset: 2px;
    white-space: nowrap;
}

.ai-page .ai-intent a:hover {
    color: var(--ai-primary);
}

/* history */
.ai-page #chat-history {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 24px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background:
        radial-gradient(circle at 100% 0%, rgba(14,157,99,0.06), transparent 40%),
        #ffffff;
    scrollbar-width: thin;
    scrollbar-color: rgba(14,157,99,0.35) transparent;
}

.ai-page #chat-history::-webkit-scrollbar {
    width: 6px;
}

.ai-page #chat-history::-webkit-scrollbar-thumb {
    background: rgba(14,157,99,0.35);
    border-radius: 3px;
}

.ai-page .chat-message {
    display: flex;
    max-width: 82%;
    animation: aiFadeUp 0.3s ease-out;
}

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

.ai-page .chat-message.user {
    align-self: flex-end;
    justify-content: flex-end;
    margin-left: auto;
}

.ai-page .chat-message.bot {
    align-self: flex-start;
    justify-content: flex-start;
    margin-right: auto;
}

.ai-page .bubble {
    position: relative;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95em;
    line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ai-page .chat-message.user .bubble {
    background: var(--ai-grad-primary);
    color: #ffffff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 8px 20px rgba(14,157,99,0.25);
}

.ai-page .chat-message.bot .bubble {
    background: var(--ai-bg-soft);
    color: var(--ai-ink);
    border: 1px solid var(--ai-border);
    border-bottom-left-radius: 6px;
}

.ai-page .chat-message.bot .bubble a {
    color: var(--ai-primary-dark);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-page .chat-message.user .bubble a {
    color: #ffffff;
}

.ai-page .chat-loading {
    align-self: center;
    padding: 20px;
    color: var(--ai-muted);
    font-size: 0.9em;
    font-style: italic;
}

/* "thinking" dots inside a bot bubble (markup built in maestro-ai.js) */
.ai-page .thinking-dots span {
    display: inline-block;
    animation: aiBlink 1.2s infinite;
}

.ai-page .thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-page .thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiBlink {
    0%, 80%, 100% { opacity: 0.2; }
    40%           { opacity: 1; }
}

/* suggested prompts */
.ai-page .ai-suggest {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 24px 12px;
}

.ai-page .ai-suggest__label {
    width: 100%;
    font-size: 0.74em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ai-muted);
    margin: 0 0 2px;
}

.ai-page .ai-suggest button {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid rgba(14,157,99,0.3);
    background: var(--ai-bg-tint);
    color: var(--ai-primary-dark);
    border-radius: 100px;
    padding: 8px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 0.86em;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-page .ai-suggest button:hover,
.ai-page .ai-suggest button:focus-visible {
    background: var(--ai-primary);
    color: #ffffff;
    border-color: var(--ai-primary);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(14,157,99,0.25);
    outline: none;
}

.ai-page .ai-suggest.is-hidden {
    display: none;
}

/* while the history is loading the chips are visible but inert */
.ai-page .ai-suggest.is-loading button {
    opacity: 0.55;
    cursor: wait;
    pointer-events: none;
}

/* composer - a <div>, not a <form>, on purpose (see maestroAi.jsp) */
.ai-page #chat-form {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 14px 20px;
    border-top: 1px solid #eef2f6;
    background: #ffffff;
}

.ai-page #chat-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 52px;
    padding: 10px 18px;
    border: 1.5px solid #d1d5db;
    border-radius: 100px;
    background: #ffffff;
    color: var(--ai-ink);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.4;
    box-shadow: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ai-page #chat-input::placeholder {
    color: #6b7280;
    opacity: 1;
}

.ai-page #chat-input:focus,
.ai-page #chat-input:focus-visible {
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 4px rgba(14,157,99,0.15);
    outline: none;
}

.ai-page #chat-input:disabled {
    background: var(--ai-bg-soft);
    color: var(--ai-muted);
}

.ai-page #chat-send {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    padding: 0 22px;
    border: none;
    border-radius: 100px;
    background: var(--ai-grad-primary);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(14,157,99,0.3);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ai-page #chat-send .fa {
    color: #ffffff;
}

.ai-page #chat-send:hover,
.ai-page #chat-send:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(14,157,99,0.4);
    outline: none;
}

.ai-page #chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-page .ai-chat__note {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 20px 12px;
    text-align: center;
    font-size: 0.78em;
    line-height: 1.5;
    color: var(--ai-muted);
    background: #ffffff;
}

/* ---------------------------------------------------------------------- */
/*  Side column                                                            */
/* ---------------------------------------------------------------------- */

.ai-page .ai-card {
    position: relative;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--ai-border);
    border-radius: 22px;
    box-shadow: var(--ai-shadow-md);
    padding: 24px 26px;
    margin-bottom: 22px;
}

.ai-page .ai-card--cta {
    border-color: rgba(14,157,99,0.22);
    overflow: hidden;
}

.ai-page .ai-card--cta:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 5px;
    background: var(--ai-grad-primary);
}

.ai-page .ai-card h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25em;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ai-ink);
}

.ai-page .ai-card h2 .fa {
    color: var(--ai-primary);
    font-size: 0.9em;
}

.ai-page .ai-card p {
    margin: 0 0 12px;
    font-size: 0.93em;
    line-height: 1.6;
    color: var(--ai-text);
}

.ai-page .ai-card p:last-child {
    margin-bottom: 0;
}

.ai-page .ai-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ai-page .ai-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.93em;
    line-height: 1.5;
    color: var(--ai-text);
}

.ai-page .ai-list li + li {
    border-top: 1px dashed var(--ai-border);
}

.ai-page .ai-list .fa {
    flex: 0 0 auto;
    margin-top: 4px;
    color: var(--ai-primary);
}

.ai-page .ai-list li.is-no .fa {
    color: var(--ai-gold);
}

.ai-page .ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 60px;
    font-family: 'Inter', sans-serif;
    font-size: 0.98em;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.ai-page .ai-btn + .ai-btn {
    margin-top: 10px;
}

.ai-page .ai-btn--primary {
    background: var(--ai-grad-primary);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(14,157,99,0.3);
}

.ai-page .ai-btn--primary .fa {
    color: #ffffff;
}

.ai-page .ai-btn--primary:hover,
.ai-page .ai-btn--primary:focus {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(14,157,99,0.4);
}

.ai-page .ai-btn--whatsapp {
    background: #ffffff;
    color: #166534;
    border: 1.5px solid #25d366;
}

.ai-page .ai-btn--whatsapp .fa {
    color: #25d366;
    font-size: 1.2em;
}

.ai-page .ai-btn--whatsapp:hover,
.ai-page .ai-btn--whatsapp:focus {
    background: #f0fdf4;
    color: #166534;
    transform: translateY(-2px);
}

/* ---------------------------------------------------------------------- */
/*  Responsive                                                             */
/* ---------------------------------------------------------------------- */

@media (min-width: 992px) {
    .ai-page .ai-sticky {
        position: -webkit-sticky;
        position: sticky;
        top: 130px;
    }
}

@media (max-width: 1140px) {
    .ai-page .page-title {
        padding-top: 70px;
        padding-bottom: 50px;
    }
}

@media (max-width: 991px) {
    .ai-page .ai-section {
        padding: 32px 0 60px;
    }

    .ai-page .page-title h1 {
        font-size: 2.1em;
    }

    .ai-page .ai-chat {
        height: auto;
        min-height: 520px;
        max-height: none;
    }

    .ai-page #chat-history {
        height: 46vh;
        min-height: 300px;
        max-height: 520px;
    }
}

@media (max-width: 767px) {
    .ai-page .page-title h1 {
        font-size: 1.85em;
    }

    .ai-page .page-title h3,
    .ai-page .page-title h3.styled-font {
        font-size: 0.98em;
    }

    .ai-page .ai-chat {
        border-radius: 18px;
        min-height: 0;
    }

    .ai-page .ai-chat__head {
        padding: 14px 16px;
        gap: 12px;
    }

    .ai-page .ai-chat__title {
        font-size: 1.15em;
    }

    .ai-page .ai-chat__badge {
        display: none;
    }

    .ai-page .ai-intent {
        padding: 10px 16px;
        font-size: 0.84em;
    }

    .ai-page #chat-history {
        padding: 16px 16px 8px;
        height: 42vh;
        min-height: 260px;
    }

    .ai-page .chat-message {
        max-width: 90%;
    }

    .ai-page .ai-suggest {
        padding: 4px 16px 10px;
    }

    .ai-page .ai-suggest button {
        font-size: 0.82em;
        padding: 7px 12px;
    }

    .ai-page #chat-form {
        padding: 12px 12px 12px 14px;
        gap: 8px;
    }

    .ai-page #chat-input {
        height: 48px;
        padding: 10px 14px;
        font-size: 16px; /* 16px stops iOS from zooming the page on focus */
    }

    .ai-page #chat-send {
        height: 48px;
        width: 48px;
        padding: 0;
        border-radius: 50%;
    }

    .ai-page #chat-send .lbl {
        display: none;
    }

    .ai-page .ai-card {
        padding: 20px;
        border-radius: 18px;
    }
}
