/* ============================================================
   Musical Island — Inventario · app.css
   Paleta: #000000 · #1e1534 · #ce8c6d · #ffffff
   Mobile-first · Light (default) · Dark (toggle)
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   LIGHT MODE — Default (fondo blanco, texto oscuro)
   ══════════════════════════════════════════════════════════ */
:root,
[data-theme="light"] {
  /* Fondos */
  --bg:           #f4f5f7;
  --bg-card:      #ffffff;
  --bg-sidebar:   #ffffff;
  --bg-input:     #f0f1f3;

  /* Bordes */
  --border:       rgba(0,0,0,0.10);
  --border-focus: #ce8c6d;

  /* Colores de marca */
  --salmon:       #ce8c6d;
  --salmon-light: #e0a888;
  --accent:       #1e1534;

  /* Texto — SIEMPRE oscuro en light */
  --text:         #000000;
  --text-60:      rgba(0,0,0,0.55);
  --text-30:      rgba(0,0,0,0.35);
  --text-10:      rgba(0,0,0,0.07);

  /* Sombras */
  --shadow:       0 2px 16px rgba(0,0,0,0.08);

  /* Alias legacy */
  --white:        #000000;
  --white-60:     rgba(0,0,0,0.55);
  --white-30:     rgba(0,0,0,0.35);
  --white-10:     rgba(0,0,0,0.07);
}

/* ══════════════════════════════════════════════════════════
   DARK MODE — (fondo oscuro morado/negro, texto blanco)
   ══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* Fondos — paleta Musical Island */
  --bg:           #000000;
  --bg-card:      #0d0820;
  --bg-sidebar:   #1e1534;
  --bg-input:     #2a1d4a;

  /* Bordes */
  --border:       rgba(206,140,109,0.15);
  --border-focus: #ce8c6d;

  /* Colores de marca */
  --salmon:       #ce8c6d;
  --salmon-light: #e0a888;
  --accent:       #ce8c6d;

  /* Texto — SIEMPRE claro en dark */
  --text:         #ffffff;
  --text-60:      rgba(255,255,255,0.65);
  --text-30:      rgba(255,255,255,0.35);
  --text-10:      rgba(255,255,255,0.08);

  /* Sombras */
  --shadow:       0 2px 20px rgba(0,0,0,0.5);

  /* Alias legacy */
  --white:        #ffffff;
  --white-60:     rgba(255,255,255,0.65);
  --white-30:     rgba(255,255,255,0.35);
  --white-10:     rgba(255,255,255,0.08);
}

/* ── Tokens comunes (no cambian con el tema) ─────────────── */
:root {
  --font:       'Outfit', sans-serif;
  --radius:     10px;
  --radius-sm:  6px;
  --sidebar-w:  260px;
  --topbar-h:   60px;
  --transition: 0.22s ease;
}

/* ══════════════════════════════════════════════════════════
   ESTILOS BASE — se adaptan con variables
   ══════════════════════════════════════════════════════════ */

