/* ============================================================
   ReleasIA - Estilos Globales
   Paleta: azul oscuro #1a237e, azul medio #283593, azul claro #3949ab
   Acentos: verde #00c853, rojo #ff1744, amarillo #ffd600
   ============================================================ */

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

:root {
  --primary-dark: #1a237e;
  --primary-medium: #283593;
  --primary-light: #3949ab;
  --primary-lighter: #5c6bc0;
  --primary-bg: #e8eaf6;
  --accent-green: #00c853;
  --accent-red: #ff1744;
  --accent-yellow: #ffd600;
  --accent-orange: #ff9100;
  --scrollbar-green: #2e7d32;
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --header-height: 64px;
  --text-dark: #212121;
  --text-medium: #616161;
  --text-light: #9e9e9e;
  --bg-white: #ffffff;
  --bg-light: #f5f7fa;
  --border-color: #e0e0e0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.3s ease;
}

html, body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--bg-light);
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: var(--primary-light); }
a:hover { color: var(--primary-dark); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-medium) 50%, var(--primary-light) 100%);
}

.login-header {
  text-align: center;
  padding: 40px 20px 20px;
}

.login-header .logo {
  margin-bottom: 8px;
}

.login-header .logo img {
  height: auto;
  width: auto;
  max-height: 60px;
  max-width: 100%;
  filter: brightness(0) invert(1);
  object-fit: contain;
}

.login-header p {
  color: rgba(255,255,255,0.7);
  font-size: 15px;
}

.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-card h2 {
  font-size: 22px;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.login-card .subtitle {
  color: var(--text-medium);
  margin-bottom: 28px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-medium);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.15);
}

.form-group input.error {
  border-color: var(--accent-red);
}

.form-group .input-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-light);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-medium);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: #e0e0e0;
}

.btn-success {
  background: var(--accent-green);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #00b84a;
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #e0133a;
}

.btn-warning {
  background: var(--accent-yellow);
  color: #212121;
}

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

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-footer {
  text-align: center;
  padding: 20px;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.alert-error {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #ef9a9a;
  display: block;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  display: block;
}

/* ============================================================
   DASHBOARD LAYOUT — FLEX RESPONSIVO
   Panel izquierdo = sidebar fijo
   Panel derecho = contenido flex:1, scroll interno
   ============================================================ */
.dashboard-page {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar — panel izquierdo */
.sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  min-width: 0;
  height: 100vh;
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: flex 0.2s, width 0.2s, min-width 0.2s;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  height: var(--header-height);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo-icon {
  font-size: 24px;
  color: var(--accent-green);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.version-badge {
  font-size: 10px;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  color: #a0f0a0;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0;
  line-height: 1.3;
  font-family: monospace;
}

.sidebar-toggle {
  display: block;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  margin-left: auto;
}

/* Sidebar colapsado: toggle cambia a icono de menú */
.sidebar.closed .sidebar-toggle i::before {
  content: "\f0c9"; /* fa-bars */
}

/* Sidebar colapsado: reducir ancho — flex se encoge */
.sidebar.closed {
  flex: 0 0 60px;
  width: 60px;
  min-width: 60px;
}

.sidebar.closed .sidebar-header h2,
.sidebar.closed .sidebar-header .version-badge,
.sidebar.closed .nav-item span,
.sidebar.closed .nav-section-title,
.sidebar.closed .nav-section,
.sidebar.closed .submenu {
  display: none;
}

.sidebar.closed .sidebar-header {
  justify-content: center;
  padding: 16px 8px;
}

.sidebar.closed .sidebar-toggle {
  margin-left: 0;
}

.sidebar.closed .nav-item {
  justify-content: center;
  padding: 12px;
}

.sidebar.closed .nav-item i {
  margin-right: 0;
  font-size: 18px;
}

/* Flex se encarga del ajuste automático */
.sidebar.closed ~ .main-content {
  /* Sin margin-left necesario — flex:1 fluye automáticamente */
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-nav .nav-section {
  padding: 8px 20px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--accent-green);
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.nav-item.hidden {
  display: none;
}

/* Submenu styles */
.nav-parent {
  position: relative;
}

.submenu-arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.submenu-arrow {
  transition: transform 0.2s ease;
}

.nav-parent.open .submenu-arrow {
  transform: rotate(90deg);
}

.nav-submenu {
  display: none;
  background: rgba(0,0,0,0.12);
}

.nav-submenu.open {
  display: block;
}

.nav-subitem {
  padding-left: 52px;
  font-size: 13px;
  border-left: 3px solid transparent;
}

.nav-subitem:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-subitem.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--accent-green);
}

.nav-subitem i {
  width: 16px;
  font-size: 13px;
}

/* ============================================================
   PANEL DERECHO: main-content con flex: 1
   ============================================================ */
.main-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Header — dentro del flujo flex, no fixed */
.top-header {
  flex: 0 0 var(--header-height);
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 999;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

/* Page content — scroll interno, ocupa todo el espacio restante */
.page-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px;
}

/* overflow-x: auto permanente — evita repaints del MutationObserver */
/* .page-content.horizontal-overflow { overflow-x: auto; } — ya no usado */

/* Forzar que todos los hijos respeten el ancho del padre */
.page-content > * {
  min-width: 0;
  max-width: 100%;
}

.page-content .card {
  min-width: 0;
  max-width: 100%;
}

.page-content table {
  min-width: 0;
}

.page-content .table-container {
  min-width: 0;
  max-width: 100%;
}

.page-content .stats-grid {
  min-width: 0;
  max-width: 100%;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

.top-header .page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hamburger-menu {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-dark);
  cursor: pointer;
}

.user-avatar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.user-avatar:hover {
  background: var(--bg-light);
}

.user-avatar .avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-avatar .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.user-avatar .user-role {
  font-size: 11px;
  color: var(--text-light);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 8px 0;
  display: none;
  z-index: 1001;
  border: 1px solid var(--border-color);
}

.user-dropdown.show {
  display: block;
}

.user-dropdown .dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-medium);
}

