:root {
  --color-primary: #2563eb;
  --primary-dark: #1d4ed8;
  --color-secondary: #e2e8f0;
  --color-primary-alt: #03e079;
  --text-color: #1e293b;
  --text-light: #64748b;
  --text-secondary: #334155;
  --background-color: #f8fafc;
  --white: #ffffff;
  --sidebar-bg: #1a2234;
  --sidebar-bg-rgb: 26, 34, 52;
  --sidebar-text: #e2e8f0;
  --sidebar-active: #2563eb;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --warning-color-fondo: #f59f0b1c;
  --danger-color: #ef4444;
  --color-claro-fondo: #f1f3ff;
  --color-gray-100: #d9d9d9;
  --color-morado: #8b5cf6;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 60px;
  --border-radius: 8px;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* Scroll personalizado */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--text-light) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--text-light);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: #1e4ed8;
}

.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.app-container-login {
  background-color: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
}

.main-content {
  flex: 1;
  margin-left: 0;
  transition: margin-left 0.3s ease;
  width: 100%;
}

.main-content-login {
  width: 100%;
  height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Botones */
button {
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  font-weight: 450 !important;
}

.btn-view-all {
  display: block;
  width: 100%;
  padding: 12px;
  background-color: var(--color-primary);
  color: var(--white);
  border-radius: var(--border-radius);
  text-align: center;
  font-weight: 500;
  margin-top: 16px;
  transition: background-color 0.2s;
}

.btn-view-all:hover {
  background-color: var(--primary-dark);
}
/* Menú de acciones reutilizable para tablas */
.table-container,
div.dataTables_wrapper,
table.dataTable,
table.dataTable tbody,
table.dataTable tbody tr,
table.dataTable tbody td {
  overflow: visible !important;
}

.table-actions-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-actions-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-secondary);
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.table-actions-toggle:hover {
  background-color: var(--color-secondary);
  color: var(--text-color);
}

.table-actions-menu.active .table-actions-toggle {
  background-color: var(--color-secondary);
  color: var(--text-color);
}

.table-actions-dropdown {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 999;
}

.table-actions-menu.active .table-actions-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.table-action-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-color);
  font-size: 14px;
  text-align: left;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.table-action-item:hover {
  background-color: #f8fafc;
}

.table-action-item.btn-generar-venta {
  color: #15803d;
}

.table-action-item.btn-generar-venta:hover {
  background-color: color-mix(in srgb, #22c55e 16%, var(--white));
  color: #166534;
}

.table-action-item iconify-icon {
  flex-shrink: 0;
}

.table-action-item.danger {
  color: var(--danger-color);
}

.table-action-item.danger:hover {
  background-color: color-mix(in srgb, var(--danger-color) 12%, var(--white));
}
/* Select */
.custom-select {
  position: relative;
  width: fit-content;
}

.select-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.select-borderless .select-btn {
  border: none;
  background: none;
  padding: 0;
}

.select-with-border .select-btn {
  border: 1px solid var(--border-color);
  background-color: var(--white);
}

.select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 120px;
  background-color: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: none;
  margin-top: 4px;
  overflow: hidden;
}

.select-dropdown.open {
  display: block;
}

.select-option {
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.1s;
}

.select-option:hover {
  background-color: var(--color-secondary);
}

.stats-period {
  font-size: 12px;
  color: var(--text-light);
}

@media (min-width: 768px) {
  .sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

  .sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }
}

.btn-primary,
.btn-secondary {
  font-size: 15px !important;
}

.btn-primary,
.btn-primary-alt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: var(--color-primary);
  color: var(--white);
  border-radius: var(--border-radius);
  font-weight: 500;
  transition: background-color 0.2s;
  font-size: 16px;
  height: fit-content !important;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-primary-alt {
  background-color: var(--color-primary-alt);
  color: var(--text-color);
}