/* Sidebar */
.sidebar {
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Topbar */
.topbar {
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

/* Nav items */
.nav-item          { color: var(--text-60); }
.nav-item:hover    { background: var(--text-10); color: var(--text); }
.nav-item.active   { background: rgba(206,140,109,0.12); color: var(--salmon); font-weight: 700; }
.nav-section-label { color: var(--text-30); }
.cat-prefix        { background: var(--text-10); color: var(--text-60); }
.logo-title        { color: var(--text); }
.logo-sub          { color: var(--salmon); }
.user-name         { color: var(--text); }
.user-role         { color: var(--salmon); }
.topbar-user       { color: var(--text-60); }

/* Tabla */
thead tr           { background: var(--bg-input); }
thead th           { color: var(--text-30); }
tbody td           { color: var(--text); }
tbody tr:hover     { background: var(--text-10); }
.td-codigo         { color: var(--salmon); font-weight: 700; }
.td-nombre         { color: var(--text); font-weight: 600; }
.td-sub            { color: var(--text-60); }

/* Selects y options — fix dropdown oscuro en light */
/* ── Selects — fix Windows dropdown color ────────────────── */
.filter-select,
.form-select,
select {
  color: var(--text) !important;
  background-color: var(--bg-input) !important;
  color-scheme: light;
}

[data-theme="dark"] .filter-select,
[data-theme="dark"] .form-select,
[data-theme="dark"] select {
  color-scheme: dark;
  color: #ffffff !important;
  background-color: #2a1d4a !important;
}

/* Option elements — forced white bg + dark text in light mode */
.filter-select option,
.form-select option,
select option {
  background-color: #ffffff !important;
  color: #000000 !important;
}

[data-theme="dark"] .filter-select option,
[data-theme="dark"] .form-select option,
[data-theme="dark"] select option {
  background-color: #1e1534 !important;
  color: #ffffff !important;
}

/* Inputs */
.form-input,
.form-textarea,
.search-input {
  color: var(--text);
  background: var(--bg-input);
}

.form-input::placeholder,
.form-textarea::placeholder,
.search-input::placeholder { color: var(--text-30); }

/* Form labels */
.form-label { color: var(--salmon); }

/* Cards */
.stat-card,
.form-card,
.equipo-card,
.historial-item {
  background: var(--bg-card);
  border-color: var(--border);
}

/* Historial diff */
.h-old { background: rgba(248,113,113,0.12); color: #dc2626; }
.h-new { background: rgba(34,197,94,0.12);   color: #16a34a; }
.h-desc { color: var(--text); }
.h-meta { color: var(--text-30); }

/* Dark override para historial diff */
[data-theme="dark"] .h-old { color: #f87171; }
[data-theme="dark"] .h-new { color: #4ade80; }

/* Sidebar dark extras */
[data-theme="dark"] .sidebar     { box-shadow: none; }
[data-theme="dark"] .topbar      { box-shadow: none; box-shadow: 0 1px 0 rgba(206,140,109,0.1); }
[data-theme="dark"] .menu-toggle { border-color: rgba(206,140,109,0.2); color: var(--text-60); }

/* Dark — nav active usa morado */
[data-theme="dark"] .nav-item.active {
  background: rgba(206,140,109,0.15);
  color: var(--salmon);
}

/* Dark — user avatar */
[data-theme="dark"] .user-avatar {
  background: rgba(206,140,109,0.15);
  border-color: rgba(206,140,109,0.3);
}

/* Login card */
.login-card {
  box-shadow: var(--shadow);
}

/* Modal */
.modal {
  background: var(--bg-card);
  border-color: var(--border);
}
.modal-title { color: var(--text); }
.modal-body  { color: var(--text-60); }

/* Page titles */
.page-title    { color: var(--text); }
.page-subtitle { color: var(--text-60); }

/* Stat card */
.stat-num   { color: var(--text); }
.stat-label { color: var(--text-60); }

/* Cat card */
.cat-card-name  { color: var(--text); }
.cat-card-count { color: var(--text-60); }

/* Empty state */
.empty-state   { color: var(--text-30); }
.no-results    { color: var(--text-30); }

/* Scrollbar (dark) */
[data-theme="dark"] ::-webkit-scrollbar       { width: 6px; }
[data-theme="dark"] ::-webkit-scrollbar-track  { background: #000; }
[data-theme="dark"] ::-webkit-scrollbar-thumb  { background: #2a1d4a; border-radius: 3px; }

/* ── Transición suave al cambiar tema ────────────────────── */
body, .sidebar, .topbar, .main-content,
.form-card, .stat-card, .cat-card, .equipo-card,
.table-wrap, .historial-item, .login-card, .modal,
.nav-item, .btn, .form-input, .form-select,
.form-textarea, .search-input, .filter-select,
thead tr, tbody td, .page-title, .page-subtitle {
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition);
}

/* ── Botón toggle tema ───────────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-60);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--border-focus); color: var(--salmon); }

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width:100%; display:block; }
button { font-family: var(--font); }

/* ── Layout ──────────────────────────────────────────────── */
.app-wrap {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--salmon);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #000;
  font-size: 16px;
  flex-shrink: 0;
}

.logo-title {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--white);
}

.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--salmon);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--white-60);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  display: flex;
}

/* ── Nav ─────────────────────────────────────────────────── */
.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--white-30);
  text-transform: uppercase;
  padding: 16px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--white-60);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: var(--white-10);
  color: var(--white);
}

