/* ============================================================
   CARIBE INK · Panel de administración
   ============================================================ */

:root {
  --black: #060606;
  --ink: #0c0c0c;
  --panel: #121212;
  --panel-2: #1a1a1a;
  --line: rgba(236, 229, 216, 0.1);
  --red: #d92332;
  --gold: #f2c14e;
  --jungle: #2f7d5b;
  --bone: #ece5d8;
  --muted: #9a9284;
  --font-black: 'Pirata One', serif;
  --font-head: 'Bebas Neue', sans-serif;
  --font-body: 'Jost', sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  background: var(--black);
  color: var(--bone);
  font-family: var(--font-body);
  font-weight: 300;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--red); color: var(--bone); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- login ---------- */

.login-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 115%, rgba(47, 125, 91, 0.18), transparent 65%),
    radial-gradient(ellipse 40% 35% at 85% 0%, rgba(217, 35, 50, 0.14), transparent 70%),
    var(--black);
  z-index: 100;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}
.login-screen.hidden { opacity: 0; visibility: hidden; }

.login-card {
  width: min(400px, 90vw);
  border: 1px solid var(--line);
  background: var(--ink);
  padding: 2.6rem 2.2rem;
  text-align: center;
  animation: card-in 0.7s var(--ease-out);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
}
.login-logo { font-family: var(--font-black); font-size: 2.6rem; color: var(--red); }
.login-logo span { color: var(--gold); }
.login-card h1 {
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 1.1rem;
  letter-spacing: 0.34em;
  color: var(--muted);
  margin: 0.4rem 0 2rem;
}
.login-card input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--bone);
  font-family: var(--font-head);
  font-size: 1.6rem;
  letter-spacing: 0.8em;
  text-indent: 0.8em;
  text-align: center;
  padding: 0.9rem 0.5rem;
  margin-bottom: 1.2rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.12);
}
.login-card.error { animation: shake 0.5s; }
.login-card.error input { border-color: var(--red); }
@keyframes shake {
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}
.login-hint { color: var(--muted); font-size: 0.8rem; margin-top: 1rem; }
.login-hint a { color: var(--gold); }

/* ---------- estructura de app ---------- */

.admin-app { display: none; min-height: 100vh; }
.admin-app.authed { display: grid; grid-template-columns: 232px 1fr; }
@media (max-width: 860px) { .admin-app.authed { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--ink);
  border-right: 1px solid var(--line);
  padding: 1.6rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
@media (max-width: 860px) {
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

.sidebar-logo {
  font-family: var(--font-black);
  font-size: 1.7rem;
  color: var(--red);
  padding: 0 0.8rem 1.2rem;
}
.sidebar-logo span { color: var(--gold); }
@media (max-width: 860px) { .sidebar-logo { padding: 0 0.8rem; } }

.side-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 1.02rem;
  letter-spacing: 0.14em;
  padding: 0.7rem 0.9rem;
  text-align: left;
  transition: color 0.25s, background 0.25s, border-color 0.25s;
}
.side-btn:hover { color: var(--bone); background: var(--panel); }
.side-btn.active { color: var(--gold); border-left-color: var(--gold); background: var(--panel); }
.side-btn .badge {
  margin-left: auto;
  background: var(--red);
  color: var(--bone);
  font-size: 0.72rem;
  padding: 0.06rem 0.5rem;
  border-radius: 99px;
  font-family: var(--font-body);
}
.sidebar-foot { margin-top: auto; display: grid; gap: 0.3rem; }
@media (max-width: 860px) { .sidebar-foot { margin-top: 0; margin-left: auto; display: flex; } }

.main {
  padding: clamp(1.4rem, 3.5vw, 3rem);
  max-width: 1180px;
  width: 100%;
}

.panel-title {
  font-family: var(--font-head);
  font-weight: 400;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.panel-sub { color: var(--muted); margin-bottom: 2rem; font-size: 0.95rem; }

.tab-panel { display: none; animation: panel-in 0.5s var(--ease-out); }
.tab-panel.active { display: block; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(18px); }
}

/* ---------- tarjetas de métricas ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 2.2rem;
}
.metric {
  border: 1px solid var(--line);
  background: var(--ink);
  padding: 1.3rem 1.2rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), border-color 0.35s;
}
.metric:hover { transform: translateY(-4px); border-color: rgba(242, 193, 78, 0.4); }
.metric b {
  font-family: var(--font-head);
  font-size: 2.3rem;
  line-height: 1;
  color: var(--gold);
  display: block;
}
.metric.metric-red b { color: var(--red); }
.metric.metric-green b { color: #58c98f; }
.metric small {
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

/* ---------- tablas / listas ---------- */

.data-list { display: grid; gap: 0.8rem; }

.data-row {
  border: 1px solid var(--line);
  background: var(--ink);
  padding: 1.1rem 1.2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem;
  align-items: center;
  transition: border-color 0.3s, background 0.3s;
  animation: panel-in 0.4s var(--ease-out) backwards;
}
.data-row:hover { border-color: rgba(236, 229, 216, 0.22); background: var(--panel); }

.row-main b { font-weight: 500; font-size: 1.02rem; display: block; }
.row-main .row-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }
.row-main .row-meta em { color: var(--gold); font-style: normal; }
.row-idea {
  grid-column: 1 / -1;
  color: var(--bone);
  font-size: 0.92rem;
  background: var(--panel);
  border-left: 2px solid var(--red);
  padding: 0.6rem 0.9rem;
}

