/* PixHub — tema profesional 2.0. Oscuro, limpio y moderno, sin frameworks.
   Paleta sobria con acento índigo → cielo, tarjetas con relieve suave y
   micro-interacciones en botones, tarjetas y formularios. */
:root {
  --bg: #0b0e14;
  --surface: #12161f;
  --surface-2: #1a2029;
  --surface-3: #232b38;
  --border: #232b38;
  --border-strong: #303a49;
  --text: #eef1f6;
  --muted: #9aa5b5;
  --accent: #6366f1;
  --accent-2: #0ea5e9;
  --accent-hover: #5558e6;
  --danger: #ef4444;
  --ok: #34d399;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-accent: 0 6px 18px rgba(99, 102, 241, 0.35);
  --ring: 0 0 0 3px rgba(99, 102, 241, 0.28);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(900px 320px at 50% -80px, rgba(99, 102, 241, 0.14), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  font-size: 16px;
}
::selection { background: rgba(99, 102, 241, 0.4); }
a { color: #8b93ff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.65rem; margin: 0.5rem 0 1rem; letter-spacing: -0.02em; line-height: 1.25; }
h2 { font-size: 1.25rem; margin: 1.75rem 0 0.75rem; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
small { color: var(--muted); }
code { background: var(--surface-2); padding: 0.12em 0.4em; border-radius: 6px; font-size: 0.88em; }

/* Barra superior */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem 1.5rem;
  background: rgba(18, 22, 31, 0.88);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 1.3rem; font-weight: 800; color: var(--text); letter-spacing: -0.03em;
  white-space: nowrap;
}
.logo::before {
  content: "";
  width: 30px; height: 30px; flex: 0 0 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236366f1'/%3E%3Cstop offset='1' stop-color='%230ea5e9'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='32' height='32' rx='9' fill='url(%23g)'/%3E%3Ccircle cx='11.5' cy='11' r='3' fill='white'/%3E%3Cpath d='M5 25 L13 16.5 L18 21.5 L22 17.5 L27 22.5 L27 25 Z' fill='white' opacity='0.92'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat;
  filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.45));
}
.logo:hover { text-decoration: none; opacity: 0.92; }
.topbar nav { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
.topbar nav a {
  color: var(--muted); font-weight: 600; font-size: 0.93rem;
  padding: 0.45rem 0.8rem; border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.topbar nav a.active { color: var(--text); background: var(--surface-3); }

/* Contenido */
main { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.5rem 2rem; }
main.narrow { max-width: 720px; }
main.narrow.wide { max-width: 860px; }
.hero { text-align: center; padding: 2.25rem 0 1rem; }
.hero h1 { font-size: 2.3rem; margin-bottom: 0.5rem; letter-spacing: -0.03em; }
.hero p { font-size: 1.02rem; margin: 0.4rem 0 1.25rem; }

/* Botones y formularios */
.btn {
  display: inline-block; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); cursor: pointer; font-weight: 650; font-size: 0.95rem;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn:hover { text-decoration: none; background: var(--surface-3); border-color: #3d4a5e; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff; box-shadow: var(--shadow-accent);
}
.btn.primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #dc2626; }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
label { display: block; margin: 0.9rem 0; font-weight: 600; font-size: 0.95rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="search"], input[type="number"], select, textarea {
  width: 100%; padding: 0.65rem 0.85rem; margin-top: 0.35rem;
  background: #0f131b; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: #6b7686; }
input[readonly] { cursor: pointer; }
textarea { resize: vertical; }

/* Tarjetas y avisos */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}
.alert { padding: 0.85rem 1.05rem; border-radius: var(--radius-sm); margin: 1rem 0; border: 1px solid transparent; }
.alert.error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.alert.ok { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.4); color: #6ee7b7; }

/* Filtros */
.filters {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
  margin: 1.5rem 0; padding: 0.65rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.filters input, .filters select { flex: 1; min-width: 140px; margin-top: 0; background: var(--surface-2); }
.filters .btn { flex: 0 0 auto; }

/* Galería */
.grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.media-card {
  display: block; color: var(--text); padding: 0; overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.media-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.media-card:hover .thumb img, .media-card:hover .thumb video { transform: scale(1.05); }
.thumb-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted); font-weight: 600;
}
.play-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 12, 18, 0.6);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff; font-size: 1.1rem; padding-left: 3px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.type-badge {
  position: absolute; top: 0.55rem; right: 0.55rem;
  background: rgba(10, 12, 18, 0.65);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem; border-radius: 999px;
}
.media-card .meta { padding: 0.8rem 0.95rem 0.9rem; display: flex; flex-direction: column; gap: 0.25rem; }
.media-card .title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; font-weight: 650;
}
.media-card .muted { font-size: 0.82rem; }
.empty {
  text-align: center; padding: 3rem 1.5rem; color: var(--muted); font-size: 1.08rem;
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface);
}

