/* ---- APP NAVIGATION ---- */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-secondary);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--fg-primary);
  background: var(--bg-secondary);
}

.nav-link.active {
  color: var(--fg-primary);
  background: var(--bg-card);
}

/* ---- APP MAIN ---- */
.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ---- PAGE HEADER ---- */
.page-header {
  margin-bottom: 48px;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
  margin-top: 16px;
}

.page-subtitle {
  color: var(--fg-secondary);
  font-size: 1.05rem;
  max-width: 560px;
  line-height: 1.65;
}

/* ---- GENERATOR LAYOUT ---- */
.generator-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 48px;
}

/* ---- PANEL CARDS ---- */
.panel-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 20px;
}

/* ---- BRAND GRID ---- */
.brand-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.brand-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: left;
}

.brand-btn:hover {
  border-color: var(--accent-glow);
  background: var(--bg-primary);
}

.brand-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.brand-emoji {
  font-size: 18px;
  margin-bottom: 4px;
}

.brand-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-primary);
}

.brand-commission {
  font-size: 11px;
  color: var(--fg-muted);
}

/* ---- FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 8px;
}

.form-hint {
  font-weight: 400;
  color: var(--fg-muted);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

.form-input::placeholder {
  color: var(--fg-muted);
}

.form-input:focus {
  border-color: var(--accent-glow);
}

/* ---- BUTTONS ---- */
.btn-primary {
  width: 100%;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

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

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-copy {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-secondary);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--fg-primary);
}

.btn-copy-link {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-secondary);
  font-size: 12px;
  font-family: var(--font-display);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s;
}

.btn-copy-link:hover {
  border-color: var(--accent);
}

.btn-test-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.btn-test-link:hover {
  text-decoration: underline;
}

/* ---- OUTPUT PANEL ---- */
.output-card {
  min-height: 320px;
}

.output-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  text-align: center;
  color: var(--fg-muted);
  gap: 16px;
}

.empty-icon {
  font-size: 2.5rem;
}

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

.output-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg-primary);
  margin-right: 10px;
}

.output-badge {
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.script-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.script-section:last-of-type {
  border-bottom: none;
}

.script-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.script-text {
  font-size: 1rem;
  color: var(--fg-primary);
  line-height: 1.6;
}

.accent-text {
  color: var(--accent);
  font-weight: 600;
}

.muted-text {
  color: var(--fg-secondary);
  font-style: italic;
}

/* ---- AFFILIATE BLOCK ---- */
.affiliate-block {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.affiliate-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.affiliate-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.affiliate-url {
  font-family: monospace;
  font-size: 12px;
  color: var(--fg-secondary);
  word-break: break-all;
  flex: 1;
}

/* ---- ALERT ---- */
.alert {
  margin-top: 16px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
}

.alert-error {
  background: rgba(255, 77, 45, 0.1);
  border: 1px solid rgba(255, 77, 45, 0.3);
  color: var(--accent);
}

/* ---- RECENT ADS ---- */
.recent-section {
  margin-top: 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--fg-primary);
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.recent-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s;
}

.recent-card:hover {
  border-color: var(--accent-glow);
}

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

.recent-brand {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-primary);
}

.recent-clicks {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.recent-script {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.recent-link {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

/* ---- ANALYTICS STATS CARDS ---- */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-card-label {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
}

/* ---- LEADERBOARD ---- */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 32px 1fr 60px 80px 1fr;
  align-items: center;
  gap: 16px;
}

.leaderboard-rank {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-muted);
}

.leaderboard-brand {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-primary);
}

.leaderboard-ads {
  font-size: 12px;
  color: var(--fg-muted);
  text-align: right;
}

.leaderboard-clicks {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
}

.leaderboard-bar-wrap {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.leaderboard-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.4s ease;
}

/* ---- ADS TABLE ---- */
.ads-table-wrap {
  overflow-x: auto;
}

.ads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ads-table th {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--fg-muted);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.ads-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-secondary);
  vertical-align: middle;
}

.ads-table tr:last-child td {
  border-bottom: none;
}

.ads-table tr:hover td {
  background: var(--bg-primary);
}

.table-brand {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg-primary);
  white-space: nowrap;
}

.script-preview {
  max-width: 300px;
  color: var(--fg-muted);
}

.clicks-cell {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.clicks-cell.muted {
  color: var(--fg-secondary);
  font-weight: 500;
}

.date-cell {
  white-space: nowrap;
}

.table-link {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---- LANDING PAGE NAV (added to landing) ---- */
.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: rgba(10, 10, 15, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.landing-nav-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg-primary);
  text-decoration: none;
}

.landing-nav-cta {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.landing-nav-cta:hover {
  opacity: 0.85;
}

/* Push hero down to account for fixed nav */
body.has-landing-nav .hero {
  padding-top: 120px;
}

/* ---- MOBILE RESPONSIVE ---- */
@media (max-width: 900px) {
  .generator-layout {
    grid-template-columns: 1fr;
  }

  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .leaderboard-row {
    grid-template-columns: 28px 1fr 70px 1fr;
  }

  .leaderboard-ads {
    display: none;
  }
}

@media (max-width: 600px) {
  .brand-grid {
    grid-template-columns: 1fr;
  }

  .stats-cards {
    grid-template-columns: 1fr 1fr;
  }

  .app-main {
    padding: 24px 16px 60px;
  }
}