.row-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; justify-content: flex-end; }

.chip {
  font-family: var(--font-head);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.25s;
}
.chip:hover { color: var(--bone); border-color: var(--gold); transform: translateY(-1px); }
.chip.danger:hover { color: var(--red); border-color: var(--red); }
.chip.gold { color: var(--gold); border-color: rgba(242, 193, 78, 0.4); }
.chip.green { color: #58c98f; border-color: rgba(88, 201, 143, 0.4); }

.status-tag {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.16rem 0.6rem;
  border-radius: 99px;
  border: 1px solid;
}
.status-nueva      { color: var(--gold); border-color: rgba(242, 193, 78, 0.5); background: rgba(242, 193, 78, 0.08); }
.status-confirmada { color: #58c98f; border-color: rgba(88, 201, 143, 0.5); background: rgba(88, 201, 143, 0.08); }
.status-hecha      { color: var(--muted); border-color: var(--line); }
.status-descartada { color: var(--red); border-color: rgba(217, 35, 50, 0.5); background: rgba(217, 35, 50, 0.07); }

.empty-note {
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
  padding: 2.4rem 1rem;
  font-size: 0.95rem;
}

/* ---------- formularios ---------- */

.editor {
  border: 1px solid var(--line);
  background: var(--ink);
  padding: 1.6rem;
  margin-bottom: 1.6rem;
  display: grid;
  gap: 1rem;
}
.editor h3 {
  font-family: var(--font-head);
  font-weight: 400;
  letter-spacing: 0.12em;
  font-size: 1.25rem;
  color: var(--gold);
}
.editor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }

.field { display: grid; gap: 0.35rem; }
.field label {
  font-family: var(--font-head);
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--muted);
}
.field input, .field select, .field textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 0.96rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0;
  width: 100%;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.1);
}

.btn {
  font-family: var(--font-head);
  font-size: 1rem;
  letter-spacing: 0.16em;
  padding: 0.8rem 1.8rem;
  border: 1px solid var(--gold);
  color: var(--gold);
  background: transparent;
  transition: background 0.3s, color 0.3s, transform 0.3s;
  justify-self: start;
}
.btn:hover { background: var(--gold); color: var(--black); transform: translateY(-2px); }
.btn.btn-red { border-color: var(--red); color: var(--red); }
.btn.btn-red:hover { background: var(--red); color: var(--bone); }
.btn.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn.btn-ghost:hover { background: var(--panel-2); color: var(--bone); transform: none; }

/* miniatura de galería en admin */
.g-thumb {
  width: 54px; height: 54px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  place-items: center;
  padding: 7px;
  flex: none;
  overflow: hidden;
}
.g-thumb svg { width: 100%; height: 100%; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-with-thumb { display: flex; gap: 0.9rem; align-items: center; }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  transform: translate(-50%, 140%);
  background: var(--panel-2);
  border: 1px solid rgba(242, 193, 78, 0.5);
  color: var(--bone);
  padding: 0.85rem 1.6rem;
  font-size: 0.94rem;
  z-index: 500;
  transition: transform 0.45s var(--ease-out);
  max-width: 90vw;
}
#toast.show { transform: translate(-50%, 0); }
#toast.err { border-color: var(--red); }

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