.nav-item.active {
  background: rgba(206,140,109,0.12);
  color: var(--salmon);
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-cat {
  padding-left: 14px;
}

.cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-prefix {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--white-30);
  background: var(--white-10);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Sidebar footer ──────────────────────────────────────── */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(206,140,109,0.2);
  border: 1px solid var(--salmon);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--salmon);
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.user-role {
  font-size: 10px;
  color: var(--salmon);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.btn-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--white-30);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  transition: color var(--transition);
  flex-shrink: 0;
}

.btn-logout:hover { color: #f87171; }

/* ── Overlay ─────────────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
}

.overlay.show { display: block; }

/* ── Main content ────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 0;
  transition: margin-left 0.28s ease;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.menu-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--white-60);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all var(--transition);
}

.menu-toggle:hover {
  background: var(--white-10);
  color: var(--white);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-user {
  font-size: 13px;
  color: var(--white-60);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Page body ───────────────────────────────────────────── */
.page-body {
  padding: 24px 20px;
  flex: 1;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-title span {
  color: var(--salmon);
}

.page-subtitle {
  font-size: 13px;
  color: var(--white-60);
  margin-top: 4px;
  font-weight: 300;
}

/* ── Cards de stats ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition);
}

.stat-card:hover {
  border-color: rgba(206,140,109,0.25);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.stat-num {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--white);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--white-60);
  font-weight: 400;
}

/* ── Categorías en dashboard ─────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 28px;
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}

.cat-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(206,140,109,0.2);
}

.cat-color-bar {
  width: 4px;
  height: 44px;
  border-radius: 2px;
  flex-shrink: 0;
}

.cat-card-info {
  flex: 1;
}

.cat-card-name {
  font-size: 14px;
  font-weight: 700;
}

.cat-card-count {
  font-size: 12px;
  color: var(--white-60);
  margin-top: 2px;
}

.cat-card-prefix {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--white-10);
  color: var(--white-60);
}

/* ── Último equipo añadido ───────────────────────────────── */
.ultimo-equipo {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.ultimo-foto {
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.ultimo-info-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--salmon);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}

.ultimo-info-nombre {
  font-size: 16px;
  font-weight: 800;
}

.ultimo-info-codigo {
  font-size: 12px;
  color: var(--white-60);
  margin-top: 2px;
}

/* ── Buscador ────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input-wrap i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--white-30);
  font-size: 14px;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  padding: 11px 14px 11px 38px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus {
  border-color: var(--border-focus);
}

.search-input::placeholder {
  color: var(--white-30);
}

/* ── Filtros ─────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.filter-select:focus {
  border-color: var(--border-focus);
}

.filter-select option {
  background: #1a1a24;
}

/* ── Tabla ───────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 13px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white-30);
  text-align: left;
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(255,255,255,0.025);
}

tbody td {
  padding: 13px 16px;
  font-size: 13.5px;
  vertical-align: middle;
}

.td-foto {
  width: 52px;
}

.td-foto img {
  width: 44px; height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.td-codigo {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--salmon);
  white-space: nowrap;
}

.td-nombre {
  font-weight: 600;
}

.td-sub {
  font-size: 12px;
  color: var(--white-60);
}

.td-actions {
  display: flex;
  gap: 6px;
}

/* ── Vista cards (móvil) ─────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.equipo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.equipo-card:hover {
  border-color: rgba(206,140,109,0.25);
}

.equipo-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-input);
  cursor: zoom-in;
}

.equipo-card-body {
  padding: 14px;
}

.equipo-card-codigo {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--salmon);
  margin-bottom: 4px;
}

.equipo-card-nombre {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.equipo-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.equipo-card-actions {
  display: flex;
  gap: 8px;
}

/* ── Toggle vista ────────────────────────────────────────── */
.view-toggle {
  display: flex;
  gap: 4px;
}

.view-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--white-60);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
}

