/* =========================================================
   Hotflixx — FlixxTree (editor) + Encurtador Hotflixx
========================================================= */

.flixx-app { position: relative; }

.fx-top {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); margin-bottom: 14px;
}
.fx-url { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 220px; }
.fx-url a { color: var(--text); font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-url a:hover { text-decoration: underline; }
.fx-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-faint); flex: none; }
.fx-dot.on { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 22%, transparent); }
.fx-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fx-icon-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px;
    border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
    color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.fx-icon-btn:hover { background: var(--surface-3); }
.fx-icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.fx-save { min-width: 160px; }
.fx-save:disabled { opacity: .7; cursor: default; }

.fx-alert { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 600; }
.fx-msg { margin: 0 0 10px; min-height: 0; font-size: 14px; font-weight: 600; }
.fx-msg:empty { display: none; }
.fx-msg[data-kind="ok"] { color: var(--success); }
.fx-msg[data-kind="error"] { color: var(--danger); }

.fx-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.fx-editor { min-width: 0; }

.fx-tabs {
    display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; scrollbar-width: none;
}
.fx-tabs::-webkit-scrollbar { display: none; }
.fx-tabs button {
    flex: 1 0 auto; padding: 9px 14px; border: 0; border-radius: 9px; background: transparent;
    color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.fx-tabs button:hover { color: var(--text); }
.fx-tabs button.on { background: var(--accent); color: var(--on-accent, #fff); }

.fx-h { margin: 22px 0 10px; font-size: 15px; font-weight: 800; color: var(--text); }
.fx-h:first-child { margin-top: 4px; }
.fx-sub { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.fx-note { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }
.fx-empty { padding: 18px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 12px; margin: 0; }

.fx-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.fx-field > span { font-size: 13px; font-weight: 600; color: var(--text-soft, var(--text-muted)); display: flex; justify-content: space-between; gap: 8px; }
.fx-field small { color: var(--text-faint); font-weight: 500; }
.fx-field input[type=text], .fx-field input[type=datetime-local], .fx-field select, .fx-field textarea, .fx-social input, .fx-social select {
    width: 100%; box-sizing: border-box; min-height: 42px; padding: 9px 12px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg-soft, var(--surface-2)); color: var(--text); font: inherit; font-size: 14px;
}
.fx-field textarea { resize: vertical; min-height: 70px; }
.fx-field input:focus, .fx-field select:focus, .fx-field textarea:focus, .fx-social input:focus, .fx-social select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.fx-field input[type=range] { accent-color: var(--accent); width: 100%; }
.fx-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fx-inline { display: flex; gap: 8px; }
.fx-inline input { flex: 1; min-width: 0; }
.fx-upload {
    display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; min-height: 42px; flex: none;
    border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.fx-upload:hover { background: var(--surface-3); }

/* Adicionar */
.fx-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.fx-add-title { font-size: 13px; color: var(--text-muted); font-weight: 700; margin-right: 4px; width: 100%; }
.fx-add-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.fx-add-btn:hover { border-color: var(--accent); }
.fx-add-btn.main { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }

/* Blocos */
.fx-blocks { display: flex; flex-direction: column; gap: 10px; }
.fx-block { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.fx-block.off { opacity: .62; }
.fx-block-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.fx-block-head strong { font-size: 14px; flex: 1; min-width: 0; }
.fx-block-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--text-muted); flex: none; }
.fx-block-tools { display: flex; gap: 2px; }
.fx-block-tools button {
    width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px;
    background: transparent; color: var(--text-muted); cursor: pointer;
}
.fx-block-tools button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.fx-block-tools button.danger:hover { color: var(--danger); }
.fx-block-tools button:disabled { opacity: .3; cursor: default; }
.fx-block-body { padding: 12px; }
.fx-block-body .fx-field:last-child { margin-bottom: 0; }

.fx-more { margin-top: 2px; }
.fx-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); padding: 4px 0 10px; }
.fx-more summary:hover { color: var(--text); }

/* Interruptor */
.fx-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: var(--text-muted); }
.fx-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fx-switch span { width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .2s; }
.fx-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.fx-switch input:checked + span { background: var(--success); }
.fx-switch input:checked + span::after { transform: translateX(14px); }
.fx-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-switch em { font-style: normal; min-width: 62px; }

