/* =========================================================
   Chat Hotflixx (FASE EXPERIMENTAL) — estilo Telegram × Hotflixx
   Usado na página do cliente (/c/loja) e no painel do vendedor.
========================================================= */

.hfc {
    --hfc-red: #e50914;
    --hfc-red-2: #ff3b3b;
    --hfc-bg: #0d0d10;
    --hfc-panel: #16161a;
    --hfc-panel-2: #1f1f24;
    --hfc-line: rgba(255, 255, 255, .08);
    --hfc-text: #f3f3f5;
    --hfc-muted: #9b9ba6;
    --hfc-in: #212127;
    --hfc-in-text: #f3f3f5;
    --hfc-out-text: #fff;
    --hfc-tick: #ffd1d1;
    --hfc-read: #7ee0ff;
    --hfc-shadow: 0 1px 1px rgba(0, 0, 0, .25);
    color: var(--hfc-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
    .hfc:not([data-theme="dark"]) {
        --hfc-bg: #eef0f3;
        --hfc-panel: #ffffff;
        --hfc-panel-2: #f3f4f6;
        --hfc-line: rgba(0, 0, 0, .08);
        --hfc-text: #15151a;
        --hfc-muted: #6b6b76;
        --hfc-in: #ffffff;
        --hfc-in-text: #15151a;
        --hfc-shadow: 0 1px 1.5px rgba(0, 0, 0, .12);
    }
}

.hfc[data-theme="light"] {
    --hfc-bg: #eef0f3;
    --hfc-panel: #ffffff;
    --hfc-panel-2: #f3f4f6;
    --hfc-line: rgba(0, 0, 0, .08);
    --hfc-text: #15151a;
    --hfc-muted: #6b6b76;
    --hfc-in: #ffffff;
    --hfc-in-text: #15151a;
    --hfc-shadow: 0 1px 1.5px rgba(0, 0, 0, .12);
}

/* Fundo com padrão discreto (como o Telegram) */
.hfc-wall {
    background-color: var(--hfc-bg);
    background-image:
        radial-gradient(circle at 20% 10%, rgba(229, 9, 20, .10), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(229, 9, 20, .07), transparent 40%),
        radial-gradient(rgba(255, 255, 255, .035) 1px, transparent 1.4px);
    background-size: 100% 100%, 100% 100%, 22px 22px;
}

/* ---------- Mensagens ---------- */

.hfc-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 10px 14px;
}

.hfc-day {
    align-self: center;
    margin: 10px 0 6px;
    padding: 3px 11px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(6px);
}

.hfc-row { display: flex; }
.hfc-row.out { justify-content: flex-end; }
.hfc-row.in { justify-content: flex-start; }
.hfc-row.gap { margin-top: 6px; }