.user-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
}

.user-dropdown .dropdown-item:hover {
  background: var(--bg-light);
}

.user-dropdown .dropdown-item i {
  width: 18px;
  color: var(--text-medium);
}

.user-dropdown .dropdown-item.text-danger {
  color: var(--accent-red);
}

.user-dropdown .dropdown-item.text-danger i {
  color: var(--accent-red);
}

/* ============================================================
   PAGE CONTENT WRAPPER
   ============================================================ */
/* page-content y page-section ahora se definen arriba con padding-top correcto */

/* ============================================================
   STATS CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card .stat-icon.blue { background: #e3f2fd; color: #1565c0; }
.stat-card .stat-icon.green { background: #e8f5e9; color: #2e7d32; }
.stat-card .stat-icon.red { background: #fce4ec; color: #c62828; }
.stat-card .stat-icon.yellow { background: #fff8e1; color: #f57f17; }
.stat-card .stat-icon.purple { background: #f3e5f5; color: #6a1b9a; }
.stat-card .stat-icon.teal { background: #e0f2f1; color: #00796b; }
.superadmin-only { transition: opacity 0.3s ease; }

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

.stat-card .stat-info .stat-label {
  font-size: 13px;
  color: var(--text-medium);
  margin-bottom: 4px;
}

.stat-card .stat-info .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.stat-card .stat-info .stat-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

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

.card-body {
  padding: 20px;
}

.card-body.no-padding {
  padding: 0;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
  max-width: 100%;
}



table {
  width: 100%;
  border-collapse: collapse;
}

.table-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.table-container table {
  table-layout: auto;
  white-space: normal;
  word-break: break-word;
  min-width: 0;
  width: 100%;
}

/* Columnas específicas que deben mantener nowrap */
.table-container table th.keep-nowrap,
.table-container table td.keep-nowrap {
  white-space: nowrap;
}

/* Catalog History: multilínea en notas */
#catalogHistoryTable td:last-child {
  white-space: normal !important;
  word-break: break-word;
  max-width: 360px;
  min-width: 200px;
}

#catalogHistoryTable td,
#catalogHistoryTable th {
  padding: 6px 8px;
  white-space: nowrap;
}

/* Dashboard section - tables fluid, fit window */
#section-dashboard .table-container {
  overflow-x: visible;
  overflow-y: visible;
}
#section-dashboard .table-container table {
  table-layout: auto;
  width: 100%;
  min-width: 0;
}
#section-dashboard .table-container table th,
#section-dashboard .table-container table td {
  white-space: normal;
  word-break: break-word;
  overflow: visible;
}
/* Stats grid cards: no overflow hidden */
#section-dashboard .stats-grid {
  overflow: visible;
}