.view-btn.active, .view-btn:hover {
  background: rgba(206,140,109,0.12);
  border-color: rgba(206,140,109,0.3);
  color: var(--salmon);
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.badge-green  { background: rgba(52,211,153,0.15); color: #34d399; }
.badge-yellow { background: rgba(251,191,36,0.15);  color: #fbbf24; }
.badge-red    { background: rgba(248,113,113,0.15); color: #f87171; }
.badge-blue   { background: rgba(96,165,250,0.15);  color: #60a5fa; }
.badge-gray   { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* ── Botones ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--salmon);
  color: #000;
}

.btn-primary:hover {
  background: var(--salmon-light);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-60);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--border-focus);
  color: var(--salmon);
  background: var(--bg-card);
}

.btn-danger {
  background: rgba(248,113,113,0.10);
  color: #dc2626;
  border: 1px solid rgba(248,113,113,0.25);
}

.btn-danger:hover {
  background: rgba(248,113,113,0.20);
}

[data-theme="dark"] .btn-danger {
  color: #f87171;
  border-color: rgba(248,113,113,0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 7px;
  width: 32px; height: 32px;
  justify-content: center;
}

/* ── Formularios ─────────────────────────────────────────── */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--salmon);
  text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--white-30);
}

.form-select option {
  background: #1a1a24;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 11px;
  color: var(--white-30);
}

/* ── Upload foto ─────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--salmon);
  background: rgba(206,140,109,0.04);
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  font-size: 32px;
  color: var(--white-30);
  margin-bottom: 10px;
}

.upload-text {
  font-size: 14px;
  color: var(--white-60);
}

.upload-hint {
  font-size: 11px;
  color: var(--white-30);
  margin-top: 6px;
}

.upload-preview {
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin: 12px auto 0;
  display: none;
  cursor: zoom-in;
  border: 1px solid var(--border);
}

/* Foto en ficha de equipo — 250x250 cuadrada */
.equipo-foto-thumb {
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform var(--transition), box-shadow var(--transition);
  display: block;
}

.equipo-foto-thumb:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

/* Foto en tabla — miniatura cuadrada */
.td-foto img {
  width: 44px !important;
  height: 44px !important;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}

/* Foto en card vista móvil */
.equipo-card-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  cursor: zoom-in;
}

