/* ============================================
   ANGEL TATTOOS — PANEL DE GALERÍA
   ============================================ */

:root {
  --black: #0a0a0a;
  --black-soft: #121212;
  --card: #1a1717;
  --card-hot: #221515;
  --red: #8a0f14;
  --red-bright: #c81f2b;
  --red-glow: #e2313d;
  --silver: #b8b8b8;
  --silver-light: #e6e6e6;
  --white: #f5f5f2;
  --green: #2fbf62;
  --border: rgba(230, 230, 230, 0.12);
  --border-strong: rgba(230, 230, 230, 0.22);

  --font-display: 'Pirata One', cursive;
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 12px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

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

html { scrollbar-color: var(--red) var(--black); }

body {
  min-height: 100vh;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--red-bright); color: #fff; }
:focus-visible { outline: 2px solid var(--red-glow); outline-offset: 2px; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Botones ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 140ms var(--ease-out), background-color 200ms ease, border-color 200ms ease, opacity 200ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--primary { background: linear-gradient(135deg, var(--red-bright), var(--red)); color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45); }
.btn--ghost { border: 1px solid var(--border-strong); color: var(--silver-light); }
.btn--sm { min-height: 38px; padding: 0.45rem 0.95rem; font-size: 0.85rem; }
.btn--block { width: 100%; }
@media (hover: hover) {
  .btn--ghost:hover { border-color: var(--red-bright); color: #fff; }
  .btn--primary:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55); }
}

/* ===== Login ===== */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
  background:
    radial-gradient(ellipse at top, rgba(138, 15, 20, 0.25), transparent 60%),
    var(--black);
}
.login__card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem 1.5rem;
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}
.login__logo {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 50%;
  border: 2px solid var(--red-bright);
}
.login__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.2rem;
  line-height: 1;
  text-align: center;
  color: var(--silver-light);
}
.login__title span { color: var(--red-bright); }
.login__subtitle { text-align: center; color: var(--silver); margin-top: -0.6rem; }
.login__error { min-height: 1.4em; color: #ff7b84; font-size: 0.9rem; text-align: center; }
.login__back { text-align: center; color: var(--silver); font-size: 0.85rem; text-underline-offset: 3px; }
.login__card.is-shake { animation: shake 360ms var(--ease-out); }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field__label { font-size: 0.85rem; font-weight: 500; color: var(--silver-light); }
.field__input {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.9rem;
  background: var(--black);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--white);
  font: inherit;
  font-size: 16px; /* evita el zoom automático en iPhone */
  transition: border-color 200ms ease;
}
.field__input:focus { outline: none; border-color: var(--red-bright); }
.field__pass { position: relative; display: block; }
.field__pass .field__input { padding-right: 3rem; }
.field__toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  translate: 0 -50%;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--silver);
}
.field__toggle svg { width: 20px; height: 20px; }
.field__toggle[aria-pressed="true"] { color: var(--red-glow); }

/* ===== Barra superior ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem clamp(1rem, 4vw, 2rem);
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; }
.topbar__brand img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--red-bright); }
.topbar__brand span { font-family: var(--font-display); font-size: 1.35rem; color: var(--silver-light); }
.topbar__brand b { font-weight: 400; color: var(--red-bright); }
.topbar__actions { display: flex; align-items: center; gap: 0.5rem; }
.topbar__user { color: var(--silver); font-size: 0.85rem; margin-right: 0.25rem; }
@media (max-width: 520px) {
  .topbar__user, .topbar__brand span { display: none; }
}

/* ===== Contenido ===== */
.wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2rem) 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.panel {
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(1rem, 3vw, 1.6rem);
}
.panel__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 1rem; }
.panel__title { font-family: var(--font-display); font-weight: 400; font-size: 1.8rem; line-height: 1.1; color: var(--silver-light); }
.panel > .panel__title { margin-bottom: 1rem; }
.panel__note { color: var(--silver); font-size: 0.85rem; }
.count { color: var(--red-glow); }