/* Tabla de promociones con espaciado limpio */
#discountsTable td:nth-child(5),
#discountsTable td:nth-child(6) { font-variant-numeric: tabular-nums; }

table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-medium);
  background: var(--bg-light);
  border-bottom: 2px solid var(--border-color);
  white-space: normal;
  word-break: break-word;
}

table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-dark);
  white-space: normal;
  word-break: break-word;
}

table tbody tr:nth-child(even) {
  background: #fafafa;
}

table tbody tr:hover {
  background: var(--primary-bg);
}

/* Action column for action buttons - natural width */
table thead th:last-child,
table tbody td:last-child {
  text-align: center;
  white-space: normal;
  word-break: break-word;
}

/* Discounts table - natural column widths */
#discountsTable {
  table-layout: auto;
}
#discountsTable th:nth-child(1) { min-width: 140px; }  /* Nombre */
#discountsTable th:nth-child(2) { min-width: 80px; }   /* Descuento */
#discountsTable th:nth-child(4) { min-width: 110px; }  /* Aplica a */
#discountsTable th:nth-child(5),
#discountsTable th:nth-child(6) { min-width: 90px; }   /* Fechas */
#discountsTable th:nth-child(7) { min-width: 60px; }   /* Usos */
#discountsTable th:nth-child(8) { min-width: 100px; }  /* Acciones */

/* Hover effect only for data rows */
table tbody tr:not(.table-empty):hover {
  background: var(--primary-bg);
}

/* Discount badges */
.badge.badge-success {
  font-size: 11px;
  padding: 3px 10px;
}
.badge.badge-secondary {
  font-size: 11px;
  padding: 3px 10px;
}

table tbody tr.status-updated { border-left: 3px solid var(--accent-green); }
table tbody tr.status-outdated { border-left: 3px solid var(--accent-red); }
table tbody tr.status-unknown { border-left: 3px solid var(--accent-yellow); }

table tbody tr.status-updated { background: rgba(34, 197, 94, 0.12); }
table tbody tr.status-outdated { background: rgba(239, 68, 68, 0.12); }
table tbody tr.status-unknown { background: rgba(234, 179, 8, 0.12); }
.table-empty {
  text-align: center;
  padding: 40px 20px !important;
  color: var(--text-light);
}

