/* ============================================================
   SIMILAR FACE — CSS (módulo ISOLADO, ETAPA 1 — INTERFACE)
   ============================================================
   Tema: dark elegante + AZUL-CLARO / AZUL-CELESTE (sem roxo).
   Tudo namespaced sob .sf- (Similar Face). Nenhuma regra global.
   Layout DESKTOP: [FOTO] | [SELEÇÃO] lado a lado.
   Layout MOBILE:  empilhado, botões grandes, sem rolagem horizontal.
   ============================================================ */

.sf-host {
  position: fixed;
  inset: 0;
  z-index: 99997;
  display: none;
}
.sf-host.sf-open { display: block; }

/* Fundo escuro elegante com brilho azul-celeste */
.sf-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1100px 640px at 15% 8%, rgba(56, 189, 248, 0.16), transparent 62%),
    radial-gradient(900px 560px at 88% 92%, rgba(125, 211, 252, 0.10), transparent 58%),
    linear-gradient(165deg, #05080f 0%, #070c16 48%, #04070c 100%);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.sf-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 18px 80px;
  min-height: 100%;
  box-sizing: border-box;
}

/* ===== CABEÇALHO ===== */
.sf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.sf-head-center {
  flex: 1 1 320px;
  text-align: center;
  min-width: 0;
}
.sf-head-center h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 3px;
  font-weight: 800;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 18px rgba(56, 189, 248, 0.55);
}
.sf-head-center p {
  margin: 6px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: #9ec9e6;
}
.sf-back {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(125, 211, 252, 0.38);
  background: rgba(10, 20, 34, 0.8);
  color: #cfeaff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .18s ease;
}
.sf-back:hover {
  border-color: rgba(125, 211, 252, 0.9);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.45);
  color: #fff;
}
.sf-back svg { width: 16px; height: 16px; }
.sf-head-spacer { flex: 0 0 auto; width: 118px; }

/* ===== ÁREA PRINCIPAL ===== */
.sf-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.sf-panel {
  background: linear-gradient(180deg, rgba(11, 20, 33, 0.92), rgba(7, 13, 23, 0.94));
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  box-sizing: border-box;
}
.sf-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.sf-panel-title h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #bfe4ff;
}
.sf-step {
  font-size: 11px;
  color: #7fb6d6;
  border: 1px solid rgba(125, 211, 252, 0.28);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Quadro da FOTO selecionada (esquerda) */
.sf-photo-frame {
  position: relative;
  border-radius: 16px;
  border: 2px solid rgba(125, 211, 252, 0.45);
  background: #04070d;
  min-height: 320px;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(56, 189, 248, 0.10);
}
.sf-photo-frame img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #04070d;
}
.sf-photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px;
  text-align: center;
  color: #6f9ab8;
}
.sf-photo-empty svg { width: 46px; height: 46px; color: #4f9dc9; }
.sf-photo-empty strong {
  font-size: 13px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #a9d6f2;
}
.sf-photo-empty span { font-size: 12px; max-width: 240px; }

.sf-photo-badge {
  position: absolute;
  top: 10px; left: 10px;
  font-size: 10.5px;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  color: #04121b;
  background: linear-gradient(90deg, #7dd3fc, #bae6fd);
  box-shadow: 0 0 14px rgba(125, 211, 252, 0.55);
}
.sf-photo-remove {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(5, 10, 16, 0.72);
  color: #ffd3d3;
  font-size: 16px;
  cursor: pointer;
  transition: all .18s ease;
}
.sf-photo-remove:hover {
  background: rgba(255, 60, 60, 0.25);
  border-color: rgba(255, 90, 90, 0.8);
}

/* Quadro de SELEÇÃO (direita) — borda azul-clara tracejada */
.sf-drop {
  position: relative;
  border: 2px dashed rgba(125, 211, 252, 0.65);
  border-radius: 16px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 22px;
  cursor: pointer;
  transition: all .2s ease;
  background:
    repeating-linear-gradient(45deg, rgba(56, 189, 248, 0.05) 0 12px, transparent 12px 24px),
    radial-gradient(420px 320px at 50% 40%, rgba(56, 189, 248, 0.12), transparent 70%);
  overflow: hidden;
  box-sizing: border-box;
}
.sf-drop:hover, .sf-drop.sf-dragover {
  border-color: rgba(186, 230, 253, 0.98);
  box-shadow: 0 0 26px rgba(56, 189, 248, 0.42), inset 0 0 26px rgba(56, 189, 248, 0.16);
}
.sf-drop-ico {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #a5e4ff;
  border: 2px solid rgba(125, 211, 252, 0.55);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.45), inset 0 0 18px rgba(56, 189, 248, 0.2);
  animation: sfPulse 2.6s ease-in-out infinite;
}
.sf-drop-ico svg { width: 32px; height: 32px; }
.sf-drop strong {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #eaf7ff;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}
.sf-drop span { font-size: 12px; color: #8fb8d4; max-width: 260px; }
.sf-file { display: none; }

/* Miniaturas abaixo da área de seleção */
.sf-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.sf-thumb {
  flex: 0 0 auto;
  width: 62px; height: 62px;
  border-radius: 12px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  background: rgba(8, 16, 27, 0.9);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: all .18s ease;
}
.sf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sf-thumb:hover, .sf-thumb.sf-active {
  border-color: rgba(186, 230, 253, 0.95);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.55);
  transform: translateY(-2px);
}

/* Botão principal */
.sf-actions { margin-top: 14px; }
.sf-btn {
  width: 100%;
  border-radius: 12px;
  padding: 15px 18px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .18s ease;
}
.sf-btn-primary {
  color: #02121a;
  background: linear-gradient(90deg, #38bdf8, #bae6fd);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.5);
}
.sf-btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 0 32px rgba(125, 211, 252, 0.8);
}
.sf-btn-primary:disabled {
  opacity: .42;
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== ÁREA INFERIOR ===== */
.sf-bottom {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.sf-status-card {
  background: linear-gradient(180deg, rgba(11, 20, 33, 0.9), rgba(7, 13, 23, 0.92));
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 16px;
  padding: 14px 16px;
  box-sizing: border-box;
}
.sf-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.sf-status-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #bfe4ff;
  font-weight: 700;
}
.sf-spinner {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(125, 211, 252, 0.25);
  border-top-color: #7dd3fc;
  animation: sfSpin .9s linear infinite;
  display: none;
}
.sf-status-card.sf-busy .sf-spinner { display: inline-block; }
.sf-status-pct {
  font-size: 13px;
  font-weight: 800;
  color: #bae6fd;
  letter-spacing: 1px;
}
.sf-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.12);
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.18);
}
.sf-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #bae6fd);
  box-shadow: 0 0 16px rgba(125, 211, 252, 0.75);
  transition: width .35s ease;
}
.sf-status-msg {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: #8fb8d4;
  min-height: 18px;
}
.sf-status-msg.sf-warn { color: #ffd9a8; }

/* ===== RESULTADOS ===== */
.sf-results-section {
  background: linear-gradient(180deg, rgba(11, 20, 33, 0.9), rgba(7, 13, 23, 0.92));
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
}
.sf-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.sf-results-head h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #bfe4ff;
}
.sf-demo-tag {
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 800;
  color: #04121b;
  background: linear-gradient(90deg, #7dd3fc, #bae6fd);
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.5);
}
.sf-results-empty {
  font-size: 12.5px;
  color: #7fa6c4;
  padding: 18px 4px;
  text-align: center;
}
.sf-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.sf-result-card {
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  background: rgba(8, 16, 27, 0.92);
  padding: 8px;
  cursor: pointer;
  transition: all .18s ease;
  text-align: left;
  box-sizing: border-box;
}
.sf-result-card:hover, .sf-result-card.sf-selected {
  border-color: rgba(186, 230, 253, 0.95);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.45);
  transform: translateY(-2px);
}
.sf-result-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #04070d;
  display: grid;
  place-items: center;
  color: #4f9dc9;
}
.sf-result-thumb svg { width: 34px; height: 34px; }
.sf-result-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sf-result-pct {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 800;
  color: #bae6fd;
  letter-spacing: 0.5px;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
}
.sf-result-name {
  font-size: 11.5px;
  color: #9ec9e6;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sf-result-demo {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 9px;
  letter-spacing: 0.8px;
  font-weight: 800;
  text-transform: uppercase;
  color: #04121b;
  background: rgba(186, 230, 253, 0.95);
  padding: 2px 7px;
  border-radius: 999px;
}