/* Segmentado */
.fx-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 12px; }
.fx-seg label { padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.fx-seg label.on { background: var(--surface-3); color: var(--text); }
.fx-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fx-seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }

/* Modelos */
.fx-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.fx-theme { border: 0; padding: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; color: var(--text); font: inherit; }
.fx-theme-bg {
    aspect-ratio: 3 / 4; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
    padding: 10px; box-sizing: border-box; border: 2px solid var(--border); transition: border-color .15s, transform .15s; background-size: cover;
}
.fx-theme:hover .fx-theme-bg { transform: translateY(-2px); }
.fx-theme.on .fx-theme-bg { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.fx-theme-bg i { width: 22px; height: 22px; border-radius: 50%; opacity: .85; margin-bottom: 2px; }
.fx-theme-bg b { width: 80%; height: 13px; box-sizing: border-box; }
.fx-theme-name { font-size: 12px; font-weight: 600; text-align: center; }

.fx-color-row { display: flex; gap: 8px; }
.fx-color-row input[type=color] { width: 46px; height: 42px; padding: 3px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; flex: none; }
.fx-color-row input[type=text] { font-family: ui-monospace, monospace; text-transform: lowercase; }

/* Perfil */
.fx-profile { display: flex; gap: 14px; align-items: flex-start; }
.fx-profile-fields { flex: 1; min-width: 0; }
.fx-avatar {
    width: 76px; height: 76px; flex: none; display: grid; place-items: center; overflow: hidden;
    background: var(--surface-3); color: var(--text-muted); font-weight: 800; font-size: 22px; border-radius: 50%;
}
.fx-avatar.square { border-radius: 16px; }
.fx-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fx-socials { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.fx-social { display: grid; grid-template-columns: 150px 1fr 42px; gap: 8px; }
.fx-social .fx-icon-btn { height: 42px; padding: 0; justify-content: center; }

.fx-handle { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-soft, var(--surface-2)); }
.fx-handle em { display: flex; align-items: center; padding: 0 4px 0 12px; font-style: normal; color: var(--text-muted); font-size: 14px; white-space: nowrap; }
.fx-handle input { border: 0 !important; border-radius: 0 !important; padding-left: 0 !important; background: transparent !important; }
.fx-handle:focus-within { outline: 2px solid var(--accent); }
.fx-handle input:focus { outline: none !important; }

.fx-toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 10px; cursor: pointer; }
.fx-toggle input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 2px; flex: none; }
.fx-toggle span { display: flex; flex-direction: column; gap: 2px; }
.fx-toggle strong { font-size: 14px; }
.fx-toggle small { color: var(--text-muted); font-size: 13px; }

