/* ============================================================
   IDDENTIFY CATALOG INTELLIGENCE — DESIGN SYSTEM
   Versión 3.0
   Importar en todas las páginas: <link rel="stylesheet" href="/assets/app.css">
   ============================================================ */

/* ─── TOKENS ─────────────────────────────────────────────── */
:root {
  /* Marca */
  --brand:        #0C7C59;
  --brand-dark:   #0a6b4c;
  --brand-light:  #e8f7f2;
  --brand-mid:    #b7f7df;

  /* Superficies */
  --bg:           #f6f8fa;
  --surface:      #ffffff;
  --surface-alt:  #f9fafb;
  --overlay:      rgba(0,0,0,.45);

  /* Texto */
  --text:         #111827;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;

  /* Bordes */
  --border:       #e5e7eb;
  --border-focus: #0C7C59;

  /* Estados */
  --success:      #047857;
  --success-bg:   #ecfdf5;
  --warning:      #b45309;
  --warning-bg:   #fffbeb;
  --danger:       #dc2626;
  --danger-bg:    #fef2f2;
  --info:         #1d4ed8;
  --info-bg:      #eff6ff;

  /* Sidebar */
  --sidebar-w:    220px;
  --sidebar-bg:   #0f1117;
  --sidebar-text: #d1d5db;

  /* Espaciado */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap:    16px;
  --gap-lg: 24px;
  --gap-xl: 32px;

  /* Radios */
  --r-sm:  6px;
  --r:     10px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-full: 999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.08);

  /* Tipografía */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --text-xs:  11px;
  --text-sm:  13px;
  --text-md:  14px;
  --text-lg:  16px;
  --text-xl:  20px;
  --text-2xl: 26px;

  /* Transición */
  --transition: .15s ease;
}

/* ─── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  font-size: var(--text-md);
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ─── LAYOUT CON SIDEBAR ─────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ════════════════════════════════════════════════════════════════════════════
 * SIDEBAR — patrón HubSpot (tira de iconos + flyout panel)
 * ════════════════════════════════════════════════════════════════════════════
 *
 * Estructura HTML:
 *   <aside class="sidebar [expanded] [flyout-open] [mobile-open]">
 *     <div class="sidebar-strip">       ← tira fija (56px / 220px)
 *       <div class="sidebar-logo">…</div>
 *       <nav class="sidebar-icons">…</nav>
 *       <div class="sidebar-strip-footer">…</div>
 *     </div>
 *     <div class="sidebar-flyout">…</div> ← panel que aparece al click
 *   </aside>
 *
 * Estados (clases en .sidebar):
 *   default        → strip 56px, sin flyout
 *   .expanded      → strip 220px (con labels)
 *   .flyout-open   → flyout visible al lado del strip
 *   .mobile-open   → strip visible en mobile (slide-in)
 */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  pointer-events: none;  /* permite clicks fuera del strip + flyout */
}
.sidebar > * { pointer-events: auto; }