/* Paginación */
.pagination { display: flex; gap: 0.4rem; justify-content: center; margin: 1.75rem 0; flex-wrap: wrap; }
.pagination a {
  padding: 0.45rem 0.85rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.pagination a.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.pagination a:hover { text-decoration: none; border-color: var(--accent); }

/* Visor de archivo */
.viewer { background: #000; border-radius: var(--radius); overflow: hidden; margin: 1rem 0; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.viewer img, .viewer video { display: block; width: 100%; max-height: 75vh; object-fit: contain; }
.share-box label { font-size: 0.9rem; }
.share-box input[readonly] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; }
.preview { max-width: 100%; max-height: 300px; border-radius: 8px; display: block; margin: 0.75rem 0; }

/* Subida */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 2.5rem 1rem; text-align: center; cursor: pointer; margin-bottom: 0.5rem;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.09), rgba(14, 165, 233, 0.05));
}
.dropzone input[type="file"] { display: none; }
.dz-icon { font-size: 2.75rem; margin: 0; }
.dropzone:hover .dz-icon, .dropzone.drag .dz-icon { filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.5)); }
.progress { margin-top: 0.6rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; position: relative; height: 28px; border: 1px solid var(--border); }
.progress .bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.2s; }
.progress .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.hidden { display: none; }
.upload-item { margin: 1rem 0; }
.upload-item.failed { border-color: rgba(239, 68, 68, 0.55); }
.upload-item.failed .status { color: #fca5a5; }
.upload-item .fname { font-weight: 700; word-break: break-all; }
.upload-item .status { color: var(--muted); font-size: 0.9rem; }

/* Admin */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.85rem; margin: 1rem 0; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 0.9rem; text-align: center; box-shadow: var(--shadow-sm);
  transition: transform 0.15s, border-color 0.15s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat strong { display: block; font-size: 1.6rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.85rem; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table th, .table td { padding: 0.65rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }
.inline-form { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1; min-width: 120px; margin-top: 0; }
.checks { list-style: none; padding: 0; }
.checks li { padding: 0.5rem 0.7rem; border-radius: var(--radius-sm); margin: 0.35rem 0; background: var(--surface); border: 1px solid var(--border); }
.checks li.ok { border-left: 4px solid var(--ok); }
.checks li.bad { border-left: 4px solid var(--danger); }
.checks span { color: var(--muted); float: right; }

.footer { text-align: center; padding: 2.25rem 1rem; border-top: 1px solid var(--border); margin-top: 2.5rem; font-size: 0.9rem; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .hero { padding: 1.5rem 0 0.75rem; }
  .hero h1 { font-size: 1.65rem; }
  .topbar { flex-direction: column; gap: 0.5rem; padding: 0.7rem 1rem; }
  .topbar nav { justify-content: center; }
  main { padding: 1rem 1rem 1.5rem; }
  .table { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Publicidad y monetización */
.pub-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 1.25rem; align-items: start; }
.pub-col { min-width: 0; }
.pub-layout .card h2 { margin-top: 0; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 0; border-bottom: 1px solid var(--border);
}
.switch-row:last-of-type { border-bottom: none; }
.switch-text { display: flex; flex-direction: column; gap: 0.1rem; }
.switch-text small { color: var(--muted); font-weight: 400; }
.switch { position: relative; display: inline-block; width: 48px; height: 27px; flex: 0 0 48px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background 0.2s, border-color 0.2s;
}
.switch .slider::before {
  content: ""; position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  width: 19px; height: 19px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); transition: transform 0.2s;
}
.switch input:checked + .slider { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.switch input:checked + .slider::before { transform: translate(21px, -50%); }
.switch input:focus-visible + .slider { box-shadow: var(--ring); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.slot-row { display: flex; gap: 0.85rem; padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.slot-row:last-child { border-bottom: none; }
.slot-icon {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.slot-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.slot-main small { color: var(--muted); }
.slot-main textarea { margin-top: 0.5rem; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; line-height: 1.45; }
.ad-slot { margin: 1rem auto; text-align: center; max-width: 100%; overflow: hidden; }
.ad-label { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.35rem; }
.ad-sticky {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--border-strong);
  padding: 0.5rem 2.5rem 0.5rem 0.75rem; text-align: center;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.5);
}
.ad-sticky .ad-slot { margin: 0; }
.ad-sticky-close {
  position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: 0.8rem; line-height: 1;
}
.smartlink-box { text-align: center; margin: 1.25rem auto; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.smartlink-text { color: var(--muted); margin: 0 0 0.75rem; }
.smartlink-btn { padding: 0.75rem 1.6rem; font-size: 1.02rem; }
.preview-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.9rem 1rem; margin: 1rem 0; text-align: center; }
.preview-box p { margin: 0.5rem 0; }
.ok-text { color: var(--ok); font-weight: 650; font-size: 0.9rem; }

/* Página intermedia (Continuar a tu imagen/video) */
.interstitial {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  min-height: 420px; margin: 1rem 0;
  display: flex; align-items: center; justify-content: center;
}
.continue-btn { padding: 0.9rem 1.8rem; font-size: 1.05rem; }

@media (max-width: 900px) {
  .pub-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ad-sticky { display: block; }
  .two-col { grid-template-columns: 1fr; }
  .slot-row { flex-direction: row; }
}
