/*
  Stylesheet: Panel Personal Dark Premium
  Autor: ChatGPT
  Descripción: Versión moderna y oscura de tu panel, con gradientes, glow y animaciones premium.
*/

/* =====================
   Variables de diseño
===================== */
:root {
  /* Paleta principal */
  --primary: #121212; /* Fondo principal */
  --dark-bg: #121212;
  --accent: #0af; /* Azul neón */
  --red: #ff4d4d;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #0ea5e9;

  /* Tonos derivados */
  --bg: #121212;
  --card: #1e1e1e;
  --text: #e0e0e0;
  --muted: #a0a0a0;
  --line: #2a2a2a;
  --radius: 0.75rem;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* =====================
   Reset + tipografía
===================== */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  scroll-behavior: smooth;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}
img {
  max-width: 100%;
  display: block;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
}
a:hover {
  text-decoration: underline;
  color: #0ff;
}

/* =====================
   Header
===================== */
header.app-header {
  background: linear-gradient(135deg, #1b1b1b, #222);
  color: #fff;
  padding: clamp(14px, 2vw, 20px) clamp(14px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  justify-content: center; /* centra todo */
  text-align: center;
  position: relative;
}

#auth-section {
  position: absolute;
  right: 20px;
  top: 20px;
}
.app-title {
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: 2.2rem;
  margin-bottom: 8px;
}
.app-title .dot {
  color: var(--accent);
}

/* =====================
   Layout general
===================== */
.main-wrap {
  padding: clamp(16px, 2.5vw, 28px);
  max-width: 1200px;
  margin: 0 auto;
}

/* =====================
   Botones premium
===================== */
.btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 8px var(--accent);
}
.btn:active {
  transform: translateY(0);
}
.btn--primary {
  background: linear-gradient(135deg, var(--accent), #0ff);
  color: var(--primary);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 255, 255, 0.4);
}
.btn--danger {
  background: linear-gradient(135deg, #ff4d4d, #ff6a6a);
  color: #121212;
  border: none;
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn--success {
  background: linear-gradient(135deg, var(--success), #4ade80);
  color: var(--primary);
  border: none;
}
.btn--warn {
  background: linear-gradient(135deg, var(--warning), #fbbf24);
  color: var(--primary);
  border: none;
}

/* =====================
   Tarjetas / contenedores
===================== */
.card,
.list-item,
#libros-lista > * {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(14px, 2vw, 18px);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.card:hover,
.list-item:hover,
#libros-lista > *:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.75), 0 0 12px var(--accent);
}

/* =====================
   Formularios premium
===================== */
.input,
.select,
.textarea {
  background: #1a1a1a;
  color: var(--text);
  border: 1px solid #333;
  border-radius: calc(var(--radius)-2px);
  padding: 10px 12px;
  outline: none;
  transition: all 0.25s ease;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
form.card {
  display: grid;
  gap: 12px;
}

/* =====================
   Tabs
===================== */
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
  margin: 6px 0 18px;
  justify-content: center;
}
.tab-btn {
  background: #1a1a1a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  transition: all 0.25s ease;
}
.tab-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6), 0 0 6px var(--accent);
}
.tab-btn.is-active {
  background: var(--accent);
  color: #121212;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 255, 255, 0.4);
}

/* =====================
   Progress
===================== */
.progress {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: calc(var(--value) * 1%);
  background: linear-gradient(90deg, var(--accent), #0ff);
  transition: width 0.3s ease;
}

/* =====================
   Estrellas de valoración
===================== */
.stars {
  --rating: 0;
  display: inline-block;
  font-size: 1rem;
  unicode-bidi: bidi-override;
  direction: rtl;
  position: relative;
}
.stars::before {
  content: "★★★★★";
  color: #444;
}
.stars::after {
  content: "★★★★★";
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  width: calc(var(--rating) / 5 * 100%);
  color: #fbbf24;
}

/* =====================
   Badges
===================== */
.badge--ok {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}
.badge--warn {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

/* =====================
   Lista de libros / grid
===================== */
.grid {
  display: grid;
  gap: 16px;
}
.grid--cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.book-card {
  display: grid;
  gap: 10px;
}
.book-cover {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius)-2px);
  aspect-ratio: 3/4;
  background: #1a1a1a;
  border: 1px solid #333;
}
.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease, filter 0.25s ease;
}
.book-cover:hover img {
  transform: scale(1.05);
  filter: brightness(1.1);
}
.book-title {
  font-weight: 800;
  font-size: 1.05rem;
}

/* =====================
   Footer
===================== */
.footer {
  color: var(--muted);
  border-top: 1px solid #2a2a2a;
  padding: 18px 0;
  text-align: center;
}

/* =====================
   Utilidades
===================== */
.hidden {
  display: none !important;
}
.center {
  display: grid;
  place-items: center;
}
.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stack-sm {
  display: grid;
  gap: 6px;
}
.stack-md {
  display: grid;
  gap: 12px;
}
.stack-lg {
  display: grid;
  gap: 18px;
}
/* =====================
   Checkbox estilos
===================== */
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* =====================
   Pequeñas animaciones
===================== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px; /* espacio entre botón y título */
}
#back-btn {
  position: relative;
  left: -100px; /* ajusta hacia la izquierda */
  top: 5px; /* ajusta hacia abajo */
}
#login-btn {
  position: relative;
  top: 10px; /* lo baja un poco */
  left: 0; /* se mantiene alineado con su contenedor */
}

@media (max-width: 480px) {
  header.app-header {
    flex-direction: column; /* apila elementos verticalmente */
    align-items: center;
    gap: 12px;
  }
  .app-title {
    font-size: 1.5rem;
  }
  #login-btn {
    font-size: 0.9rem;
    padding: 4px 8px;
  }
  #back-btn {
    margin-right: 0;
  }
}
@media (max-width: 600px) {
  .book-cover img {
    width: 80px;
    height: 120px;
  }
}
@media (max-width: 480px) {
  #auth-section {
    position: static; /* quita absolute */
    flex-direction: row;
    justify-content: center; /* centrado */
    margin-top: 8px;
    gap: 8px;
  }
  #login-btn,
  #logout-btn {
    font-size: 0.9rem;
    padding: 6px 12px;
    width: auto; /* que no se achique demasiado */
  }
}
