/* ==========================================================================
   RSX Drop — brand stylesheet
   Blue #4dade7 = interactive · Green #8de449 = live/success
   ========================================================================== */

:root {
  --bg:        #0b121b;
  --bg-raise:  #121c29;
  --bg-inset:  #0e1622;
  --line:      #223045;
  --line-hot:  #33486a;
  --text:      #e8eef4;
  --muted:     #8ca0b8;
  --faint:     #5b6d84;
  --blue:      #4dade7;
  --blue-dim:  rgba(77, 173, 231, 0.12);
  --green:     #8de449;
  --green-dim: rgba(141, 228, 73, 0.12);
  --red:       #f0716b;
  --radius:    10px;
  --font:      'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:      'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 70% -10%, rgba(77,173,231,0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--green); }

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

/* --- Header ------------------------------------------------------------ */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0;
}
.brand { display: flex; align-items: center; color: var(--text); }
.brand-stack { display: flex; flex-direction: column; gap: 5px; }
.brand img { height: 30px; width: auto; display: block; }
.brand .brand-tag {
  font-family: var(--mono); font-size: 9.5px; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.22em; white-space: nowrap;
}
.brand:hover .brand-tag { color: var(--muted); }
.nav { display: flex; align-items: center; gap: 10px; }
.nav .user-email { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: 6px; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line-hot);
  background: transparent; color: var(--text); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #06121d; }
.btn-primary:hover { background: #66bdf0; color: #06121d; }
.btn-green { background: var(--green); border-color: var(--green); color: #10200a; }
.btn-green:hover { background: #a4ef68; color: #10200a; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-hot); }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Hero ---------------------------------------------------------------- */
.hero { padding: 56px 0 24px; text-align: center; }
.hero h1 {
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; margin: 0 0 16px;
}
.hero h1 .live-word { color: var(--green); }
.hero .sub {
  color: var(--muted); font-size: 18px; max-width: 560px; margin: 0 auto 40px;
}
.hero .sub strong { color: var(--text); font-weight: 600; }

/* --- Drop zone: the data plate ------------------------------------------- */
.plate-wrap { position: relative; max-width: 720px; margin: 0 auto; }
.plate {
  position: relative;
  border: 1px dashed var(--line-hot);
  border-radius: var(--radius);
  background: var(--bg-raise);
  padding: 56px 28px 48px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.plate:hover, .plate.dragover {
  border-color: var(--blue);
  background: linear-gradient(0deg, var(--blue-dim), var(--blue-dim)), var(--bg-raise);
}
.plate:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
/* machined corner brackets */
.plate::before, .plate::after,
.plate .corner::before, .plate .corner::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border-color: var(--blue); border-style: solid; opacity: .9;
}
.plate::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-radius: var(--radius) 0 0 0; }
.plate::after { top: -1px; right: -1px; border-width: 2px 2px 0 0; border-radius: 0 var(--radius) 0 0; }
.plate .corner::before { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; border-radius: 0 0 0 var(--radius); }
.plate .corner::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-radius: 0 0 var(--radius) 0; }
.plate.state-live::before, .plate.state-live::after,
.plate.state-live .corner::before, .plate.state-live .corner::after { border-color: var(--green); }
.plate.state-live { border-color: var(--green); cursor: default; }

.plate .drop-icon { color: var(--blue); margin-bottom: 14px; }
.plate h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.plate .hint { color: var(--muted); margin: 0; font-size: 15px; }
.plate .hint u { text-decoration-color: var(--blue); text-underline-offset: 3px; }

.spec-line {
  margin-top: 26px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint);
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 14px;
}
.spec-line span::before { content: '·'; margin-right: 14px; color: var(--line-hot); }
.spec-line span:first-child::before { content: ''; margin: 0; }

/* progress */
.progress { display: none; margin-top: 28px; }
.plate.state-busy .progress { display: block; }
.plate.state-busy .idle-face { opacity: .35; }
.progress-track {
  height: 6px; border-radius: 3px; background: var(--bg-inset);
  border: 1px solid var(--line); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width .2s ease;
}
.progress-label {
  margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted);
}