.btn-accion-view {
  padding: 8px;
  background: transparent;
  color: var(--color-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-accion-view:hover {
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
}

.btn-accion-delete {
  padding: 8px;
  background: transparent;
  color: var(--danger-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.btn-accion-delete:hover {
  background: color-mix(in srgb, var(--danger-color) 16%, transparent);
  color: var(--danger-color);
}

.btn-secondary,
.btn-secondary-alt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: var(--white);
  color: var(--text-color);
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  font-weight: 500;
  transition: background-color 0.2s;
  width: fit-content !important;
  height: fit-content !important;
}

.btn-secondary:hover {
  background-color: var(--color-secondary);
}

.btn-secondary-alt-02 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background-color: transparent;
  color: var(--color-primary);
  font-weight: 500;
  font-size: 14px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge.badge-primary {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.badge.badge-secondary {
  background: rgba(107, 114, 128, 0.1);
  color: #374151;
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

/* ── BADGES DE ESTADO GLOBALES ──────────────────────────── */
.badge-estado {
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-estado.habilitado,
.badge-estado.finalizada {
  background: #dcfce7;
  color: #16a34a;
}

.badge-estado.activo {
  background: #dbeafe;
  color: var(--color-primary);
}

.badge-estado.cancelado,
.badge-estado.inhabilitado {
  background: #fee2e2;
  color: #dc2626;
}

.badge-estado.cerrado {
  background: var(--warning-color-fondo);
  color: var(--warning-color);
}

/* Contenido de página */
.page-content {
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: column;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header .btn-primary {
  width: 100%;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
}

.desktop-only {
  display: none;
}

.mobile-only {
  display: block;
}
.color-red {
  color: var(--danger-color);
}
#contenedor_pagina {
  padding-left: calc(var(--sidebar-width) + 20px);
}
@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
  }

  .page-header .btn-primary {
    width: fit-content;
  }

  .sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

  .desktop-only {
    display: block;
  }

  .mobile-only {
    display: none;
  }

  .sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

  .desktop-only {
    display: block;
  }

  .mobile-only {
    display: none;
  }
}

@media (max-width: 767px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }
}

@media (min-width: 768px) {
  .desktop-only {
    display: block !important;
  }

  .mobile-only {
    display: none !important;
  }
}

/* Input buscador */
.search-container {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  height: 100%;
}

.search-container input {
  width: 85%;
  margin-left: 24px;
  padding: 10px 12px;
  padding-left: 36px;
  background: transparent;
  border: none;
  height: 100%;
  font-size: 14px;
}

.search-container iconify-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

/* Formularios */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 16px;
  color: var(--text-primary);
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 12px;
  font-size: 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--background-color);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

input[type='password']::-ms-reveal,
input[type='password']::-ms-clear {
  display: none;
}

.dataTables_length label select,
.dataTables_length input {
  width: 100% !important;
  padding: 10px 12px !important;
  font-size: 15px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  background-color: var(--background-color) !important;
  color: var(--text-primary) !important;
  transition: border-color 0.2s ease !important;
}

.dataTables_length label select {
  width: fit-content !important;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* Visor de imagen */
.image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.image-viewer.active {
  display: flex;
}

.image-viewer-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-viewer-close {
  position: absolute;
  top: -50px;
  right: -50px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.product-image,
.product-card-image {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.product-image:hover,
.product-card-image:hover {
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .image-viewer-close {
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
  }

  .image-viewer-content {
    max-width: 95%;
    max-height: 95%;
  }
}

.data-card {
  background-color: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

/* ===================================
   ESTADOS Y BADGES
   =================================== */

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}

.badge-success {
  background-color: #22c55e;
  color: #fff;
}

.badge-danger {
  background-color: #f2f6fa;
  color: #000;
}

.badge.badge-warning {
  background-color: #fbbf24;
  color: #92400e;
}

.badge.badge-danger {
  background-color: #f87171;
  color: #991b1b;
}

.badge.badge-success {
  background-color: #34d399;
  color: #065f46;
}

/* ===================================
   VENTANA DE NOTIFICACIONES
   =================================== */

.notification-container {
  position: relative;
}

.notification-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
}

.notification-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

.notification-dropdown {
  position: fixed;
  top: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 340px;
  max-height: 400px;
  overflow: hidden;
  z-index: 1000;
  margin-top: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  pointer-events: none;
}

.notification-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.notification-header {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.notification-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.notification-list {
  padding: 10px 0;
  overflow-y: scroll;
  height: 350px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.2s ease;
}

.notification-item:hover {
  background: #d9d9e1;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-dot {
  width: 8px;
  height: 8px;
  background: #ff4444;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.notification-content p {
  margin: 0 0 4px 0;
  font-size: 15px;
  color: #1f2937;
  line-height: 1.4;
}

.notification-date {
  font-size: 12px;
  color: #4b5563;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.date-range-picker {
  display: flex;
  gap: 10px;
  background: #f1f5f9;
  padding: 8px 15px;
  border-radius: 12px;
}