/* ─── Strip (tira de iconos) ─────────────────────────────────────────────── */
.sidebar-strip {
  width: 60px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.05);
  transition: width .2s ease;
  overflow: hidden;
}
.sidebar.expanded .sidebar-strip { width: 220px; }

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  height: 64px;
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}
.sidebar-logo-text { display: none; min-width: 0; }
.sidebar-logo-name {
  font-size: 14px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logo-sub {
  font-size: 10px; color: rgba(255,255,255,.4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.sidebar.expanded .sidebar-logo-text { display: block; }

/* Lista de iconos (módulos padre) */
.sidebar-icons {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-icon {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  position: relative;
  width: 100%;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.sidebar-icon:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.sidebar-icon.active {
  background: var(--brand);
  color: #fff;
}
.sidebar-icon.active:hover { background: var(--brand-dark); }
.sidebar-icon.flyout-active:not(.active) {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.sidebar-icon-glyph {
  font-size: 18px;
  width: 24px;
  flex-shrink: 0;
  text-align: center;
  line-height: 1;
}
.sidebar-icon-label {
  flex: 1;
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-icon-arrow {
  font-size: 14px;
  display: none;
  opacity: .5;
  flex-shrink: 0;
}
.sidebar.expanded .sidebar-icon-label,
.sidebar.expanded .sidebar-icon-arrow { display: inline-block; }

/* ─── Footer del strip (usuario + logout) ────────────────────────────────── */
.sidebar-strip-footer {
  padding: 10px 8px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: rgba(255,255,255,.7);
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-text {
  display: none;
  min-width: 0;
  flex: 1;
}
.sidebar-user-name {
  font-size: 12px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 10px; color: rgba(255,255,255,.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar.expanded .sidebar-user-text { display: block; }

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(248,113,113,.85);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  width: 100%;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar-logout:hover {
  background: rgba(220,38,38,.12);
  color: #fca5a5;
  border-color: rgba(220,38,38,.25);
}
.sidebar-logout-glyph {
  font-size: 16px; width: 24px; flex-shrink: 0; text-align: center; line-height: 1;
}
.sidebar-logout-label { display: none; flex: 1; }
.sidebar.expanded .sidebar-logout-label { display: inline-block; }

/* ─── Flyout (panel de sub-items) ────────────────────────────────────────── */
.sidebar-flyout {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 60px;
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,.05);
  box-shadow: 8px 0 24px rgba(0,0,0,.3);
  display: none;
  flex-direction: column;
  z-index: 99;
  transition: left .2s ease;
}
.sidebar.expanded .sidebar-flyout { left: 220px; }
.sidebar.flyout-open .sidebar-flyout { display: flex; }

.flyout-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  height: 64px;
}
.flyout-title-icon { font-size: 18px; }
.flyout-title {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}
.flyout-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.45);
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.flyout-close:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.flyout-items {
  flex: 1;
  padding: 8px 8px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.flyout-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.flyout-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.flyout-item.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}
.flyout-item-icon { font-size: 16px; width: 22px; flex-shrink: 0; text-align: center; line-height: 1; }
.flyout-item-label { flex: 1; }
.flyout-item-ext {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  flex-shrink: 0;
}

/* ─── Botones flotantes de toggle ────────────────────────────────────────── */
.sidebar-expand-toggle {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 105;
  width: 22px; height: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: left .2s ease, color .15s, border-color .15s;
  left: calc(60px - 11px);
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  line-height: 1;
}
.sidebar-expand-toggle:hover {
  color: var(--brand);
  border-color: var(--brand);
}
body.sidebar-expanded .sidebar-expand-toggle { left: calc(220px - 11px); }

.sidebar-mobile-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 300;
  background: var(--sidebar-bg);
  color: #fff;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  width: 40px; height: 40px;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ─── Área de contenido principal ────────────────────────────────────────── */
.app-content {
  margin-left: 60px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}
body.sidebar-expanded .app-content { margin-left: 220px; }

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px var(--gap-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-header-left { display: flex; align-items: center; gap: var(--gap-sm); }
.page-title { font-size: var(--text-lg); font-weight: 700; }
.page-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 1px; }
.page-actions { display: flex; align-items: center; gap: var(--gap-sm); }

.page-body { padding: var(--gap-lg); flex: 1; }

/* ─── COMPONENTES: BOTONES ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  padding: 0 14px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  outline: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); }
.btn-lg { height: 42px; padding: 0 20px; font-size: var(--text-md); }
.btn-full { width: 100%; }

.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn-secondary { background: #111827; color: #fff; border-color: #111827; }
.btn-secondary:hover:not(:disabled) { background: #1f2937; }

.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--bg); border-color: #9ca3af; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

/* ─── COMPONENTES: INPUTS ────────────────────────────────── */
.input, .select {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(12,124,89,.12);
}
.input-sm { height: 30px; font-size: var(--text-xs); padding: 0 8px; }

.input-group { display: flex; gap: var(--gap-sm); align-items: center; }
.input-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

/* ─── COMPONENTES: CARDS ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--gap);
  box-shadow: var(--shadow-sm);
}
.card-lg { padding: var(--gap-lg); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap);
  padding-bottom: var(--gap);
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: var(--text-md); font-weight: 700; }
.card-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }

/* ─── COMPONENTES: BADGES ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-neutral { background: var(--bg);         color: var(--text-muted); border: 1px solid var(--border); }
.badge-brand   { background: var(--brand-light); color: var(--brand); }

/* ─── COMPONENTES: TABLA ─────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead { background: var(--surface-alt); }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

/* ─── COMPONENTES: STATS ─────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--gap); margin-bottom: var(--gap-lg); }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }
.stat-card.brand .stat-value { color: var(--brand); }
.stat-card.info .stat-value  { color: var(--info); }
.stat-card.warn .stat-value  { color: var(--warning); }
.stat-card.danger .stat-value{ color: var(--danger); }

/* ─── COMPONENTES: NOTIFICACIONES TOAST ──────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  animation: slideIn .2s ease;
  pointer-events: all;
}
.toast.success { border-left: 3px solid var(--brand); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── COMPONENTES: MODAL ─────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--overlay);
  z-index: 900;   /* above wizard (500) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap);
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn .15s ease;
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: var(--text-lg); font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--gap-sm); }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ─── COMPONENTES: EMPTY STATE ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px var(--gap);
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-title { font-size: var(--text-lg); font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state-body { font-size: var(--text-sm); line-height: 1.6; }

/* ─── COMPONENTES: TOOLBAR ───────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex-wrap: wrap;
  margin-bottom: var(--gap);
}
.toolbar-left  { display: flex; align-items: center; gap: var(--gap-sm); flex: 1; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: var(--gap-sm); flex-shrink: 0; }

/* ─── COMPONENTES: LOGS ──────────────────────────────────── */
.logs-box {
  background: #0d1117;
  color: #c9d1d9;
  border-radius: var(--r);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  min-height: 60px;
}
.logs-box:empty::before { content: "Aquí aparecerán los logs…"; color: #4d5562; }

/* ─── UTILIDADES ─────────────────────────────────────────── */
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--gap-xs); }
.gap-sm { gap: var(--gap-sm); }
.gap    { gap: var(--gap); }
.gap-lg { gap: var(--gap-lg); }
.mt-sm { margin-top: var(--gap-sm); }
.mt    { margin-top: var(--gap); }
.mt-lg { margin-top: var(--gap-lg); }
.mb-sm { margin-bottom: var(--gap-sm); }
.mb    { margin-bottom: var(--gap); }
.mb-lg { margin-bottom: var(--gap-lg); }
.w-full { width: 100%; }
.text-sm   { font-size: var(--text-sm); }
.text-xs   { font-size: var(--text-xs); }
.text-muted { color: var(--text-muted); }
.font-bold  { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Grid utilitario */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }

/* ─── ZOOM DE IMÁGENES (lightbox) ────────────────────────── */
/* Wrapper que envuelve cada image-choice y el botón de zoom */
.image-choice-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Botón lupa — hermano del .image-choice, no hijo */
.zoom-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  background: rgba(0,0,0,.62);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 13px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  z-index: 10;
  padding: 0;
  line-height: 1;
  transition: background var(--transition);
}
.zoom-btn:hover { background: var(--brand); }
/* Mostrar lupa al pasar el mouse por el wrapper */
.image-choice-wrap:hover .zoom-btn { display: flex; }

/* Badge para imágenes de la galería propia de Iddentify */
.own-gallery-badge {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
/* Borde verde en el wrapper cuando es imagen propia */
.image-choice-wrap.is-own-gallery .image-choice {
  border-color: var(--brand) !important;
  background: var(--brand-light) !important;
}

/* Lightbox */
.img-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn .15s ease;
  padding: 24px;
}
.img-lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: var(--r-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  object-fit: contain;
  cursor: default;
  animation: scaleIn .15s ease;
}
.img-lightbox-caption {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: var(--text-sm);
  padding: 6px 16px;
  border-radius: var(--r-full);
  white-space: nowrap;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.img-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  background: rgba(0,0,0,.5);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.img-lightbox-close:hover { background: var(--danger); }

/* Badge morado para precio igualado */
.badge.purple {
  background: #f3e8ff;
  color: #7c3aed;
}

/* Botón ausentes en verde de marca */
.stat-button-brand {
  background: var(--brand-light) !important;
  color: var(--brand) !important;
  border-color: var(--brand) !important;
}
.stat-button-brand:hover {
  background: var(--brand) !important;
  color: #fff !important;
}
.stat-button-brand:hover span,
.stat-button-brand:hover strong {
  color: #fff !important;
}

/* ════════════════════════════════════════════════════════════════════════
 * RESPONSIVE — Mobile sidebar (slide-in pattern)
 * ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Strip oculta por default, slide-in al toggle */
  .sidebar-strip {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 240px !important;  /* fixed width en mobile, ignora "expanded" */
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }
  .sidebar.mobile-open .sidebar-strip {
    transform: translateX(0);
  }

  /* En mobile, el strip siempre muestra labels (no hay "collapsed mode") */
  .sidebar-strip .sidebar-logo-text,
  .sidebar-strip .sidebar-icon-label,
  .sidebar-strip .sidebar-icon-arrow,
  .sidebar-strip .sidebar-user-text,
  .sidebar-strip .sidebar-logout-label {
    display: block !important;
  }
  .sidebar-strip .sidebar-icon-arrow { display: inline-block !important; }

  /* Flyout: ocupa toda la pantalla en mobile, slide-in desde la derecha */
  .sidebar-flyout {
    left: 240px !important;
    width: calc(100vw - 240px);
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }

  /* App content: margin 0 en mobile (sidebar overlay) */
  .app-content { margin-left: 0 !important; }
  body.sidebar-expanded .app-content { margin-left: 0; }

  /* Backdrop oscuro cuando sidebar mobile está abierto */
  body.sidebar-mobile-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 90;
    pointer-events: none;
  }

  /* Hamburger visible */
  .sidebar-mobile-toggle { display: flex; }

  /* Esconder el toggle de expand/collapse — no aplica en mobile */
  .sidebar-expand-toggle { display: none; }

  .page-header { padding: 12px 16px 12px 64px; }
  .page-body { padding: var(--gap); }

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

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left, .toolbar-right { width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { max-height: 100vh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
}