.table-empty i {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-danger {
  background: #fce4ec;
  color: #c62828;
}

.badge-warning {
  background: #fff8e1;
  color: #f57f17;
}

.badge-info {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-secondary {
  background: #f5f5f5;
  color: #616161;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.green { background: var(--accent-green); }
.status-dot.red { background: var(--accent-red); }
.status-dot.yellow { background: var(--accent-yellow); }

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-light);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}

.upload-zone i {
  font-size: 48px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.upload-zone h4 {
  font-size: 16px;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.upload-zone p {
  color: var(--text-light);
  font-size: 13px;
}

.upload-zone input[type="file"] {
  display: none;
}

.upload-list {
  margin-top: 20px;
}

.parsed-results {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease-out;
}

.parsed-results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.parsed-results-header h4 {
  margin: 0;
  flex: 1;
  font-size: 16px;
}

.parsed-results-header .badge {
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.parsed-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Barra de progreso de verificación */
#verify-progress {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}

#verify-progress .progress {
  background-color: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

#verify-progress .progress-bar {
  background: linear-gradient(90deg, #28a745, #20c997);
  transition: width 0.3s ease;
}

.verify-badge {
  font-size: 12px;
  white-space: nowrap;
}

.verify-badge[data-verify-status="verified"] {
  color: #28a745;
}

.verify-badge[data-verify-status="found"] {
  color: #17a2b8;
}

.verify-badge[data-verify-status="not_found"] {
  color: #dc3545;
}

.verify-badge[data-verify-status="certified"] {
  color: #28a745;
  font-weight: 700;
}

.verify-badge[data-verify-status="unverified"] {
  color: #dc3545;
  font-style: italic;
}

.verify-badge[data-verify-status="evaluating"] {
  color: #f59e0b;
}

.verify-badge[data-verify-status="pending"] {
  color: #6b7280;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: var(--transition);
}

.upload-item:hover {
  box-shadow: var(--shadow-sm);
}

.upload-item .file-icon {
  font-size: 24px;
  color: var(--primary-light);
}

.upload-item .file-info {
  flex: 1;
}

.upload-item .file-info .file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.upload-item .file-info .file-meta {
  font-size: 12px;
  color: var(--text-light);
}

.upload-item .file-status {
  font-size: 12px;
  font-weight: 600;
}

.upload-item .file-actions {
  display: flex;
  gap: 6px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  background: var(--bg-light);
  color: var(--text-dark);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-color);
}

.modal-wide {
  max-width: 720px;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast-container .toast {
  pointer-events: auto;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  min-width: 280px;
  max-width: 420px;
  animation: toastIn 0.3s ease;
  color: #fff;
}

.toast.toast-success { background: var(--accent-green); }
.toast.toast-error { background: var(--accent-red); }
.toast.toast-warning { background: var(--accent-orange); }
.toast.toast-info { background: var(--primary-light); }

.toast i {
  font-size: 18px;
}

.toast .toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.8;
  font-size: 16px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ============================================================
   SEARCH / FILTERS
   ============================================================ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.search-bar .search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-bar .search-input-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.search-bar .search-input-wrapper input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.search-bar .search-input-wrapper input:focus {
  border-color: var(--primary-light);
}

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

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

/* ============================================================
   SPINNER / LOADER
   ============================================================ */
.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

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

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

.loading-overlay.show {
  display: flex;
}

/* ============================================================
   COMPARADOR
   ============================================================ */
.comparador-table td:first-child {
  font-weight: 600;
}

.comparador-table .version-cell {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
}

/* ============================================================
   TELEGRAM CONFIG
   ============================================================ */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.config-field {
  margin-bottom: 16px;
}

.config-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-medium);
  margin-bottom: 6px;
}

.config-field input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}

.config-field input:focus {
  border-color: var(--primary-light);
}

.config-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

.config-status.connected {
  background: #e8f5e9;
  color: #2e7d32;
}

.config-status.disconnected {
  background: #fce4ec;
  color: #c62828;
}

/* ============================================================
   API KEYS
   ============================================================ */
.api-key-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-key-display code {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-display .copy-btn {
  background: none;
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-medium);
  transition: var(--transition);
}

.api-key-display .copy-btn:hover {
  background: var(--bg-light);
  color: var(--primary-light);
}

/* ============================================================
   EARNINGS
   ============================================================ */
.earnings-highlight {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-medium));
  color: #fff;
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.earnings-highlight .amount {
  font-size: 36px;
  font-weight: 700;
}

.earnings-highlight .label {
  font-size: 14px;
  opacity: 0.8;
}

.chart-container {
  position: relative;
  height: 300px;
  margin-bottom: 20px;
}

/* ============================================================
   ADMIN CLIENTS
   ============================================================ */
.client-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-row .client-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    flex: 0 0 var(--sidebar-width);
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-toggle {
    display: block;
  }

  .hamburger-menu {
    display: block;
  }

  .top-header {
    padding: 0 16px;
  }

  .top-header .page-title {
    font-size: 16px;
  }

  .page-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card .stat-info .stat-value {
    font-size: 22px;
  }

  .user-avatar .user-name,
  .user-avatar .user-role {
    display: none;
  }

  .login-card {
    padding: 24px;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .sidebar {
    flex: 0 0 60px;
    width: 60px;
    min-width: 60px;
  }
  .sidebar .sidebar-header h2,
  .sidebar .sidebar-header .version-badge,
  .sidebar .nav-item span,
  .sidebar .nav-section-title,
  .sidebar .nav-section,
  .sidebar .submenu {
    display: none;
  }
  .sidebar .sidebar-header {
    justify-content: center;
    padding: 16px 8px;
  }
  .sidebar .sidebar-toggle {
    margin-left: 0;
    pointer-events: none;
    opacity: 0.4;
  }
  .sidebar .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .sidebar .nav-item i {
    margin-right: 0;
    font-size: 18px;
  }
  .page-content {
    padding: 20px;
  }
  .page-content table td,
  .page-content table th {
    white-space: normal;
    word-break: break-word;
  }

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

  .earnings-highlight {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .modal {
    width: 95%;
    max-height: 90vh;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar .search-input-wrapper {
    max-width: 100%;
  }

  .card-header {
    flex-direction: column;
    gap: 10px;
  }

  .card-header .card-actions {
    width: 100%;
  }

  .card-header .card-actions .btn {
    flex: 1;
  }
}

/* ============================================================
   TAG (Catálogo source)
   ============================================================ */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tag-github {
  background: #e8eaf6;
  color: #283593;
}
.tag-filehippo {
  background: #e0f2f1;
  color: #00695c;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 37px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-green);
}

.table-container::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: 37px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 12px;
  transition: background 0.2s ease;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-green);
}

