@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --red: #E31E2D;
  --red-dark: #B3111E;
  --red-light: #FFF1F1;
  --white: #FFFFFF;
  --ink: #1B1B1F;
  --muted: #6B7280;
  --surface: #F8F8FA;
  --border: #ECECEF;
  --gold: #D4A017;
  --success: #1FA96A;
  --danger: #D6222F;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Poppins', sans-serif; font-weight: 700; margin: 0; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
code, .mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- Top navigation (public site) ---------- */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 18px; color: var(--ink); }
.brand .tag {
  background: var(--red);
  color: var(--white);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}
.site-nav nav { display: flex; align-items: center; gap: 22px; }
.site-nav nav a { color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none; }
.site-nav nav a:hover { color: var(--red); }
.nav-cta {
  background: var(--red);
  color: var(--white) !important;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600 !important;
}
.nav-cta:hover { background: var(--red-dark); text-decoration: none !important; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 72px 24px 56px;
  background: linear-gradient(180deg, var(--red-light) 0%, var(--white) 100%);
}
.hero h1 { font-size: 40px; line-height: 1.2; max-width: 720px; margin: 0 auto 16px; }
.hero h1 span { color: var(--red); }
.hero p { font-size: 17px; color: var(--muted); max-width: 560px; margin: 0 auto 32px; }
.shorten-box {
  max-width: 620px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(227,30,45,0.08);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  gap: 8px;
}
.shorten-box input {
  flex: 1;
  border: none;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.result-box {
  max-width: 620px;
  margin: 16px auto 0;
  background: var(--red-light);
  border: 1px solid #F3C4C7;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Sections ---------- */
.section { padding: 64px 24px; max-width: 1040px; margin: 0 auto; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head h2 { font-size: 28px; margin-bottom: 10px; }
.section-head p { color: var(--muted); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.feature-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.feature-card .icon { font-size: 26px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; margin-bottom: 8px; }
.feature-card p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- Pricing ---------- */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.plan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; text-align: center; position: relative; }
.plan-card.featured { border: 2px solid var(--red); box-shadow: 0 12px 32px rgba(227,30,45,0.12); }
.plan-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--red); color: var(--white); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; }
.plan-card h3 { font-size: 18px; margin-bottom: 6px; }
.plan-price { font-family: 'Poppins', sans-serif; font-size: 32px; font-weight: 800; margin: 10px 0; }
.plan-price span { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan-features { list-style: none; padding: 0; margin: 18px 0; text-align: left; font-size: 14px; color: var(--ink); }
.plan-features li { padding: 6px 0; display: flex; gap: 8px; align-items: flex-start; }
.plan-features li::before { content: '✓'; color: var(--success); font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #C9CAD1; padding: 40px 24px 28px; text-align: center; }
.site-footer .brand { color: var(--white); justify-content: center; margin-bottom: 10px; }
.site-footer p { font-size: 13px; margin: 4px 0; }
.channel-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--red);
  color: var(--white) !important;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  margin: 16px 0;
  text-decoration: none !important;
}
.channel-btn:hover { background: var(--red-dark); }
.footer-credit { color: #8A8B95; font-size: 12px; margin-top: 14px; }
.footer-credit a { color: #C9CAD1; }

/* ---------- Buttons (shared) ---------- */
.btn {
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.btn:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--danger); }
.btn-small { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Auth pages ---------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface); padding: 24px; }
.auth-card { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 40px 36px; max-width: 400px; width: 100%; }
.auth-card .brand { justify-content: center; margin-bottom: 18px; }
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-card p.muted { text-align: center; margin-bottom: 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }

input[type=text], input[type=url], input[type=email], input[type=password], input[type=datetime-local], select, textarea {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 5px; font-weight: 500; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #E9F9F0; border: 1px solid #BEEBD3; color: var(--success); }
.alert-error { background: var(--red-light); border: 1px solid #F3C4C7; color: var(--danger); }

/* ---------- App shell (dashboard / admin) ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav a { color: var(--muted); font-size: 14px; }
.topbar nav a.active { color: var(--red); font-weight: 600; }
.topbar nav a.logout { color: var(--danger); }
.plan-pill { font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; background: var(--red-light); color: var(--red); }
.plan-pill.premium { background: #FBF1D9; color: var(--gold); }

.wrap { max-width: 1020px; margin: 0 auto; padding: 30px 24px 80px; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-card .num { font-family: 'Poppins', sans-serif; font-size: 26px; font-weight: 800; color: var(--red); }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 2px; }

.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.panel h2 { font-size: 16px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }

.form-grid { display: grid; gap: 12px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 170px; }

/* ---------- Ticket-style link rows ---------- */
.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; flex-wrap: wrap; }
.ticket-code { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 13px; background: var(--red-light); color: var(--red); padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.ticket-body { flex: 1; min-width: 160px; }
.ticket-dest { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.ticket-clicks { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--red); white-space: nowrap; }
.ticket-actions { display: flex; gap: 8px; }
.badge-locked { color: var(--gold); font-size: 12px; }
.badge-expired { color: var(--danger); font-size: 12px; }
.badge-gate { color: var(--red); font-size: 12px; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.td-truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Gate / password / error pages (redirect flow) ---------- */
.gate-body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: var(--surface); }
.gate-card { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 40px 36px; max-width: 440px; width: 100%; text-align: center; }
.gate-icon { font-size: 32px; margin-bottom: 12px; }
.gate-card h1 { font-size: 22px; margin-bottom: 8px; }
.gate-card p { margin: 8px 0 20px; }
.gate-error { color: var(--danger) !important; font-size: 14px; }
.gate-card form { display: flex; flex-direction: column; gap: 12px; }
.gate-home { display: inline-block; margin-top: 4px; font-size: 14px; }

.gate-timer-circle {
  width: 70px; height: 70px; border-radius: 50%;
  border: 4px solid var(--red-light);
  border-top-color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 22px; color: var(--red);
  margin: 0 auto 18px;
  animation: spin 1s linear infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.gate-ad-slot { background: var(--surface); border: 1px dashed var(--border); border-radius: 10px; padding: 20px; margin: 18px 0; font-size: 13px; color: var(--muted); min-height: 60px; }
.gate-continue[disabled] { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 640px) {
  .site-nav nav { gap: 12px; }
  .site-nav nav a:not(.nav-cta) { display: none; }
  .hero h1 { font-size: 30px; }
  .shorten-box { flex-direction: column; }
  .ticket { flex-wrap: wrap; }
}