/* live result */
.result { display: none; text-align: center; }
.plate.state-live .idle-face, .plate.state-live .progress { display: none; }
.plate.state-live .result { display: block; }
.live-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em;
  color: var(--green); background: var(--green-dim);
  border: 1px solid rgba(141, 228, 73, .35); border-radius: 999px;
  padding: 5px 14px; margin-bottom: 18px;
}
.live-badge .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 10px var(--green); animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: .4; } }
.live-url {
  display: block; font-family: var(--mono); font-size: clamp(14px, 2.6vw, 19px);
  color: var(--text); background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 16px; margin: 0 auto 18px; max-width: 560px;
  overflow-wrap: anywhere;
}
.live-url a { color: var(--green); }
.result-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.result-note { margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.result-note a { font-weight: 600; }

.error-box {
  display: none; margin: 18px auto 0; max-width: 560px;
  border: 1px solid rgba(240, 113, 107, .4); background: rgba(240, 113, 107, .08);
  color: #f7a29e; border-radius: 8px; padding: 12px 16px; font-size: 14px;
}
.error-box.show { display: block; }

/* --- Feature cards -------------------------------------------------------- */
.features { padding: 72px 0 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
}
.feature .f-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--blue); margin-bottom: 12px; display: block;
}
.feature h3 { margin: 0 0 8px; font-size: 17px; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* --- Steps ---------------------------------------------------------------- */
.steps { padding: 56px 0 72px; }
.steps h2 { text-align: center; font-size: 28px; margin: 0 0 36px; letter-spacing: -0.01em; }
.steps-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { border-left: 2px solid var(--line-hot); padding: 4px 0 4px 20px; }
.step b { display: block; font-size: 16px; margin-bottom: 6px; }
.step span { color: var(--muted); font-size: 14.5px; }
.step .k { font-family: var(--mono); color: var(--green); font-size: 12px; letter-spacing: .12em; display: block; margin-bottom: 8px; }

/* --- Footer ---------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line); padding: 28px 0 40px; margin-top: 40px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  color: var(--faint); font-size: 13.5px;
}
.site-footer .mono { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

/* --- Modals ---------------------------------------------------------------- */
dialog {
  border: 1px solid var(--line-hot); border-radius: 12px; background: var(--bg-raise);
  color: var(--text); padding: 28px; width: min(400px, calc(100vw - 40px));
}
dialog::backdrop { background: rgba(4, 8, 14, 0.7); backdrop-filter: blur(3px); }
dialog h3 { margin: 0 0 4px; font-size: 20px; }
dialog .d-sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 12px; border-radius: 8px;
  border: 1px solid var(--line-hot); background: var(--bg-inset);
  color: var(--text); font-family: var(--font); font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--blue); }
dialog .d-actions { display: flex; gap: 10px; margin-top: 20px; }
dialog .d-actions .btn { flex: 1; }
dialog .d-error { color: var(--red); font-size: 13.5px; min-height: 18px; margin: 8px 0 0; }
dialog .d-switch { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--muted); }