/* ===== Zona de subida ===== */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  text-align: center;
  border: 2px dashed rgba(200, 31, 43, 0.5);
  border-radius: var(--radius);
  background: rgba(138, 15, 20, 0.06);
  cursor: pointer;
  transition: border-color 200ms ease, background-color 200ms ease;
}
.drop:active { transform: scale(0.99); }
.drop.is-over, .drop:focus-within { border-color: var(--red-glow); background: rgba(200, 31, 43, 0.12); }
@media (hover: hover) { .drop:hover { border-color: var(--red-glow); background: rgba(200, 31, 43, 0.1); } }
.drop__icon { width: 40px; height: 40px; color: var(--red-glow); }
.drop__main { font-size: 1.05rem; }
.drop__or { color: var(--silver); }
@media (hover: none) { .drop__or { display: none; } }
.drop__hint { color: var(--silver); font-size: 0.82rem; max-width: 46ch; }

/* ===== Cola de subida ===== */
.queue { margin-top: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.queue__total-text { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.4rem; font-size: 0.92rem; }
.queue__total-text b { font-variant-numeric: tabular-nums; font-size: 1.1rem; color: var(--white); }

.bar { height: 8px; border-radius: 99px; background: rgba(230, 230, 230, 0.1); overflow: hidden; }
.bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--red), var(--red-glow));
  transform: scaleX(var(--p, 0));
  transform-origin: left;
  transition: transform 240ms var(--ease-out);
}
.is-done .bar span { background: var(--green); }
.is-error .bar span { background: #6b6b6b; }

.queue__list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.qitem {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.qitem__thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--black) center / cover no-repeat;
}
.qitem__body { min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.qitem__name { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem__status { font-size: 0.78rem; color: var(--silver); }
.is-done .qitem__status { color: #7be0a0; }
.is-error .qitem__status { color: #ff7b84; }
.qitem__pct { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.95rem; min-width: 3.2em; text-align: right; }
.is-done .qitem__pct { color: #7be0a0; }

/* ===== Fotos publicadas ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.75rem;
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 200ms ease, opacity 200ms ease;
}
.card.is-busy { opacity: 0.6; pointer-events: none; }
.card__media { position: relative; aspect-ratio: 1; background: var(--black); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__pos {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  min-width: 28px;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  background: rgba(10, 10, 10, 0.8);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.card__progress {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.5rem;
  background: linear-gradient(transparent, rgba(10, 10, 10, 0.9));
  font-size: 0.8rem;
}
.card__progress .bar { margin-top: 0.3rem; height: 6px; }

.card__body { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.7rem; }
.card__alt {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.65rem;
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--white);
  font: inherit;
  font-size: 0.85rem;
}
.card__alt:focus { outline: none; border-color: var(--red-bright); }
.card__alt-label { font-size: 0.75rem; color: var(--silver); display: flex; justify-content: space-between; }
.card__saved { color: #7be0a0; opacity: 0; transition: opacity 200ms ease; }
.card__saved.is-on { opacity: 1; }

.card__actions { display: flex; align-items: center; gap: 0.35rem; }
.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--silver-light);
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, transform 140ms var(--ease-out);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
@media (hover: hover) { .icon-btn:not(:disabled):hover { border-color: var(--silver); color: #fff; } }
.card__actions .spacer { flex: 1; }
.btn-replace { width: 100%; border-radius: 8px; font-weight: 500; padding-inline: 0.5rem; gap: 0.35rem; }
.btn-replace svg { width: 16px; height: 16px; flex: none; }
@media (max-width: 699px) {
  .btn-replace { font-size: 0.8rem; }
  .card__body { padding: 0.6rem; gap: 0.5rem; }
}
.btn-delete { color: #ff8a92; }
@media (hover: hover) { .btn-delete:not(:disabled):hover { background: var(--red-bright); border-color: var(--red-bright); color: #fff; } }

/* Confirmación de borrado dentro de la tarjeta */
.confirm {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1rem;
  text-align: center;
  background: rgba(10, 10, 10, 0.92);
  animation: fade 160ms ease;
}
.confirm p { font-size: 0.92rem; }
.confirm div { display: flex; gap: 0.5rem; }
.btn--danger { background: var(--red-bright); color: #fff; }
@keyframes fade { from { opacity: 0; } }

.empty { color: var(--silver); text-align: center; padding: 2rem 1rem; }

.skeleton { aspect-ratio: 0.78; border-radius: var(--radius); background: linear-gradient(100deg, var(--card) 40%, #241f1f 50%, var(--card) 60%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== Avisos ===== */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  translate: -50% 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #241d1d;
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  animation: toastIn 260ms var(--ease-out);
}
.toast--error { border-color: rgba(226, 49, 61, 0.6); }
.toast--ok { border-color: rgba(47, 191, 98, 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

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