/* ===========================
   PUBLIC PAGE - Dark Theme
   =========================== */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #242837;
  --border: #2e3348;
  --text: #e4e6f0;
  --text-muted: #8b8fa3;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.container.wide {
  max-width: 1100px;
}

h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* Form */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: var(--primary);
}

.row {
  display: flex;
  gap: 1rem;
}

.row > * {
  flex: 1;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* Result card */
.result-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: none;
}

.result-card.visible {
  display: block;
}

.result-url {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-hover);
  word-break: break-all;
  margin-bottom: 0.75rem;
}

.result-original {
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-bottom: 1rem;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.qr-container {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  width: fit-content;
  margin: 0 auto;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  background: var(--success);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(1rem);
  transition: all 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Table (admin) */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td a {
  color: var(--primary-hover);
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

.truncate {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.chart-container h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Tabs (admin) */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: var(--primary-hover);
  border-bottom-color: var(--primary);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 600px) {
  .row { flex-direction: column; gap: 0; }
  .container { padding: 1.5rem 1rem; }
  h1 { font-size: 1.4rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* Turnstile widget */
.cf-turnstile {
  margin: 1rem 0;
}

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

nav a:hover {
  color: var(--text);
}


/* ===========================
   ADMIN PAGE - Neobrutalism Theme
   Scoped under body.neo-admin
   =========================== */

body.neo-admin {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  color: #000;
  min-height: 100vh;
}

/* --- Layout --- */

body.neo-admin .neo-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* --- Header / Nav --- */

body.neo-admin .neo-header {
  background: #000;
  color: #fff;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 4px solid #000;
}

body.neo-admin .neo-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.neo-admin .neo-header h1 {
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  margin: 0;
}

body.neo-admin .neo-header p {
  font-size: 0.8rem;
  color: #ccc;
  margin: 0;
  font-weight: 400;
}

body.neo-admin .neo-header-link {
  color: #FFD93D;
  text-decoration: none;
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 2px solid #FFD93D;
  padding: 0.5rem 1rem;
  transition: background 0.1s, color 0.1s;
}

body.neo-admin .neo-header-link:hover {
  background: #FFD93D;
  color: #000;
}

/* --- Cards --- */

body.neo-admin .neo-card {
  background: #fff;
  border: 3px solid #000;
  box-shadow: 5px 5px 0px #000;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* --- Buttons --- */

body.neo-admin .neo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #000;
  font-weight: 900;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  background: #fff;
  color: #000;
  border-radius: 0;
  transition: transform 0.1s, box-shadow 0.1s;
}

body.neo-admin .neo-btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px #000;
}

body.neo-admin .neo-btn:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

body.neo-admin .neo-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: 4px 4px 0px #000;
}

body.neo-admin .neo-btn-primary {
  background: #FFD93D;
  color: #000;
}

body.neo-admin .neo-btn-danger {
  background: #000;
  color: #fff;
}

body.neo-admin .neo-btn-danger:hover {
  background: #333;
}

body.neo-admin .neo-btn-outline {
  background: #fff;
  color: #000;
}

body.neo-admin .neo-btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-width: 2px;
  box-shadow: 3px 3px 0px #000;
}

body.neo-admin .neo-btn-sm:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0px #000;
}

body.neo-admin .neo-btn-sm:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

/* --- Form / Inputs --- */

body.neo-admin .neo-form-group {
  margin-bottom: 1.25rem;
}

body.neo-admin .neo-form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #000;
  margin-bottom: 0.5rem;
}

body.neo-admin .neo-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #000;
  color: #000;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  border-radius: 0;
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}

body.neo-admin .neo-input::placeholder {
  color: #999;
}

body.neo-admin .neo-input:focus {
  background: #FFD93D;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px #000;
}

body.neo-admin .neo-select {
  padding: 0.75rem 1rem;
  background: #fff;
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #000;
  color: #000;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

body.neo-admin .neo-select:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px #000;
}

body.neo-admin .neo-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

body.neo-admin .neo-row > * {
  flex: 1;
}

/* --- Auth Section --- */

body.neo-admin .neo-auth {
  max-width: 500px;
  margin: 2rem auto;
}

/* --- Tabs --- */

body.neo-admin .neo-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