/* --- Dashboard --------------------------------------------------------------- */
.dash-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; padding: 36px 0 20px; }
.dash-head h1 { margin: 0; font-size: 30px; letter-spacing: -0.01em; }
.dash-head .count { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .1em; }
.site-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 60px; }
.site-card {
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.site-card .s-main { flex: 1; min-width: 220px; }
.site-card .s-url { font-family: var(--mono); font-size: 15px; overflow-wrap: anywhere; }
.site-card .s-meta { font-family: var(--mono); font-size: 11.5px; color: var(--faint); margin-top: 6px; letter-spacing: .06em; }
.site-card .s-meta .live { color: var(--green); }
.site-card .s-meta .exp { color: #e7c04d; }
.site-card .s-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state {
  text-align: center; border: 1px dashed var(--line-hot); border-radius: var(--radius);
  padding: 60px 24px; color: var(--muted);
}

/* --- Toast ---------------------------------------------------------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-raise); border: 1px solid var(--green); color: var(--text);
  padding: 12px 22px; border-radius: 8px; font-size: 14px; opacity: 0;
  pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 800px) {
  .features, .steps-row { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; }
  .plate { padding: 42px 18px 36px; }
  .brand .brand-tag { display: none; }
}

/* --- Visibility toggle ------------------------------------------------- */
.vis-toggle {
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 230px));
  justify-content: center;
  gap: 10px;
}
.vis-opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-hot); background: var(--bg-raise);
  font-family: var(--font); color: var(--muted);
  transition: border-color .15s, background .15s;
}
.vis-opt:hover { border-color: var(--blue); }
.vis-opt:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.vis-opt svg { flex: none; color: var(--faint); transition: color .15s; }
.vis-opt .vis-label {
  display: block; font-weight: 600; font-size: 14.5px; color: var(--text);
  transition: color .15s;
}
.vis-opt .vis-desc { display: block; font-size: 12px; color: var(--faint); margin-top: 1px; }
.vis-opt.active {
  border-color: var(--blue);
  background: linear-gradient(0deg, var(--blue-dim), var(--blue-dim)), var(--bg-raise);
  box-shadow: 0 0 0 1px var(--blue) inset;
}
.vis-opt.active svg { color: var(--blue); }
.vis-opt.active .vis-label { color: var(--blue); }
.vis-hint {
  margin: 12px auto 0; font-size: 12.5px; color: var(--faint);
  text-align: center; max-width: 460px;
}

.s-meta .vis-public { color: var(--blue); }
.s-meta .vis-unlisted { color: var(--muted); }

@media (max-width: 800px) {
  .vis-toggle { grid-template-columns: 1fr; max-width: 300px; }
}

/* --- Admin panel --------------------------------------------------------- */
.container-wide { max-width: 1240px; }
.admin-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin: 8px 0 24px;
}
.a-card {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.a-card .a-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--blue);
}
.a-card .a-num { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.a-card .a-sub { font-family: var(--mono); font-size: 11px; color: var(--faint); }

.admin-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.admin-tabs { display: flex; gap: 4px; }
.admin-tabs a {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
}
.admin-tabs a:hover { color: var(--text); }
.admin-tabs a.active {
  color: var(--blue); background: var(--blue-dim); border-color: var(--line-hot);
}
.admin-search { display: flex; gap: 8px; margin-left: auto; }
.admin-search input {
  padding: 8px 12px; border-radius: 8px; min-width: 220px;
  border: 1px solid var(--line-hot); background: var(--bg-inset);
  color: var(--text); font-family: var(--font); font-size: 13.5px;
}
.admin-search input:focus { outline: none; border-color: var(--blue); }

.admin-table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-raise); margin-bottom: 20px;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint); font-weight: 500;
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  vertical-align: middle; white-space: nowrap;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: rgba(77, 173, 231, 0.04); }
.admin-table .t-email { font-family: var(--mono); font-size: 12.5px; }
.admin-table .t-slug a { font-family: var(--mono); font-size: 12.5px; }
.admin-table .t-slug { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.admin-table .t-mono { font-family: var(--mono); font-size: 12px; }
.admin-table .t-ok { color: var(--green); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; }
.admin-table .t-blocked { color: var(--red); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; }
.admin-table .t-warn { color: #e7c04d; font-family: var(--mono); font-size: 11px; }
.admin-table .t-anon { color: var(--faint); font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; }
.admin-table .t-empty { text-align: center; color: var(--muted); padding: 40px; }
.admin-table .t-actions { text-align: right; }
.admin-table .t-actions .btn { margin-left: 6px; }
.admin-table tr.t-dim td { color: var(--faint); }
.admin-table tfoot td { border-top: 1px solid var(--line-hot); padding: 12px 14px; }
.admin-note { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.admin-note a { font-weight: 600; }

.chart-card {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.chart-card h3 { margin: 0 0 16px; font-size: 15px; font-weight: 600; }
.bar-chart {
  display: flex; align-items: flex-end; gap: 3px; height: 120px;
}
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar {
  width: 100%; border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--blue), rgba(77, 173, 231, 0.35));
  min-height: 2px;
}
.bar-col:hover .bar { background: var(--green); }

@media (max-width: 900px) {
  .admin-cards { grid-template-columns: 1fr 1fr; }
  .admin-search { margin-left: 0; width: 100%; }
  .admin-search input { flex: 1; }
}
