/* ==========================================================================
   ESTILOS OFICIAIS - GERADOR DE FOTO COM MOLDURA LIA NOGUEIRA 45101
   Identidade Visual: Azul Royal, Amarelo Ouro, Branco e Marinho Profundo
   ========================================================================== */

:root {
  --bg-deep: #051329;
  --bg-surface: #0a1f42;
  --bg-card: #0e2a59;
  --bg-card-hover: #143772;
  --border-subtle: #1c4587;
  --border-active: #ffb800;

  --color-primary: #004cbf;
  --color-primary-light: #236fe4;
  --color-yellow: #ffb800;
  --color-yellow-hover: #e6a500;
  --color-yellow-glow: rgba(255, 184, 0, 0.4);

  --text-white: #ffffff;
  --text-secondary: #a3c1ed;
  --text-muted: #6b8cb8;

  --whatsapp-color: #25d366;
  --whatsapp-hover: #1eb956;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 76, 191, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 50% 0%, #10336e 0%, transparent 60%),
    radial-gradient(circle at 10% 40%, #082048 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, #0c295c 0%, transparent 50%);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   1. HEADER FULL-WIDTH (Preenche 100% da tela)
   -------------------------------------------------------------------------- */
.header {
  width: 100%;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 31, 66, 0.95);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
}

.header-inner {
  width: 100%;
  max-width: 1100px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
  color: var(--text-white);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-yellow);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #5af09d;
  background: rgba(90, 240, 157, 0.12);
  border: 1px solid rgba(90, 240, 157, 0.28);
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   2. CONTAINER PRINCIPAL (Responsivo & Espaçoso no Desktop)
   -------------------------------------------------------------------------- */
.main-container {
  width: 100%;
  max-width: 740px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

/* PASSO A PASSO */
.instructions-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
}

.instructions-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.step-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  flex: 1;
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--text-white);
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-yellow);
}

.step-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.step-arrow {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: -16px;
}

.instructions-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  color: #7ee8b0;
  text-align: center;
}

/* SELETOR DE MOLDURAS */
.frames-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg {
  color: var(--color-yellow);
}

.frames-carousel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.frame-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle);
  background: #081a38;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.frame-item:hover {
  transform: translateY(-3px);
  border-color: var(--color-primary-light);
}

.frame-item.active {
  border-color: var(--color-yellow);
  box-shadow: 0 0 20px var(--color-yellow-glow);
  transform: scale(1.02);
}

.frame-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.frame-item-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(6, 21, 45, 0.92);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  padding: 6px 2px;
  color: var(--text-white);
  backdrop-filter: blur(4px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-item.active .frame-item-badge {
  background: var(--color-yellow);
  color: #06152d;
}

/* ÁREA DO CANVAS / EDITOR */
.editor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.editor-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 184, 0, 0.15);
  color: var(--color-yellow);
  border: 1px solid rgba(255, 184, 0, 0.35);
}

.editor-badge.ready {
  background: rgba(90, 240, 157, 0.15);
  color: #5af09d;
  border-color: rgba(90, 240, 157, 0.35);
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #06142a;
  border: 2px solid var(--border-subtle);
  touch-action: none;
  user-select: none;
  cursor: grab;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
}

.canvas-wrapper.has-photo {
  border-color: var(--border-subtle);
}

.canvas-wrapper:active {
  cursor: grabbing;
}

#perfilCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Overlay inicial para upload */
.canvas-upload-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(circle, rgba(14, 42, 89, 0.85) 0%, rgba(6, 21, 45, 0.94) 100%);
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  padding: 24px;
  text-align: center;
}

.canvas-upload-overlay:hover {
  background: radial-gradient(circle, rgba(20, 55, 114, 0.9) 0%, rgba(8, 27, 58, 0.98) 100%);
}

.upload-icon-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid var(--color-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px var(--color-yellow-glow);
  animation: pulse 2.2s infinite;
}

.upload-icon-circle svg {
  color: #ffffff;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.upload-overlay-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-white);
}

.upload-overlay-sub {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

/* Dicas Rápidas */
.quick-tips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quick-tip-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Controles Rápidos */
.canvas-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-ctrl {
  background: #0a2046;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-ctrl:hover {
  background: var(--bg-card-hover);
  color: var(--text-white);
  border-color: var(--color-primary-light);
}

.btn-ctrl:active {
  transform: scale(0.96);
}

.btn-ctrl.active {
  background: var(--color-primary);
  color: var(--text-white);
  border-color: var(--color-yellow);
}

/* BOTÕES DE AÇÃO */
.actions-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-accent {
  width: 100%;
  background: linear-gradient(135deg, #ffcc00 0%, #ff9e00 100%);
  color: #051329;
  border: none;
  font-family: var(--font-main);
  font-size: 1.12rem;
  font-weight: 800;
  padding: 17px 24px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(255, 184, 0, 0.4);
  transition: all 0.2s ease;
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255, 184, 0, 0.55);
}

.btn-accent:active {
  transform: translateY(0);
}

.btn-whatsapp {
  width: 100%;
  background: var(--whatsapp-color);
  color: #ffffff;
  border: none;
  font-family: var(--font-main);
  font-size: 1.02rem;
  font-weight: 700;
  padding: 15px 24px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.32);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-whatsapp:hover {
  background: var(--whatsapp-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  width: 100%;
  background: #0d2854;
  border: 1px solid var(--border-subtle);
  color: var(--text-white);
  font-family: var(--font-main);
  font-size: 0.96rem;
  font-weight: 600;
  padding: 14px 22px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   3. RODAPÉ FULL-WIDTH (Preenche 100% da tela)
   -------------------------------------------------------------------------- */
.footer {
  width: 100%;
  border-top: 1px solid var(--border-subtle);
  background: rgba(5, 17, 38, 0.96);
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.footer-inner {
  width: 100%;
  max-width: 1100px;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.footer-campaign {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: 0.3px;
}

.footer-campaign span {
  color: var(--color-yellow);
}

.footer-cnpj {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: #0a1f42;
  border: 1px solid var(--border-subtle);
  padding: 5px 14px;
  border-radius: var(--radius-sm);
}

.footer-disclaimer {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 520px;
}

.footer-lgpd {
  font-size: 0.74rem;
  color: #6edaa0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* MODAL DE RESULTADO / IPHONE */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 22, 0.88);
  backdrop-filter: blur(10px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 440px;
  width: 100%;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
  animation: modalScale 0.22s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-white);
}

.btn-close-modal {
  background: #112d59;
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-close-modal:hover {
  color: var(--text-white);
  background: var(--color-primary);
}

.modal-preview-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 3px solid var(--color-yellow);
  background: #051329;
}

.modal-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-ios-hint {
  background: rgba(255, 184, 0, 0.12);
  border: 1px solid rgba(255, 184, 0, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.78rem;
  color: #ffe699;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0e2a59;
  border: 1px solid var(--color-yellow);
  color: var(--text-white);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 1100;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast svg {
  color: var(--color-yellow);
}

/* MEDIA QUERIES PARA TELAS MAIORES */
@media (min-width: 768px) {
  .main-container {
    max-width: 760px;
    padding: 32px 20px;
    gap: 24px;
  }
  .brand-logo-img {
    height: 48px;
  }
  .brand-title {
    font-size: 1.25rem;
  }
  .brand-subtitle {
    font-size: 0.82rem;
  }
  .frames-carousel {
    gap: 18px;
  }
  .editor-card {
    padding: 26px;
  }
  .btn-ctrl {
    font-size: 0.86rem;
    padding: 11px 16px;
  }
}
