@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal: #00e5c8;
  --teal-dim: rgba(0,229,200,0.12);
  --bg: #070e0d;
  --bg2: #0d1714;
  --surface: rgba(255,255,255,0.04);
  --border: rgba(0,229,200,0.14);
  --text: #e2f0ee;
  --muted: #5a8880;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
}

/* ── Layout duas colunas ── */
.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 560px) 480px;
  min-height: 100vh;
  justify-content: center;
}

/* ── COLUNA FORMULÁRIO ── */
.col-form {
  padding: 60px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  width: 100%;
}

.form-header {
  margin-bottom: 44px;
}

.brand-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 14px;
}

.form-header h1 {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 10px;
}

.form-header h1 span {
  color: var(--teal);
}

.form-header p {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
}

/* ── Campos ── */
.form-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"],
input[type="tel"],
select {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  appearance: none;
}

input[type="text"]:focus,
input[type="tel"]:focus,
select:focus {
  border-color: var(--teal);
  background: rgba(0,229,200,0.05);
}

input::placeholder { color: #2e4a46; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2300e5c8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-color: var(--surface);
  padding-right: 36px;
  cursor: pointer;
}

select option { background: #0d1714; color: var(--text); }

/* ── Upload foto ── */
.photo-drop {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface);
}

.photo-drop:hover {
  border-color: var(--teal);
  background: var(--teal-dim);
}

#photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--teal);
  display: none;
  margin: 0 auto 8px;
}

#photo-preview.visible { display: block; }

.photo-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.photo-hint span { font-size: 13px; font-weight: 500; }
.photo-hint small { font-size: 11px; opacity: 0.6; }

/* ── Botão download ── */
.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px;
  background: var(--teal);
  color: #000;
  border: none;
  border-radius: 10px;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.3px;
  margin-top: 4px;
}

.btn-download:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

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

/* ── Erro ── */
.error-msg {
  display: none;
  padding: 12px 16px;
  background: rgba(220,60,60,0.08);
  border: 1px solid rgba(220,60,60,0.25);
  border-radius: 8px;
  color: #e07070;
  font-size: 13px;
}

.error-msg.visible { display: block; }

/* ── COLUNA PRÉ-VISUALIZAÇÃO ── */
.col-preview {
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 32px;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.preview-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--muted);
  align-self: flex-start;
}

/* ── Card preview ── */
.card-preview-wrap {
  width: 220px;
  flex-shrink: 0;
  perspective: 900px;
}

@keyframes cardFlip {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

.card-preview.flipping {
  animation: cardFlip 0.5s ease;
}

.card-preview {
  position: relative;
  width: 220px;
  height: 440px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}

.cp-bg {
  position: absolute;
  inset: 0;
  background: url('/backgrounds/Background%201.png') center top / cover no-repeat;
  z-index: 0;
  transition: background-image 0.3s;
}

.cp-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.00) 0%,
    rgba(0,0,0,0.05) 20%,
    rgba(0,6,5,0.60) 42%,
    rgba(0,6,5,0.92) 58%,
    rgba(0,6,5,0.99) 100%
  );
  z-index: 1;
}

.cp-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 108px 14px 14px;
}

.cp-avatar-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin-bottom: 8px;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.cp-avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: none;
}

.cp-avatar-ring img.visible { display: block; }

.cp-avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1a2a28;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-avatar-placeholder.hidden { display: none; }

.cp-name {
  font-size: 11px;
  font-weight: 700;
  color: #00e5c8;
  text-align: center;
  margin-bottom: 2px;
}

.cp-role {
  font-size: 8px;
  font-weight: 400;
  color: #aaa;
  text-align: center;
  margin-bottom: 10px;
}

.cp-btn {
  width: 100%;
  padding: 5px 8px;
  border-radius: 20px;
  border: none;
  background: #00ffe0;
  color: #000;
  font-size: 8px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.cp-stores {
  font-size: 6.5px;
  color: #888;
  text-align: center;
  line-height: 1.5;
  margin-top: 2px;
  margin-bottom: 8px;
}

.cp-icons {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.cp-icon-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 0.5px solid rgba(255,255,255,0.15);
}

.cp-footer {
  margin-top: 8px;
  text-align: center;
}

.cp-footer-tagline {
  font-size: 6.5px;
  font-weight: 600;
  color: #00e5c8;
  text-align: center;
}

/* ── Seletor de tema ── */
.theme-selector {
  width: 100%;
}

.theme-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.theme-opt {
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(0,229,200,0.12);
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}

.theme-opt:hover {
  border-color: rgba(0,229,200,0.4);
  transform: translateY(-2px);
}

.theme-opt.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0,229,200,0.2);
}

.theme-opt img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.theme-opt span {
  display: block;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  padding: 6px 0;
  background: rgba(0,0,0,0.4);
  letter-spacing: 1px;
}

.theme-opt.selected span { color: var(--teal); }

/* ── Loading ── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7,14,13,0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.loading-overlay.active { display: flex; }

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 56px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 2.5px solid rgba(0,229,200,0.15);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-box p { font-size: 14px; color: var(--muted); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Validação inline ── */
.field-group.valid input,
.field-group.valid select,
.field-group.valid .photo-drop {
  border-color: var(--teal);
  background: rgba(0,229,200,0.04);
}

.field-group.invalid input,
.field-group.invalid select,
.field-group.invalid .photo-drop {
  border-color: #e05555;
  background: rgba(220,60,60,0.04);
}

/* ── Progresso no botão ── */
.btn-download {
  position: relative;
  overflow: hidden;
}

.btn-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: rgba(0,0,0,0.28);
  transition: width 0.4s ease;
  pointer-events: none;
}

.btn-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
}

/* ── Shimmer avatar ── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.cp-avatar-ring.shimmer {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.04) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.2s infinite linear;
}

/* ── Fade nome/cargo no preview ── */
.cp-name, .cp-role {
  transition: opacity 0.12s ease;
}

.cp-name.fading, .cp-role.fading {
  opacity: 0.2;
}

/* ── Responsivo ── */
@media (max-width: 900px) {
  .page-layout {
    grid-template-columns: 1fr;
  }
  .col-form {
    padding: 40px 24px;
    max-width: 100%;
    justify-self: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .col-preview {
    position: static;
    height: auto;
    padding: 32px 24px 48px;
  }
}