/* ============================================================
   MINI STATS (Catálogo)
   ============================================================ */
.stats-grid.mini-stats {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 16px;
}

.stats-grid.mini-stats .stat-card.mini {
  padding: 12px;
}

.stats-grid.mini-stats .stat-card.mini .stat-value {
  font-size: 20px;
}

.stats-grid.mini-stats .stat-card.mini .stat-icon {
  width: 36px;
  height: 36px;
  font-size: 16px;
}

/* ============================================================
   MISC
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--accent-red); }
.text-warning { color: var(--accent-yellow); }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* ============================================================
   PRODUCT DETAIL MODAL
   ============================================================ */
.modal-lg {
  max-width: 720px;
}

.clickable-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.clickable-row:hover {
  background: var(--bg-light);
}

.clickable-row td:first-child {
  position: relative;
}

.clickable-row td:first-child::after {
  content: '\f054';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10px;
  color: var(--text-light);
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.clickable-row:hover td:first-child::after {
  opacity: 1;
}

.product-detail .detail-header-status {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  margin-bottom: 20px;
  text-align: center;
}

.product-detail .detail-header-status.up-to-date {
  background: #e8f5e9;
  color: #2e7d32;
}

.product-detail .detail-header-status.outdated {
  background: #fbe9e7;
  color: #c62828;
}

.product-detail .detail-header-status.pending,
.product-detail .detail-header-status.unknown {
  background: #fff8e1;
  color: #f57f17;
}

.product-detail .detail-header-status.missing-version {
  background: #e3f2fd;
  color: #1565c0;
}

.product-detail .detail-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.product-detail .detail-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.product-detail .detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.product-detail .detail-table {
  width: 100%;
  border-collapse: collapse;
}

.product-detail .detail-table td {
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.product-detail .detail-table td:first-child {
  color: var(--text-light);
  width: 40%;
  font-weight: 500;
}

.product-detail .detail-table tr:last-child td {
  border-bottom: none;
}

.product-detail .highlight-version {
  font-weight: 700;
  color: var(--primary);
  background: #f0f4ff;
  padding: 2px 8px !important;
  border-radius: 4px;
  display: inline-block;
}

.product-detail .link {
  color: var(--primary);
  text-decoration: none;
}

.product-detail .link:hover {
  text-decoration: underline;
}

/* ============================================================
   PRODUCT GRID (CARDS)
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 4px 0;
}

.product-grid.comparador-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border-color: var(--primary);
}

.product-card:active {
  transform: translateY(0);
}

.card-status-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.card-status-indicator.card-updated {
  background: var(--accent-green);
}

.card-status-indicator.card-outdated {
  background: var(--accent-red);
}

.card-status-indicator.card-unknown {
  background: var(--accent-yellow);
}

.product-card .card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  color: var(--primary);
  font-size: 16px;
  margin-bottom: 4px;
}

.product-card .card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card .card-provider {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card .card-versions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.product-card .card-version-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-light);
  font-weight: 500;
}

.product-card .card-version-value {
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 600;
  color: var(--text);
  margin-top: -2px;
}

.product-card .card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 4px;
}

.product-card .card-status-badge.card-updated {
  background: #e8f5e9;
  color: #2e7d32;
}

.product-card .card-status-badge.card-outdated {
  background: #fbe9e7;
  color: #c62828;
}

.product-card .card-status-badge.card-unknown {
  background: #fff8e1;
  color: #f57f17;
}

.product-card .card-date {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 2px;
}

.grid-empty, .grid-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.grid-empty i, .grid-error i {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.grid-error {
  color: var(--accent-red);
}

/* ============================================================
   V.2.15.23 — Auto-resize puro: sin propiedades extras
   ============================================================ */
#section-dashboard .table-container table {
  table-layout: auto;
  width: 100%;
}
#section-dashboard .table-container table th,
#section-dashboard .table-container table td {
  white-space: normal;
  word-break: break-word;
}