/* ── Alertas ─────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
}

.alert-success { background: rgba(52,211,153,0.1);  border: 1px solid rgba(52,211,153,0.2);  color: #34d399; }
.alert-error   { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.2); color: #f87171; }
.alert-warning { background: rgba(251,191,36,0.1);  border: 1px solid rgba(251,191,36,0.2);  color: #fbbf24; }
.alert-info    { background: rgba(96,165,250,0.1);  border: 1px solid rgba(96,165,250,0.2);  color: #60a5fa; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-bg.open {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 440px;
  position: relative;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
}

.modal-body {
  font-size: 14px;
  color: var(--white-60);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Paginación ──────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 20px 0 4px;
  flex-wrap: wrap;
}

.pag-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--white-60);
  transition: all var(--transition);
}

.pag-btn:hover, .pag-btn.active {
  background: rgba(206,140,109,0.12);
  border-color: rgba(206,140,109,0.3);
  color: var(--salmon);
}

/* ── Historial ───────────────────────────────────────────── */
.historial-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.historial-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.h-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.h-crear   { background: rgba(52,211,153,0.15);  color: #34d399; }
.h-editar  { background: rgba(96,165,250,0.15);  color: #60a5fa; }
.h-eliminar{ background: rgba(248,113,113,0.15); color: #f87171; }
.h-login   { background: rgba(206,140,109,0.15); color: var(--salmon); }
.h-logout  { background: rgba(148,163,184,0.15); color: #94a3b8; }
.h-default { background: rgba(251,191,36,0.15);  color: #fbbf24; }

.h-body {
  flex: 1;
  min-width: 0;
}

.h-desc {
  font-size: 13.5px;
  font-weight: 500;
}

.h-meta {
  font-size: 11px;
  color: var(--white-30);
  margin-top: 4px;
}

.h-change {
  font-size: 11px;
  color: var(--white-60);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.h-old {
  text-decoration: line-through;
  color: #f87171;
  background: rgba(248,113,113,0.1);
  padding: 1px 6px;
  border-radius: 3px;
}

.h-new {
  color: #34d399;
  background: rgba(52,211,153,0.1);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ── Login ───────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 52px; height: 52px;
  background: var(--salmon);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 22px;
  color: #000;
}

.login-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
}

.login-sub {
  font-size: 12px;
  color: var(--white-60);
  margin-top: 4px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-forgot {
  text-align: center;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--white-30);
}

.login-forgot a {
  color: var(--salmon);
  transition: color var(--transition);
}

.login-forgot a:hover {
  color: var(--salmon-light);
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--white-30);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── No results (búsqueda) ───────────────────────────────── */
.no-results {
  display: none;
  text-align: center;
  padding: 40px 20px;
  color: var(--white-30);
  font-size: 14px;
}

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--salmon);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tooltip ─────────────────────────────────────────────── */
[data-tip] {
  position: relative;
}
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg-card);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid var(--border);
  z-index: 999;
  font-family: var(--font);
}

/* ── Responsive tablet+ ──────────────────────────────────── */
@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .sidebar {
    transform: translateX(0);
  }

  .sidebar-close { display: none; }

  .overlay { display: none !important; }

  .main-content {
    margin-left: var(--sidebar-w);
  }

  .cat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .menu-toggle { display: none; }
}

@media (min-width: 1200px) {
  .page-body {
    padding: 32px 36px;
  }

  .cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ── Logo en sidebar ─────────────────────────────────────── */
.logo-img-wrap {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  display: block;
}

/* ── Foto equipo — lightbox trigger ─────────────────────── */
.foto-lightbox-trigger {
  cursor: zoom-in;
  display: inline-block;
}

/* ── Panel Footer ────────────────────────────────────────── */
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-copy {
  font-size: 11px;
  color: var(--text-30);
}

.footer-credit {
  font-size: 11px;
  color: var(--text-30);
}

.footer-credit a {
  color: var(--salmon);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.footer-credit a:hover {
  color: var(--salmon-light);
}

/* ── Support floating button ─────────────────────────────── */
.support-btn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 400;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--salmon);
  border: none;
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(206,140,109,0.4);
  transition: transform var(--transition), box-shadow var(--transition);
}

.support-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(206,140,109,0.55);
}

/* ── Support modal ───────────────────────────────────────── */
.support-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 600;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 0 88px 20px;
}

.support-modal-bg.open {
  display: flex;
}

.support-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: slideUpModal 0.22s ease;
}

@keyframes slideUpModal {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.support-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.support-modal-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.support-modal-title i {
  color: var(--salmon);
}

.support-modal-sub {
  font-size: 11px;
  color: var(--text-30);
  margin-top: 3px;
}

.support-modal-close {
  background: none;
  border: none;
  color: var(--text-30);
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
  transition: color var(--transition);
  flex-shrink: 0;
}

.support-modal-close:hover { color: var(--text); }

.support-modal-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
  background: var(--bg-input);
}

.support-contact-item:hover {
  border-color: var(--border-focus);
  background: var(--bg-card);
}

.support-contact-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.support-wa   .support-contact-icon { background: rgba(37,211,102,0.12); color: #25d366; }
.support-email .support-contact-icon { background: rgba(206,140,109,0.12); color: var(--salmon); }

.support-contact-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-30);
}

.support-contact-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}

.support-external {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-30);
  flex-shrink: 0;
}

.support-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.support-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--salmon);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition);
}

.support-link:hover { color: var(--salmon-light); }

@media (max-width: 640px) {
  .panel-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 16px;
  }

  .support-modal-bg {
    align-items: flex-end;
    justify-content: center;
    padding: 0 12px 12px;
  }

  .support-modal {
    max-width: 100%;
  }
}
