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

:root {
  --bg: #14161a;
  --panel: #1c1f24;
  --panel-2: #23272e;
  --line: #2f343c;
  --text: #eae7e0;
  --muted: #8b8f98;
  --accent: #ff6b35;
  --accent-2: #3ddc97;
  --danger: #ff5d6c;
  --radius: 10px;
  --font-display: 'Space Mono', ui-monospace, monospace;
  --font-body: 'Work Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  background-image:
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 4px);
}

a { color: inherit; }

button, input, textarea, select {
  font-family: inherit;
}

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

/* Header */
header.site {
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}

header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.logo-mark {
  width: 26px;
  height: 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}
.logo-mark span {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.logo-mark span:nth-child(1) { width: 100%; opacity: 1; }
.logo-mark span:nth-child(2) { width: 75%; background: var(--accent-2); }
.logo-mark span:nth-child(3) { width: 50%; opacity: 0.8; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

nav.site a {
  font-size: 14px;
  text-decoration: none;
  color: var(--muted);
  margin-left: 20px;
  transition: color .15s ease;
}
nav.site a:hover, nav.site a.active { color: var(--text); }

/* Hero */
.hero {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  margin: 8px 0 12px;
}
.hero p {
  color: var(--muted);
  max-width: 560px;
  font-size: 15px;
  line-height: 1.6;
}

/* Filtros / chips */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 24px 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.chip:hover { border-color: #454b55; color: var(--text); }
.chip.active { color: var(--text); background: var(--panel-2); border-color: #454b55; }
.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.chip .count {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--muted);
}

/* Grid de la galeria */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  padding: 8px 0 64px;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}

.card .progress {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  transition: width .35s ease;
  z-index: 2;
}
.card:hover .progress { width: 100%; }

.card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--panel-2);
}

.card .meta {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card .meta .title {
  font-size: 14px;
  font-weight: 500;
}
.card .meta .cat {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card .meta .cat .dot { width: 7px; height: 7px; border-radius: 50%; }

.empty-state {
  padding: 64px 0;
  text-align: center;
  color: var(--muted);
}
.empty-state .eyebrow { display: block; margin-bottom: 8px; }

/* Login / formularios */
.auth-wrap {
  min-height: calc(100vh - 90px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}
.auth-card h1 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 6px;
}
.auth-card p.sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 70px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #14161a;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .15s ease;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255,93,108,0.4);
}
.btn.small { padding: 6px 12px; font-size: 12px; }

.error-msg {
  background: rgba(255,93,108,0.1);
  border: 1px solid rgba(255,93,108,0.35);
  color: #ff9aa3;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Admin */
.admin-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  padding: 32px 0 64px;
  align-items: start;
}
@media (max-width: 860px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 16px;
  color: var(--muted);
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.cat-row:last-child { border-bottom: none; }
.cat-row .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cat-row .name { flex: 1; font-size: 14px; }
.cat-row .count { font-family: var(--font-display); font-size: 11px; color: var(--muted); }
.cat-row .actions { display: flex; gap: 6px; }
.cat-row .actions button {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px;
  padding: 4px 6px;
}
.cat-row .actions button:hover { color: var(--text); }

.admin-image-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.admin-image-row:last-child { border-bottom: none; }
.admin-image-row img {
  width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--panel-2);
  flex-shrink: 0;
}
.admin-image-row .info { flex: 1; min-width: 0; }
.admin-image-row .info .t { font-size: 13px; margin-bottom: 2px; }
.admin-image-row .info .c {
  font-family: var(--font-display); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10,11,13,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 32px;
}
.lightbox.show { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox .caption {
  position: absolute;
  bottom: 32px;
  left: 0; right: 0;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
}
.lightbox .close {
  position: absolute;
  top: 24px; right: 32px;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
  background: none;
  border: none;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: -8px;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
