/* ============================================================
   Gerador de Conversa WhatsApp · Barreto Imóveis
   Tema: claro, branco, elegante (sem verde)
   Stack: CSS puro
   ============================================================ */

/* ---------- Reset & Tokens ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    /* Paleta */
    --bg: #ffffff;
    --bg-soft: #f7f7f8;
    --surface: #ffffff;
    --surface-2: #fbfbfc;
    --border: #ececef;
    --border-strong: #d9d9de;
    --text: #0e0e10;
    --text-muted: #6b6b73;
    --text-soft: #9a9aa3;
    --accent: #111114;             /* preto suave para CTAs */
    --accent-hover: #2a2a2f;
    --ring: rgba(17, 17, 20, 0.12);
    --danger: #b42318;
    --danger-bg: #fef3f2;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 15, 20, 0.04),
                 0 1px 1px rgba(15, 15, 20, 0.02);
    --shadow-md: 0 8px 24px -8px rgba(15, 15, 20, 0.10),
                 0 2px 6px rgba(15, 15, 20, 0.04);
    --shadow-lg: 0 24px 48px -16px rgba(15, 15, 20, 0.18),
                 0 8px 16px -8px rgba(15, 15, 20, 0.08);

    /* Type */
    --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Fraunces", "Manrope", serif;

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 28px;
    --r-pill: 999px;

    /* Spacing scale */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;
    --s-9: 96px;
}

/* ---------- Base ---------- */
html, body {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--text);
    color: var(--bg);
}

input,
button,
textarea {
    font: inherit;
    color: inherit;
}

/* ---------- Background decorativo ---------- */
.bg-decor {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.bg-decor__blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    will-change: transform;
}

.bg-decor__blob--1 {
    width: 520px;
    height: 520px;
    top: -180px;
    left: -120px;
    background: radial-gradient(circle at 30% 30%, #eef0f5, transparent 70%);
}

.bg-decor__blob--2 {
    width: 600px;
    height: 600px;
    bottom: -220px;
    right: -160px;
    background: radial-gradient(circle at 70% 70%, #f4eef0, transparent 70%);
}

.bg-decor__grain {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.4;
    mix-blend-mode: multiply;
}

/* ---------- Shell ---------- */
.shell {
    max-width: 1140px;
    margin: 0 auto;
    padding: clamp(var(--s-5), 4vw, var(--s-7)) clamp(var(--s-4), 4vw, var(--s-6));
    display: flex;
    flex-direction: column;
    gap: clamp(var(--s-6), 5vw, var(--s-8));
}

/* ---------- Header ---------- */
.header {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    max-width: 720px;
    animation: fadeUp 0.6s ease both;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: var(--s-3);
}

.header__logo {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.header__logo svg {
    width: 22px;
    height: 22px;
}

.header__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header__eyebrow {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.header__title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(28px, 4.4vw, 44px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text);
}

.header__subtitle {
    margin: 0;
    font-size: 16px;
    color: var(--text-muted);
    max-width: 56ch;
}

/* ---------- Grid ---------- */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(var(--s-4), 2vw, var(--s-5));
}

@media (min-width: 900px) {
    .grid {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
        align-items: start;
    }
}

/* ---------- Card ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: clamp(var(--s-5), 3vw, var(--s-6));
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.7s ease both;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card--preview {
    animation-delay: 0.1s;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfc 100%);
    position: sticky;
    top: var(--s-5);
}

@media (max-width: 899px) {
    .card--preview {
        position: static;
    }
}

.card__head {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin-bottom: var(--s-5);
    padding-bottom: var(--s-4);
    border-bottom: 1px dashed var(--border);
}

.card__index {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--text-soft);
    font-feature-settings: "tnum";
    letter-spacing: 0.04em;
}

.card__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card__pill {
    margin-left: auto;
    font-size: 11px;
    padding: 4px 10px;
    background: var(--bg-soft);
    color: var(--text-muted);
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    font-weight: 600;
    letter-spacing: 0.02em;
    font-feature-settings: "tnum";
}

/* ---------- Form ---------- */
.form {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.005em;
}

.field__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field__prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-soft);
    display: grid;
    place-items: center;
    pointer-events: none;
    transition: color 0.2s ease;
}

.field__input {
    width: 100%;
    background: transparent;
    border: 0;
    outline: 0;
    padding: 14px 14px 14px 44px;
    font-size: 15px;
    color: var(--text);
    border-radius: var(--r-md);
}

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