/* Área de detalhes do resultado selecionado */
.sf-detail {
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid rgba(125, 211, 252, 0.3);
  background: rgba(6, 12, 21, 0.95);
  padding: 14px;
  display: none;
  gap: 14px;
  align-items: center;
  box-sizing: border-box;
}
.sf-detail.sf-show { display: flex; }
.sf-detail-thumb {
  flex: 0 0 auto;
  width: 92px; height: 92px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.4);
  background: #04070d;
  display: grid;
  place-items: center;
  color: #4f9dc9;
}
.sf-detail-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sf-detail-info { min-width: 0; }
.sf-detail-info h4 {
  margin: 0 0 4px;
  font-size: 14px;
  color: #eaf7ff;
  letter-spacing: 0.6px;
}
.sf-detail-info p {
  margin: 0;
  font-size: 12px;
  color: #8fb8d4;
  line-height: 1.5;
}
.sf-detail-pct {
  font-size: 20px;
  font-weight: 800;
  color: #bae6fd;
  margin-top: 6px;
  text-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
}

/* ===== ANIMAÇÕES ===== */
@keyframes sfPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(56, 189, 248, 0.35), inset 0 0 14px rgba(56, 189, 248, 0.15); }
  50% { box-shadow: 0 0 30px rgba(125, 211, 252, 0.65), inset 0 0 22px rgba(56, 189, 248, 0.3); }
}
@keyframes sfSpin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 860px) {
  .sf-main { grid-template-columns: 1fr; }
  .sf-head-spacer { display: none; }
  .sf-head-center { order: -1; flex-basis: 100%; }
  .sf-header { justify-content: center; }
  .sf-back { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .sf-shell { padding: 16px 12px 70px; }
  .sf-head-center h1 { font-size: 21px; letter-spacing: 2px; }
  .sf-photo-frame, .sf-drop { min-height: 240px; }
  .sf-btn { padding: 17px 16px; font-size: 14.5px; }
  .sf-results-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .sf-detail { flex-direction: column; text-align: center; }
  .sf-detail-thumb { width: 110px; height: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  .sf-drop-ico, .sf-spinner { animation: none; }
  .sf-progress-bar, .sf-result-card, .sf-thumb { transition: none; }
}
