/* ============================================
   AtivaApps — CSS Principal
   ============================================ */

:root {
  --brand:    #00E5A0;
  --brand2:   #00B4D8;
  --bg:       #080C10;
  --surface:  #0E1318;
  --surface2: #141B22;
  --border:   rgba(255,255,255,0.07);
  --text:     #E8EDF2;
  --muted:    #6B7A8D;
  --danger:   #FF6B6B;
  --success:  #00E5A0;
  --warn:     #FFB347;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1,h2,h3,h4 { font-family: 'Syne', sans-serif; }

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

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

/* ---- HEADER ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  background: rgba(8,12,16,0.92);
  backdrop-filter: blur(12px);
}
.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 18px;
  color: var(--text); text-decoration: none;
}
.logo-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #080C10;
}
.brand { background: linear-gradient(135deg,var(--brand),var(--brand2)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.header-badges { display: flex; gap: 6px; font-size: 13px; color: var(--muted); }
.sep { margin: 0 4px; }

/* ---- FOOTER ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 80px;
}

/* ---- HERO ---- */
.hero {
  padding: 72px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-60%);
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,160,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,229,160,0.1);
  border: 1px solid rgba(0,229,160,0.2);
  border-radius: 20px; padding: 5px 16px;
  margin-bottom: 24px;
  font-size: 13px; color: var(--brand);
  font-family: 'Syne', sans-serif; font-weight: 600;
}
.hero h1 {
  font-size: clamp(34px, 6vw, 60px);
  font-weight: 800; line-height: 1.1;
  margin-bottom: 20px;
}
.hero p {
  color: var(--muted); font-size: 18px;
  line-height: 1.6; margin-bottom: 36px;
}
.hero-features {
  display: flex; gap: 28px; justify-content: center;
  flex-wrap: wrap; font-size: 14px; color: var(--muted);
}
.hero-features span { display: flex; align-items: center; gap: 6px; }
.hero-features i { color: var(--brand); font-style: normal; }

/* ---- GRID DE APPS ---- */
.section { padding: 0 0 80px; }
.search-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px;
}
.search-wrap { position: relative; flex: 1; max-width: 380px; }
.search-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%); color: var(--muted); font-size: 17px;
  pointer-events: none;
}
.apps-count { color: var(--muted); font-size: 14px; }
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; flex-direction: column; gap: 16px;
  text-decoration: none; color: inherit;
}
.app-card:hover {
  box-shadow: 0 0 0 1px rgba(0,229,160,0.3), 0 8px 32px rgba(0,229,160,0.08);
  transform: translateY(-2px);
}
.app-card-top { display: flex; align-items: center; gap: 14px; }
.app-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  font-family: 'Syne', sans-serif; flex-shrink: 0;
}
.app-icon img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; }
.app-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.app-sub { font-size: 12px; color: var(--muted); }
.app-desc {
  color: var(--muted); font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  flex: 1;
}
.app-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.app-price { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; color: var(--brand); }
.app-price-sub { font-size: 11px; color: var(--muted); }
.btn-activate {
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  border-radius: 8px; padding: 8px 16px;
  font-size: 13px; font-weight: 700;
  font-family: 'Syne', sans-serif; color: #080C10;
  border: none; cursor: pointer; transition: all 0.2s;
  text-decoration: none; display: inline-block;
}
.btn-activate:hover { opacity: 0.9; }

/* ---- CHECKOUT ---- */
.checkout-wrap {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.checkout-box {
  width: 100%; max-width: 480px;
}
.checkout-app-info {
  display: flex; align-items: center; gap: 16px; margin-bottom: 28px;
}
.checkout-app-name { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; }
.checkout-app-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.card-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 28px;
}
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; color: var(--muted);
  font-family: 'Syne', sans-serif; font-weight: 500;
  margin-bottom: 8px;
}
.form-label span { color: var(--danger); margin-left: 2px; }
.form-input {
  width: 100%; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: 'DM Sans', sans-serif;
  font-size: 15px; padding: 12px 16px; outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: rgba(0,229,160,0.5); }
.form-input::placeholder { color: var(--muted); }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.order-summary {
  background: var(--surface2); border-radius: 12px;
  padding: 16px; margin-bottom: 20px;
}
.order-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; font-size: 14px;
}
.order-row.total {
  border-top: 1px solid var(--border); margin-top: 4px; padding-top: 12px;
}
.order-row.total .label { font-family: 'Syne', sans-serif; font-weight: 700; }
.order-row.total .value {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 20px; color: var(--brand);
}
.btn-pix {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 16px; font-weight: 700; font-family: 'Syne', sans-serif;
  color: #080C10; transition: all 0.2s;
}
.btn-pix:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-pix:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.secure-note {
  text-align: center; color: var(--muted);
  font-size: 12px; margin-top: 12px;
}

/* ---- PIX SCREEN ---- */
.pix-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 18px; text-align: center; margin-bottom: 4px; }
.pix-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.pix-qr { text-align: center; margin-bottom: 20px; }
.pix-qr img { width: 220px; height: 220px; border-radius: 12px; border: 2px solid rgba(0,229,160,0.3); }
.btn-copy {
  width: 100%; padding: 12px 16px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 20px; transition: all 0.2s;
}
.btn-copy:hover, .btn-copy.copied {
  background: rgba(0,229,160,0.1); border-color: rgba(0,229,160,0.4); color: var(--brand);
}
.pix-timer {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(0,229,160,0.06); border: 1px solid rgba(0,229,160,0.15);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 20px;
}
.timer-label { color: var(--muted); font-size: 13px; }
.timer-value { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 18px; color: var(--brand); }
.timer-value.urgent { color: var(--danger); }
.polling-indicator {
  display: flex; align-items: center; gap: 8px;
  justify-content: center; color: var(--muted); font-size: 13px;
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--brand);
  animation: spin 1s linear infinite; flex-shrink: 0;
}

