:root {
  --text: #0f172a;
  --muted: #475569;
  --line: #dbe2ef;
  --card: #ffffff;
  --surface: #f1f5f9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 45%),
    radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.13), transparent 40%),
    var(--surface);
}

.container {
  max-width: 1100px;
  margin: 34px auto;
  padding: 0 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: 0 10px 35px rgba(15, 23, 42, 0.08);
}

.hero {
  padding: 36px;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #1e3a8a;
  background: #dbeafe;
  margin-bottom: 14px;
}

h1,
h2 {
  margin: 0 0 12px;
}

p {
  margin: 0 0 10px;
  color: var(--muted);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #ecf0f6;
  text-align: left;
  padding: 12px 8px;
  vertical-align: middle;
}

th {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 14px;
}

input,
textarea,
select,
button {
  font-size: 14px;
  padding: 11px 12px;
  border-radius: 10px;
}

input,
textarea {
  border: 1px solid #cdd6e4;
  background: #ffffff;
  color: #0f172a;
}

select {
  border: 1px solid #cdd6e4;
  background: #ffffff;
  color: #0f172a;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

button {
  cursor: pointer;
  border: none;
  background: linear-gradient(120deg, var(--primary), #3b82f6);
  color: #fff;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

button.danger {
  background: linear-gradient(120deg, #dc2626, #ef4444);
}

.inline {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.inline input {
  width: auto;
}

.color-chip {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
}

.login-card {
  max-width: 420px;
  margin: 24px auto;
}

.error-text {
  color: #dc2626;
}

.presell-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  min-height: 240px;
  border: none;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.24), transparent 35%),
    linear-gradient(145deg, var(--psg-bg, #0f172a), var(--psg-accent, #7c3aed));
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.12), rgba(15, 23, 42, 0.5));
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.hero-content h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.1;
}

.hero-content p {
  color: rgba(255, 255, 255, 0.9);
  max-width: 620px;
  font-size: 17px;
}

.hero-logo {
  max-height: 54px;
  width: auto;
  object-fit: contain;
  margin-bottom: 16px;
}

.cookie-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.cookie-modal-inline {
  background: rgba(2, 6, 23, 0.38);
  backdrop-filter: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  z-index: 4;
}

.cookie-pos-center {
  align-items: center;
  justify-content: center;
}

.form-grid-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-grid-vertical label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.color-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.form-actions-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

/* Admin Layout */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 24px;
}

.stats-overview {
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stat-box {
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

.text-center {
  text-align: center;
}

.conversion-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.conversion-badge.high {
  background: #dcfce7;
  color: #166534;
}

.conversion-badge.normal {
  background: #f1f5f9;
  color: #475569;
}

.public-link {
  font-family: monospace;
  font-size: 13px;
  color: var(--primary);
}

.btn-copy-url.mini {
  padding: 4px 8px;
  font-size: 11px;
}

.table-container {
  overflow-x: auto;
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    order: -1;
    position: static;
  }
}

.admin-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-header-flex h1 {
  margin: 0;
}

/* Tabs System */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 2px;
}

.tab-btn {
  background: transparent;
  color: #64748b;
  padding: 10px 20px;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  transform: none;
}

.tab-btn.active {
  background: #fff;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  border-radius: 8px 8px 0 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

button.danger:hover {
  background: #b91c1c;
}

button.warning {
  background: #f59e0b;
  color: #fff;
}

button.warning:hover {
  background: #d97706;
}

button.mini {
  padding: 6px 12px;
  font-size: 12px;
}

.stat-value.success {
  color: #16a34a;
}

.stat-value.danger {
  color: #dc2626;
}

hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 16px 0;
}

.webhook-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.webhook-box {
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.webhook-box h4 {
  margin: 0 0 8px;
  color: #0f172a;
}

.webhook-box p {
  font-size: 13px;
  margin-bottom: 8px;
}

.webhook-box code {
  display: block;
  background: #fff;
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  border: 1px solid #cbd5e1;
  word-break: break-all;
  color: var(--primary);
}

.pixel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

@media (max-width: 400px) {
  .pixel-row {
    grid-template-columns: 1fr;
  }
}

.pixel-row label {
  min-width: 0; /* Permite que o flex/grid encolha */
}

.pixel-row input {
  width: 100%;
  min-width: 0;
}

/* Device Switcher for Preview */
.preview-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 10px;
  width: fit-content;
}

.device-btn {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.device-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: none;
}

.device-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mirror-preview-stage {
  transition: all 0.3s ease;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 500px;
}

.mirror-preview-stage.mobile {
  width: 375px;
  height: 667px;
  border-radius: 24px;
  border: 8px solid #0f172a;
  min-height: auto;
}

.live-mirror-preview {
  width: 100%;
  height: 100%;
  border: none;
}

.webhook-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-copy-webhook {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  text-align: center;
}

.btn-copy-webhook:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-copy-webhook.hotmart { color: #f04e23; }
.btn-copy-webhook.kiwify { color: #5d5fef; }
.btn-copy-webhook.braip { color: #00a859; }

.title-with-action {
  display: flex;
  align-items: center;
  gap: 16px;
}

.title-with-action h2 {
  margin: 0;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-primary.mini {
  padding: 6px 12px;
  font-size: 13px;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filters-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-input {
  min-width: 200px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 14px;
}

.filter-select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .filters-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .filters-bar {
    width: 100%;
  }
  .filter-input, .filter-select {
    flex: 1;
    min-width: 0;
  }
}

.tab-btn.help-tab {
  margin-left: auto;
  color: #0f172a;
  background: #f1f5f9;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.help-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.help-card h3 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
}

.help-card ul, .help-card ol {
  padding-left: 20px;
  margin: 0;
}

.help-card li {
  margin-bottom: 8px;
  font-size: 14px;
  color: #475569;
}

.welcome-card {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
}

.quick-links {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-link-action {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-link-action.secondary {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-link-action:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.text-muted {
  color: #94a3b8;
  font-size: 11px;
}

.cookie-pos-bottom {
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 34px;
}

.cookie-box {
  max-width: 560px;
  width: 100%;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 22px;
  box-shadow: 0 16px 50px rgba(2, 6, 23, 0.25);
}

.cookie-box-inline {
  max-width: 760px;
  background: #e6ebf0;
  border-radius: 2px;
  position: relative;
  pointer-events: auto;
}

.cookie-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: #2563eb;
  padding: 2px 4px;
  font-size: 14px;
  font-weight: 600;
}

.cookie-close-btn:hover {
  text-decoration: underline;
  transform: none;
}

.cookie-actions {
  margin: 18px 0;
}

.cookie-box-inline .cookie-actions button {
  border-radius: 0;
  padding: 8px 14px;
  min-width: 86px;
}

.mirror-page {
  margin: 0;
  background: #0b1220;
}

.mirror-shell {
  position: relative;
  height: 100vh;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.mirror-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.theme-default .cookie-box-inline {
  background: #e6ebf0;
}

.theme-custom .cookie-box-inline {
  background: color-mix(in srgb, var(--psg-accent, #7c3aed) 14%, #ffffff 86%);
}

.theme-custom .cookie-modal-inline {
  background: color-mix(in srgb, var(--psg-bg, #0f172a) 50%, transparent 50%);
}

.presell-info {
  background: #f8fafc;
  padding: 80px 16px 60px; /* Aumentado padding superior para dar mais espaço */
}

.presell-info-wrap {
  max-width: 980px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #dbe2ef;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.presell-info-wrap h1 {
  margin: 0 0 14px;
}

.info-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.info-kicker {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #1e3a8a;
  background: #dbeafe;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.info-block {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fcfdff;
  padding: 14px;
  margin: 0 0 14px;
}

.presell-info-wrap h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.presell-info-wrap h3 {
  margin: 14px 0 6px;
  font-size: 16px;
}

.presell-info-wrap ul {
  margin: 0 0 10px;
  padding-left: 20px;
  color: #334155;
}

.presell-legal-links {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
}

.iframe-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.78);
  z-index: 8;
  padding: 16px;
}

.iframe-fallback-box {
  max-width: 520px;
  width: 100%;
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #dbe2ef;
}

.iframe-fallback-box h3 {
  margin: 0 0 10px;
}

.preview-stage {
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  padding: 14px;
  background: #f8fafc;
}

.mirror-preview-stage {
  min-height: 560px;
  padding: 0;
  overflow: hidden;
}

.live-mirror-preview {
  width: 100%;
  height: 560px;
  border: 0;
  background: #fff;
}

.preview-hero {
  min-height: 180px;
  margin-bottom: 12px;
}

.cookie-preview {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
}

.cookie-preview h3 {
  margin: 0 0 8px;
}

.cookie-preview button[disabled] {
  margin-top: 8px;
  opacity: 0.95;
  cursor: not-allowed;
}

.preview-url {
  margin-top: 12px;
  font-size: 13px;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.table-actions form {
  margin: 0;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #cdd6e4;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.btn-link:hover {
  background: #f8fafc;
  text-decoration: none;
}

.btn-copy-url {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #cdd6e4;
  background: #fff;
  color: #1e293b;
  font-size: 12px;
  font-weight: 700;
}

.btn-copy-url:hover {
  background: #f8fafc;
  transform: none;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-save {
  min-width: 180px;
  background: linear-gradient(120deg, #16a34a, #22c55e);
}

.btn-preview {
  min-width: 210px;
  background: linear-gradient(120deg, #2563eb, #3b82f6);
}

.embed-check-status {
  min-height: 20px;
  font-size: 13px;
  margin-top: 10px;
}

.embed-check-status.info {
  color: #334155;
}

.embed-check-status.ok {
  color: #15803d;
}

.embed-check-status.warn {
  color: #b45309;
}

.embed-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.embed-badge.ok {
  color: #166534;
  background: #dcfce7;
}

.embed-badge.blocked {
  color: #b91c1c;
  background: #fee2e2;
}

.embed-badge.unknown {
  color: #475569;
  background: #e2e8f0;
}

@media (max-width: 760px) {
  .container {
    margin: 20px auto;
  }

  .card {
    padding: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .live-mirror-preview {
    height: 420px;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .mirror-shell {
    height: 68vh;
    min-height: 420px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}