.hfc-bubble {
    position: relative;
    max-width: min(78%, 520px);
    padding: 7px 10px 6px;
    border-radius: 16px;
    box-shadow: var(--hfc-shadow);
    font-size: 15px;
    line-height: 1.38;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.hfc-row.in .hfc-bubble {
    background: var(--hfc-in);
    color: var(--hfc-in-text);
    border-bottom-left-radius: 6px;
}

.hfc-row.out .hfc-bubble {
    background: linear-gradient(135deg, var(--hfc-red-2), var(--hfc-red));
    color: var(--hfc-out-text);
    border-bottom-right-radius: 6px;
}

.hfc-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.hfc-row.in .hfc-bubble a { color: #4fb3ff; }

.hfc-label {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 700;
    color: var(--hfc-red-2);
    white-space: normal;
}

.hfc-meta {
    float: right;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 6px 0 -3px 10px;
    font-size: 11px;
    line-height: 1;
    opacity: .72;
    white-space: nowrap;
}
.hfc-row.out .hfc-meta { color: var(--hfc-tick); opacity: .95; }
.hfc-tick { font-size: 12px; letter-spacing: -3px; padding-right: 3px; }
.hfc-tick.read { color: var(--hfc-read); }
.hfc-row.pending .hfc-meta { opacity: .6; }
.hfc-row.failed .hfc-bubble { outline: 2px solid #ffb020; cursor: pointer; }

/* Anexos */
.hfc-bubble.has-media { padding: 3px; }
.hfc-bubble.has-media .hfc-text { padding: 5px 7px 2px; display: block; }
.hfc-bubble.has-media .hfc-meta { margin-right: 6px; margin-bottom: 2px; }
.hfc-media {
    display: block;
    max-width: 100%;
    width: 100%;
    max-height: 360px;
    border-radius: 13px;
    object-fit: cover;
    background: rgba(0, 0, 0, .25);
    cursor: zoom-in;
}
video.hfc-media { cursor: default; background: #000; }
.hfc-bubble.has-media .hfc-media + .hfc-meta {
    position: absolute;
    right: 9px;
    bottom: 9px;
    float: none;
    margin: 0;
    padding: 3px 6px;
    border-radius: 99px;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    opacity: 1;
}

/* Link do Telegram (mensagem automática) */
.hfc-tg {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 2px;
    padding: 9px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2aabee, #229ed9);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 14px;
    white-space: normal;
}
.hfc-tg svg { flex: 0 0 auto; }
.hfc-tg small { display: block; font-weight: 500; opacity: .85; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }

/* Produto em que o cliente clicou */
.hfc-product {
    align-self: center;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(92%, 420px);
    margin: 8px 0;
    padding: 8px 12px 8px 8px;
    border-radius: 14px;
    background: var(--hfc-panel);
    border: 1px solid var(--hfc-line);
    box-shadow: var(--hfc-shadow);
}
.hfc-product img, .hfc-product .hfc-noimg {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--hfc-panel-2);
}
.hfc-product small { display: block; color: var(--hfc-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.hfc-product strong { display: block; font-size: 14px; line-height: 1.3; }
.hfc-product em { font-style: normal; color: var(--hfc-red-2); font-weight: 800; font-size: 13.5px; }

.hfc-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-left-radius: 6px;
    background: var(--hfc-in);
    box-shadow: var(--hfc-shadow);
}
.hfc-typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hfc-muted);
    animation: hfc-dot 1.2s infinite ease-in-out;
}
.hfc-typing i:nth-child(2) { animation-delay: .15s; }
.hfc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hfc-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

.hfc-note {
    align-self: center;
    max-width: 90%;
    margin: 8px 0;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    font-size: 12.5px;
    text-align: center;
    backdrop-filter: blur(6px);
}

/* ---------- Barra de escrever ---------- */

.hfc-compose {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 10px;
    background: var(--hfc-panel);
    border-top: 1px solid var(--hfc-line);
}
.hfc-field {
    flex: 1;
    display: flex;
    align-items: flex-end;
    min-width: 0;
    border-radius: 22px;
    background: var(--hfc-panel-2);
    border: 1px solid var(--hfc-line);
}
.hfc-field textarea {
    flex: 1;
    min-width: 0;
    max-height: 140px;
    min-height: 22px;
    padding: 11px 14px;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    color: var(--hfc-text);
    font: inherit;
    font-size: 15px;
    line-height: 1.35;
}
.hfc-field textarea::placeholder { color: var(--hfc-muted); }
.hfc-icon-btn {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--hfc-muted);
    cursor: pointer;
}
.hfc-icon-btn:hover { color: var(--hfc-text); }
.hfc-send {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hfc-red-2), var(--hfc-red));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(229, 9, 20, .35);
    transition: transform .12s;
}
.hfc-send:active { transform: scale(.92); }
.hfc-send:disabled { opacity: .5; cursor: default; box-shadow: none; }

.hfc-progress {
    height: 3px;
    background: var(--hfc-line);
}
.hfc-progress i { display: block; height: 100%; width: 0; background: var(--hfc-red); transition: width .2s; }

/* Ecrã inteiro para imagens */
.hfc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .92);
    cursor: zoom-out;
}
.hfc-lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; }