.field__input-wrap:hover {
    border-color: var(--text-soft);
}

.field__input-wrap:focus-within {
    border-color: var(--text);
    box-shadow: 0 0 0 4px var(--ring);
    background: var(--surface);
}

.field__input-wrap:focus-within .field__prefix {
    color: var(--text);
}

.field__hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.field__error {
    margin: 0;
    font-size: 12px;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.field.is-invalid .field__input-wrap {
    border-color: var(--danger);
    background: var(--danger-bg);
    animation: shake 0.35s ease;
}

.field.is-invalid .field__prefix {
    color: var(--danger);
}

/* ---------- Buttons ---------- */
.actions {
    display: flex;
    gap: var(--s-3);
    flex-wrap: wrap;
    margin-top: var(--s-2);
}

.output-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-3);
    margin-top: var(--s-5);
}

@media (max-width: 480px) {
    .output-actions {
        grid-template-columns: 1fr;
    }
}

.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--text);
    --btn-bd: var(--border-strong);

    appearance: none;
    border: 1px solid var(--btn-bd);
    background: var(--btn-bg);
    color: var(--btn-fg);
    padding: 13px 18px;
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.005em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease,
                background-color 0.2s ease,
                color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 4px var(--ring);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn__icon {
    transition: transform 0.25s ease;
}

.btn:hover:not(:disabled) .btn__icon {
    transform: translateX(3px);
}

/* Primário (preto suave) */
.btn--primary {
    --btn-bg: var(--accent);
    --btn-fg: #ffffff;
    --btn-bd: var(--accent);
    flex: 1 1 auto;
    min-width: 180px;
    box-shadow: var(--shadow-sm);
}

.btn--primary:hover:not(:disabled) {
    --btn-bg: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

/* Outline */
.btn--outline {
    --btn-bg: var(--surface);
    --btn-fg: var(--text);
    --btn-bd: var(--border-strong);
}

.btn--outline:hover:not(:disabled) {
    --btn-bg: var(--bg-soft);
    --btn-bd: var(--text-soft);
}

/* Dark (Abrir WhatsApp) */
.btn--dark {
    --btn-bg: var(--accent);
    --btn-fg: #ffffff;
    --btn-bd: var(--accent);
}

.btn--dark:hover:not(:disabled) {
    --btn-bg: var(--accent-hover);
}

/* Ghost (Limpar) */
.btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--text-muted);
    --btn-bd: transparent;
    padding: 13px 14px;
}

.btn--ghost:hover:not(:disabled) {
    --btn-fg: var(--text);
    --btn-bg: var(--bg-soft);
}

/* ---------- Chat preview ---------- */
.chat {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat__header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--s-3) var(--s-4);
    display: flex;
    align-items: center;
    gap: var(--s-3);
}

.chat__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a1f 0%, #3a3a42 100%);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.chat__name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.chat__status {
    margin: 0;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

.chat__body {
    padding: var(--s-5) var(--s-4);
    min-height: 220px;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(15, 15, 20, 0.04) 1px, transparent 0);
    background-size: 14px 14px;
    display: flex;
    align-items: flex-start;
}

.bubble {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px 14px 14px 4px;
    padding: 12px 14px 10px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    max-width: min(420px, 100%);
    box-shadow: var(--shadow-sm);
    position: relative;
    word-break: break-word;
    transition: background 0.3s ease;
    animation: bubblePop 0.4s ease;
}

.bubble__placeholder {
    color: var(--text-soft);
    font-style: italic;
    font-size: 13px;
}

.bubble__content {
    white-space: pre-wrap;
}

.bubble__content b,
.bubble__content strong {
    font-weight: 700;
}

.bubble__content a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.bubble__meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 10px;
    color: var(--text-soft);
    font-feature-settings: "tnum";
}

.bubble__meta svg {
    color: var(--text-soft);
}

/* ---------- Notas ---------- */
.muted-note {
    margin: var(--s-4) 0 0;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.muted-note strong {
    color: var(--text);
    font-weight: 600;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    color: var(--text-soft);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: var(--s-5);
    border-top: 1px solid var(--border);
}

.footer p {
    margin: 0;
}

.footer__credit {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-soft);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: var(--r-pill);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.toast[data-visible="true"] {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes bubblePop {
    0%   { opacity: 0; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