body.neo-admin .neo-tab {
  padding: 0.75rem 1.5rem;
  background: #fff;
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #000;
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  color: #000;
  border-radius: 0;
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}

body.neo-admin .neo-tab:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px #000;
}

body.neo-admin .neo-tab.active {
  background: #FFD93D;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px #000;
}

/* --- Table --- */

body.neo-admin .neo-table {
  width: 100%;
  border-collapse: collapse;
  border: 3px solid #000;
  margin-top: 1rem;
}

body.neo-admin .neo-table th {
  background: #000;
  color: #fff;
  font-weight: 900;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 1rem;
  text-align: left;
  border: none;
}

body.neo-admin .neo-table td {
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #000;
  font-size: 0.9rem;
  color: #000;
  background: #fff;
}

body.neo-admin .neo-table tr:last-child td {
  border-bottom: none;
}

body.neo-admin .neo-table td a {
  color: #000;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid #FFD93D;
}

body.neo-admin .neo-table td a:hover {
  background: #FFD93D;
  text-decoration: none;
}

body.neo-admin .neo-table .truncate {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.neo-admin .neo-table .neo-actions {
  display: flex;
  gap: 0.5rem;
}

/* --- Stats Grid --- */

body.neo-admin .neo-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

body.neo-admin .neo-stat {
  padding: 1.25rem;
  background: #fff;
  border: 3px solid #000;
  box-shadow: 5px 5px 0px #000;
}

body.neo-admin .neo-stat .neo-stat-label {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #000;
}

body.neo-admin .neo-stat .neo-stat-value {
  font-size: 2.5rem;
  font-weight: 900;
  margin-top: 0.25rem;
  color: #000;
}

/* --- Chart Container --- */

body.neo-admin .neo-chart {
  background: #fff;
  border: 3px solid #000;
  box-shadow: 5px 5px 0px #000;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

body.neo-admin .neo-chart h3 {
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #000;
  margin-bottom: 1rem;
}

/* --- Pagination --- */

body.neo-admin .neo-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* --- Toast (override for neo-admin) --- */

body.neo-admin .neo-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  background: #000;
  color: #FFD93D;
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #FFD93D;
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(1rem);
  transition: all 0.3s;
  pointer-events: none;
  border-radius: 0;
  z-index: 1000;
}

body.neo-admin .neo-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- Public Page: Narrow container --- */

body.neo-admin .neo-container-narrow {
  max-width: 720px;
}

/* --- Public Page: Full-width button --- */

body.neo-admin .neo-btn-full {
  width: 100%;
}

/* --- Public Page: Turnstile widget --- */

body.neo-admin .neo-turnstile {
  margin: 1.25rem 0;
}

/* --- Public Page: Result card --- */

body.neo-admin .neo-result-card {
  display: none;
  margin-top: 1.5rem;
}

body.neo-admin .neo-result-card.visible {
  display: block;
}

body.neo-admin .neo-result-url {
  font-size: 1.3rem;
  font-weight: 900;
  color: #000;
  word-break: break-all;
  margin-bottom: 0.5rem;
  border-bottom: 3px solid #FFD93D;
  display: inline-block;
  padding-bottom: 0.15rem;
}

body.neo-admin .neo-result-original {
  font-size: 0.85rem;
  color: #666;
  word-break: break-all;
  margin-bottom: 1.25rem;
  font-weight: 400;
}

body.neo-admin .neo-result-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

body.neo-admin .neo-qr-container {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: #f5f5f5;
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #000;
  width: fit-content;
  margin: 0 auto;
}

/* --- Public Page: Spinner override --- */

body.neo-admin .spinner {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 3px solid #000;
  border-top-color: #FFD93D;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* --- Responsive --- */

@media (max-width: 600px) {
  body.neo-admin .neo-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  body.neo-admin .neo-container {
    padding: 0 1rem 2rem;
  }

  body.neo-admin .neo-header h1 {
    font-size: 1.2rem;
  }

  body.neo-admin .neo-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  body.neo-admin .neo-tabs {
    flex-direction: column;
    gap: 0.5rem;
  }

  body.neo-admin .neo-table {
    font-size: 0.8rem;
  }

  body.neo-admin .neo-table .truncate {
    max-width: 120px;
  }
}