/* ---- SUCCESS / ERROR ---- */
.result-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 40px 24px;
}
.result-box { max-width: 460px; width: 100%; text-align: center; }
.result-icon {
  width: 80px; height: 80px; border-radius: 50%;
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.result-icon.success {
  background: rgba(0,229,160,0.15);
  border: 2px solid rgba(0,229,160,0.4);
  animation: pulse-ring 2s infinite;
}
.result-icon.error {
  background: rgba(255,107,107,0.1);
  border: 2px solid rgba(255,107,107,0.3);
}
.result-title {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 30px; margin-bottom: 12px;
}
.result-sub { color: var(--muted); font-size: 16px; margin-bottom: 32px; line-height: 1.6; }
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; margin-bottom: 28px; text-align: left;
}
.info-row {
  display: flex; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); }
.info-value { font-family: 'Syne', sans-serif; font-weight: 600; }
.btn-back {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 16px; font-weight: 700; font-family: 'Syne', sans-serif;
  color: #080C10; text-decoration: none; display: block;
}

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; margin-bottom: 20px;
}
.alert-error {
  background: rgba(255,100,100,0.1);
  border: 1px solid rgba(255,100,100,0.3);
  color: #ff6464;
}
.alert-success {
  background: rgba(0,229,160,0.1);
  border: 1px solid rgba(0,229,160,0.3);
  color: var(--brand);
}

/* ---- ADMIN ---- */
.admin-body { background: var(--bg); min-height: 100vh; display: flex; }
.sidebar {
  width: 220px; background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; z-index: 10;
}
.sidebar-logo {
  padding: 20px; border-bottom: 1px solid var(--border);
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 17px;
}
.sidebar-logo small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-family: 'Syne', sans-serif; font-size: 14px;
  color: var(--muted); text-decoration: none;
  margin-bottom: 4px; transition: all 0.15s; border: none;
  background: transparent; cursor: pointer; width: 100%; text-align: left;
}
.nav-link:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-link.active { background: rgba(0,229,160,0.1); color: var(--brand); }
.sidebar-foot { padding: 16px 12px; border-top: 1px solid var(--border); }
.admin-main { margin-left: 220px; padding: 32px; flex: 1; }
.admin-title { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 26px; margin-bottom: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 14px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.stat-label { font-size: 12px; color: var(--muted); font-family: 'Syne', sans-serif; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 800; font-family: 'Syne', sans-serif; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; text-align: left; font-size: 11px; color: var(--muted); font-family: 'Syne', sans-serif; font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 12px 18px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-family: 'Syne', sans-serif; font-weight: 600;
}
.badge-activated { background: rgba(0,229,160,0.1); color: var(--success); }
.badge-paid      { background: rgba(0,180,216,0.1); color: var(--brand2); }
.badge-pending   { background: rgba(255,179,71,0.1); color: var(--warn); }
.badge-failed    { background: rgba(255,107,107,0.1); color: var(--danger); }
.badge-expired   { background: rgba(107,122,141,0.1); color: var(--muted); }
.badge-active    { background: rgba(0,229,160,0.1); color: var(--success); }
.badge-inactive  { background: rgba(107,122,141,0.1); color: var(--muted); }
.btn-sm {
  padding: 5px 12px; border-radius: 8px; font-size: 12px;
  font-family: 'Syne', sans-serif; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-block; transition: all 0.15s;
}
.btn-sm:hover { background: var(--surface); }
.btn-sm.brand { background: rgba(0,229,160,0.1); border-color: rgba(0,229,160,0.3); color: var(--brand); }
.btn-primary-admin {
  padding: 10px 20px; border-radius: 10px; border: none; cursor: pointer;
  background: linear-gradient(135deg,var(--brand),var(--brand2));
  color: #080C10; font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px;
}
.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px); display: flex;
  align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px;
  width: 100%; max-width: 420px;
}
.modal-title { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 19px; margin-bottom: 20px; }
.form-row { display: flex; gap: 10px; }
.filter-select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px; color: var(--text);
  font-size: 14px; cursor: pointer; outline: none;
}
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.page-btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  font-family: 'Syne', sans-serif; font-size: 13px;
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.current { background: rgba(0,229,160,0.1); border-color: rgba(0,229,160,0.3); color: var(--brand); }
.admin-login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 24px;
}

/* ---- UTILS ---- */
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes fade-up   { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0   rgba(0,229,160,0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(0,229,160,0); }
  100% { box-shadow: 0 0 0 0   rgba(0,229,160,0); }
}
.fade-up { animation: fade-up 0.4s ease both; }
.monospace { font-family: monospace; font-size: 12px; color: var(--muted); }
.text-muted { color: var(--muted); }
.text-brand { color: var(--brand); }
.text-right { text-align: right; }
.d-flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.mt-12 { margin-top: 12px; }
.mb-16 { margin-bottom: 16px; }

@media (max-width: 600px) {
  .header-badges { display: none; }
  .sidebar { display: none; }
  .admin-main { margin-left: 0; padding: 20px 16px; }
  .apps-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .hero-features { gap: 14px; }
}