/* Estatísticas */
.fx-stats-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.fx-stats-head .fx-h { margin: 4px 0; }
.fx-stats-head .fx-seg { margin: 0; }
.fx-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.fx-kpis div { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.fx-kpis span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.fx-kpis strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.fx-chart { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.fx-chart svg { width: 100%; height: 150px; display: block; }
.fx-chart .v { fill: color-mix(in srgb, var(--text-muted) 55%, transparent); }
.fx-chart .c { fill: var(--accent); }
.fx-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.fx-legend b { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.fx-legend b.v { background: color-mix(in srgb, var(--text-muted) 55%, transparent); }
.fx-legend b.c { background: var(--accent); }
.fx-linkstats { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.fx-linkstats li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 14px; }
.fx-linkstats li:first-child { border-top: 0; }
.fx-linkstats strong { font-variant-numeric: tabular-nums; }

/* Pré-visualização */
.fx-preview-col { position: sticky; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fx-preview-col small { color: var(--text-faint); font-size: 12px; text-align: center; }
.fx-phone {
    width: 100%; max-width: 320px; aspect-ratio: 9 / 18.5; border-radius: 38px; padding: 10px; box-sizing: border-box;
    background: #111; box-shadow: 0 0 0 2px #2a2a2e, 0 20px 50px rgba(0, 0, 0, .35);
}
.fx-phone iframe { width: 100%; height: 100%; border: 0; border-radius: 29px; background: #0b0b0d; display: block; }
.fx-preview-fab { display: none; }

/* Bloqueado */
.fx-locked {
    max-width: 440px; margin: 30px auto; padding: 30px 24px; text-align: center; border: 1px solid var(--border);
    border-radius: 18px; background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.fx-locked-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); }
.fx-locked h3 { margin: 4px 0 0; font-size: 20px; }
.fx-locked p { margin: 0 0 6px; color: var(--text-muted); line-height: 1.5; }

.fx-qr { text-align: center; }
.fx-qr img { width: 220px; height: 220px; image-rendering: pixelated; border-radius: 12px; background: #fff; padding: 8px; margin: 6px auto; display: block; }
.fx-qr p { word-break: break-all; }

@media (max-width: 1000px) {
    .flixx-app { padding-bottom: 76px; }
    .fx-body { grid-template-columns: 1fr; }
    .fx-preview-col { display: none; position: static; }
    .flixx-app.show-preview .fx-preview-col { display: flex; }
    .flixx-app.show-preview .fx-editor { display: none; }
    .fx-preview-fab {
        display: inline-flex; align-items: center; gap: 8px; position: fixed; right: 16px; bottom: 84px; z-index: 40;
        padding: 12px 18px; border-radius: 999px; border: 0; background: var(--accent); color: var(--on-accent, #fff);
        font: inherit; font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); cursor: pointer;
    }
}
@media (max-width: 560px) {
    .fx-grid2 { grid-template-columns: 1fr; }
    .fx-social { grid-template-columns: 1fr 42px; }
    .fx-social select { grid-column: 1 / -1; }
    .fx-kpis { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .fx-kpis strong { font-size: 19px; }
    .fx-icon-btn span { display: none; }
    .fx-save { flex: 1; min-width: 0; }
    .fx-actions { width: 100%; }
    .fx-block-head { flex-wrap: wrap; }
}

/* ---------------- Encurtador Hotflixx ---------------- */

.hfshort, .hfshort-tg { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.hfshort { padding-top: 14px; border-top: 1px solid var(--border); }
.hfshort-head { display: flex; flex-direction: column; gap: 2px; }
.hfshort-head strong { font-size: 14px; }
.hfshort-head small { color: var(--text-muted); font-size: 13px; }
.hfshort-btn {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
    border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text);
    font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.hfshort-btn:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.hfshort-btn:disabled { opacity: .6; cursor: default; }
.hfshort-btn.locked { border-color: var(--border); background: var(--surface-2); color: var(--text-muted); }
.hfshort-link { display: flex; flex-direction: column; gap: 6px; }
.hfshort-url { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.hfshort-icon { color: var(--accent); display: grid; flex: none; }
.hfshort-url input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 700; font-size: 14px; padding: 6px 0; outline: none; }
.hfshort-url .secondary-button { flex: none; min-height: 36px; padding: 0 14px; }
.hfshort-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 13px; color: var(--text-muted); }
.hfshort-linkbtn { border: 0; background: none; padding: 0; color: var(--text); font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; cursor: pointer; }
.hfshort-rename { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hfshort-rename[hidden] { display: none; }
.hfshort-prefix { color: var(--text-muted); font-size: 14px; }
.hfshort-rename input { flex: 1 1 120px; min-width: 0; min-height: 38px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-soft, var(--surface-2)); color: var(--text); font: inherit; }
.hfshort-msg { margin: 0; font-size: 13px; font-weight: 600; }
.hfshort-msg:empty { display: none; }
.hfshort-msg[data-kind="ok"], .hfshort-ok { color: var(--success); }
.hfshort-msg[data-kind="error"] { color: var(--danger); }
.hfshort-ok { margin: 0; font-size: 13px; font-weight: 600; }
