/* sponsor-apply-v1 — PPV auction sponsor application + dashboard. Self-contained. */

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input { font: inherit; color: inherit; }

/* ============ APP SHELL ============ */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 720px);
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

/* ============ SIDEBAR ============ */
.sidebar { position: sticky; top: 24px; height: calc(100vh - 48px); display: flex; flex-direction: column; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 14px; font-size: 32px; font-weight: 800; margin-bottom: 36px; color: var(--text); }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar nav a {
  padding: 14px 18px;
  color: var(--text-soft);
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.sidebar nav a.active,
.sidebar nav a:hover {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.new-post {
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 700;
  padding: 14px 22px;
  font-size: 16px;
}

/* ============ MAIN ============ */
.main { min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; min-height: 44px; gap: 12px;
}
.topbar .back {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  font-size: 22px; color: var(--text);
}
.topbar h1 { font-size: 26px; margin: 0; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.topbar-brand { display: none; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.topbar-brand img { width: 24px; height: 24px; object-fit: contain; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  margin-bottom: 14px;
}

/* ============ PUBLISHER CARD ============ */
.publisher-card {
  background: linear-gradient(135deg, #fce7f3, #fde68a);
  border: 1px solid rgba(236, 72, 153, 0.18);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}
.pub-row { display: flex; align-items: center; gap: 14px; }
.pub-row .avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
}
.pub-who { flex: 1; min-width: 0; }
.pub-who small { display: block; font-size: 11px; color: #9d174d; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.pub-who b { display: block; font-size: 18px; font-weight: 800; color: #831843; margin-top: 2px; }
.pub-who p { margin: 4px 0 0; font-size: 12px; color: #9d174d; opacity: 0.85; }

/* ============ EXPLAIN ============ */
.explain-card h2 { font-size: 16px; margin: 0 0 14px; }
.explain-flow { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.explain-flow li { display: flex; gap: 12px; align-items: flex-start; }
.explain-flow .step {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.explain-flow b { font-size: 14px; }
.explain-flow small { display: block; color: var(--text-soft); font-size: 12px; line-height: 1.5; margin-top: 2px; }
.explain-note {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: 12px;
}
.explain-note > b {
  display: block;
  font-size: 13px;
  color: var(--primary-dark);
  margin-bottom: 4px;
}
.explain-note p {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.6;
}
.explain-note p b { color: var(--text); }
.explain-note a {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: none;
}

/* ============ BIDS LIST ============ */
.bids-card { padding: 0; overflow: hidden; }
.bids-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.bids-head h2 { font-size: 15px; margin: 0; font-weight: 700; }
.bids-note { font-size: 11px; color: var(--text-soft); font-weight: 600; }
.bids-list { list-style: none; padding: 0; margin: 0; }
.bids-list li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
.bids-list li:last-child { border-bottom: 0; }
.bids-list li.is-you {
  background: linear-gradient(90deg, var(--primary-soft), transparent 70%);
}
.bids-list li.is-paused { opacity: 0.55; }
.bids-list .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.bids-list .bid-info { min-width: 0; }
.bids-list .bid-info b { display: block; font-size: 14px; font-weight: 700; }
.bids-list .bid-info small {
  display: block; font-size: 11px; color: var(--text-soft); margin-top: 2px;
}
.bids-list .status-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--success);
  color: white;
  font-size: 9px;
  font-weight: 700;
  margin-left: 6px;
  letter-spacing: 0.04em;
}
.bids-list .status-pill.paused { background: var(--text-muted); }
.bids-list .cpm {
  text-align: right;
}
.bids-list .cpm b {
  display: block; font-size: 15px; font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--primary-dark);
}
.bids-list .cpm small {
  display: block; font-size: 10px; color: var(--text-muted); font-weight: 600;
}
.bids-foot {
  margin: 12px 18px;
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.5;
}

/* ============ BID FORM ============ */
.bid-form-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.bid-form-head h2 { font-size: 16px; margin: 0; }
.floor {
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.bid-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.bid-row:last-of-type { border-bottom: 0; }
.bid-label b { display: block; font-size: 14px; font-weight: 700; }
.bid-label small { display: block; font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.bid-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.bid-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-soft);
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.bid-input:focus-within {
  border-color: var(--primary);
  background: var(--surface);
}
.bid-input input {
  width: 80px;
  border: 0;
  outline: none;
  background: transparent;
  text-align: right;
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.bid-input input::-webkit-outer-spin-button,
.bid-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bid-input input[type="number"] { -moz-appearance: textfield; }
.bid-input span {
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
}

.bid-estimate {
  margin: 14px 0;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: 12px;
}
.est-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 4px 0;
}
.est-row .k { font-size: 12px; color: var(--primary-dark); opacity: 0.85; }
.est-row b { font-size: 16px; font-weight: 800; color: var(--primary-dark); letter-spacing: -0.01em; }

.bid-wallet {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 0 0 6px;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.bid-wallet:hover { border-color: var(--primary); background: var(--primary-soft); }
.bid-wallet .ic {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
  flex-shrink: 0;
}
.bid-wallet .body { flex: 1; min-width: 0; }
.bid-wallet .body b { display: block; font-size: 12px; font-weight: 700; color: var(--text); }
.bid-wallet .body small {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.bid-wallet .chev { color: var(--text-muted); flex-shrink: 0; display: inline-flex; }

.apply-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: white;
  font-weight: 800;
  font-size: 15px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.4);
  transition: opacity 0.15s, transform 0.05s, box-shadow 0.2s;
  margin-top: 8px;
}
.apply-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(236, 72, 153, 0.5); }
.apply-btn:active { transform: translateY(0); }
.apply-btn:disabled {
  background: var(--surface-soft);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ============ DASHBOARD ============ */
.dashboard[hidden] { display: none !important; }
.dash-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.dash-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--success);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.dash-status.paused { color: var(--warning); }
.dash-head h2 { font-size: 16px; margin: 0; }

.dash-switch {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.dash-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.dash-switch .slider {
  position: absolute;
  inset: 0;
  background: var(--text-muted);
  border-radius: 999px;
  transition: background 0.15s;
}
.dash-switch .slider::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.18s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.dash-switch input:checked + .slider { background: var(--success); }
.dash-switch input:checked + .slider::before { transform: translateX(20px); }

.dash-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border-radius: 12px;
  margin-bottom: 14px;
}
.dash-brand .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.dash-brand-text b {
  display: block;
  font-size: 14px;
  font-weight: 800;
}
.dash-brand-text small {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.dash-stat {
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 10px 12px;
}
.dash-stat small {
  display: block;
  font-size: 10px;
  color: var(--text-soft);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dash-stat b {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
  letter-spacing: -0.01em;
}
.dash-stat .unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-soft);
  margin-left: 2px;
}

.dash-progress {
  height: 6px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
}
.dash-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.3s;
}
.dash-h3 {
  font-size: 13px;
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.dash-save {
  flex: 1;
  padding: 11px;
  background: var(--text);
  color: white;
  font-weight: 800;
  font-size: 13px;
  border-radius: 10px;
  transition: opacity 0.15s, transform 0.05s;
}
.dash-save:hover { opacity: 0.92; }
.dash-stop {
  padding: 11px 14px;
  background: var(--surface-soft);
  color: var(--error);
  font-weight: 600;
  font-size: 12px;
  border-radius: 10px;
}
.dash-stop:hover { background: #fee2e2; }

/* ============ Avatar gradients ============ */
.avatar.g1 { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.avatar.g2 { background: linear-gradient(135deg, #ec4899, #f97316); }
.avatar.g3 { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.avatar.g4 { background: linear-gradient(135deg, #10b981, #059669); }
.avatar.g5 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar.gCoffee { background: linear-gradient(135deg, #92400e, #b45309); }
.avatar.gBread  { background: linear-gradient(135deg, #d97706, #f59e0b); }
.avatar.gMusic  { background: linear-gradient(135deg, #7c3aed, #db2777); }
.avatar.gBook   { background: linear-gradient(135deg, #047857, #10b981); }
.avatar.gStudio { background: linear-gradient(135deg, #4f46e5, #06b6d4); }
.avatar.gBar    { background: linear-gradient(135deg, #1e293b, #6366f1); }
.avatar.gNoodle { background: linear-gradient(135deg, #ca8a04, #84cc16); }

/* ============ END CAMPAIGN MODAL ============ */
.end-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}
.end-modal[hidden] { display: none !important; }
.em-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(3px);
          backdrop-filter: blur(3px);
}
.em-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 22px;
  padding: 28px 26px 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
  text-align: center;
  animation: em-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes em-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.em-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7, #fcd34d);
  color: #b45309;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}
.em-card h3 { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.em-warn {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}
.em-warn b { color: var(--error); }
.em-tip {
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--primary-dark);
  line-height: 1.6;
  text-align: left;
}
.em-tip b { color: var(--primary-dark); font-weight: 800; }

.em-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.em-pause,
.em-cancel,
.em-confirm {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  transition: opacity 0.15s, background 0.15s, transform 0.05s;
}
.em-pause {
  background: var(--primary);
  color: white;
}
.em-pause:hover { background: var(--primary-dark); }
.em-cancel {
  background: var(--surface-soft);
  color: var(--text-soft);
}
.em-cancel:hover { background: var(--line); color: var(--text); }
.em-confirm {
  background: transparent;
  color: var(--error);
  font-weight: 600;
  padding: 8px;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.em-confirm:hover { color: #991b1b; }

/* ============ TOAST ============ */
.cm-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.4);
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 0.2s, transform 0.2s;
}
.cm-toast.show { opacity: 0.92; transform: translate(-50%, 0); }
.cm-toast[hidden] { display: none !important; }

/* ============ BACK TO TOP ============ */
.to-top {
  position: fixed;
  bottom: 28px; right: 28px;
  z-index: 50;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--text);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.32);
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
}
.to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
@media (hover: hover) {
  .to-top:hover { background: var(--primary-dark); }
}

/* ============ MOBILE NAV ============ */
.mobile-nav { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); padding: 16px; gap: 18px; }
}

@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .sidebar { display: none; }
  .main { padding: 14px 16px 100px; }
  .topbar { padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
  .topbar .back { display: inline-flex; }
  .topbar h1 { font-size: 18px; text-align: center; }
  .topbar-brand { display: none; }
  .dash-stats { grid-template-columns: 1fr; }

  .to-top {
    bottom: 88px; right: 16px; width: 42px; height: 42px;
    transition: opacity 0.2s, transform 0.2s, background 0.15s,
                bottom 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  body.nav-hidden .to-top { bottom: 28px; }

  .mobile-nav {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: 10px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 20;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
  }
  .mobile-nav.nav-hidden {
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
  }
  .mobile-nav a { text-align: center; font-size: 12px; color: var(--text-soft); padding: 8px 4px; }
  .mobile-nav a.active { color: var(--text); font-weight: 600; }
  .mobile-nav .compose-btn {
    width: 46px; height: 46px;
    margin: auto; padding: 0;
    border-radius: 50%;
    background: var(--cta-bg); color: var(--cta-text);
    display: grid; place-items: center; line-height: 1;
  }
}
