/* ============================================
   SHARED STYLES - Inventory SYSTEM
   Estilos globales compartidos entre todas las páginas
   ============================================ */

/* ============================================
   CSS VARIABLES - PALETA DE COLORES
   Cambiar aquí para modificar toda la aplicación
   ============================================ */
:root {
  /* --- Colores primarios / marca --- */
  --color-primary: #334155;
  --color-primary-dark: #1e293b;
  --color-primary-light: #475569;
  --color-primary-light-rgb: 71, 85, 105;

  /* --- Fondos --- */
  --color-bg-body: #f1f5f9;
  --color-bg-main: #f8fafc;
  --color-bg-surface: #ffffff;
  --color-bg-header: #f1f5f9;
  --color-bg-row-hover: #f8fafc;

  /* --- Bordes --- */
  --color-border-light: #e2e8f0;
  --color-border: #cbd5e1;
  --color-border-input: #cbd5e1;

  /* --- Colores semánticos --- */
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-warning: #ca8a04;
  --color-info: #0284c7;
  --color-secondary: #64748b;
  --color-purple: #7c3aed;
  --color-purple-dark: #6d28d9;
  --color-dark: #0f172a;

  /* --- Estados: fondo / texto / borde --- */
  --color-status-success-bg: #f0fdf4;
  --color-status-success-text: #166534;
  --color-status-success-border: #bbf7d0;

  --color-status-warning-bg: #fefce8;
  --color-status-warning-text: #854d0e;
  --color-status-warning-border: #fef08a;

  --color-status-danger-bg: #fef2f2;
  --color-status-danger-text: #991b1b;
  --color-status-danger-border: #fecaca;

  --color-status-info-bg: #f0f9ff;
  --color-status-info-text: #075985;
  --color-status-info-border: #bae6fd;

  /* --- Texto --- */
  --color-text-muted: #64748b;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--color-bg-body);
  min-height: 100vh;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn i {
  width: 18px;
  height: 18px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-success {
  background: var(--color-success);
  color: white;
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

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

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

.btn-info {
  background: var(--color-info);
  color: white;
}

.btn-barcode {
  background: var(--color-purple);
  color: white;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-barcode:hover {
  background: var(--color-purple-dark);
  transform: scale(1.08);
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06);
  margin-bottom: 25px;
  overflow: hidden;
  border: 1px solid var(--color-border-light);
}

.card-header {
  padding: 20px;
  background: var(--color-bg-header);
  border-bottom: 1px solid var(--color-border-light);
  font-weight: 600;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header i {
  width: 20px;
  height: 20px;
}

.card-body {
  padding: 25px;
}

/* ============================================
   FORMS
   ============================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  position: relative;
}

.form-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--color-primary);
  font-size: 0.9rem;
}

input,
select,
textarea {
  padding: 12px;
  border: 2px solid var(--color-border-light);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  background: white;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-light-rgb), 0.1);
}

/* Input con botón adjunto */
.input-with-button {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-with-button input {
  flex: 1;
  min-width: 0;
}

.input-with-button .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Botón pequeño */
.btn-sm {
  padding: 8px 12px;
  font-size: 0.8rem;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border-light);
}

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

th,
td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

th {
  background: var(--color-bg-header);
  font-weight: 600;
  color: var(--color-primary);
  font-size: 0.9rem;
}

tr:hover {
  background: var(--color-bg-row-hover);
}

/* ============================================
   STATUS & TEXT COLORS
   ============================================ */
.status-normal {
  background: var(--color-status-success-bg);
  color: var(--color-status-success-text);
}

.status-low {
  background: var(--color-status-warning-bg);
  color: var(--color-status-warning-text);
}

.status-zero {
  background: var(--color-status-danger-bg);
  color: var(--color-status-danger-text);
}

.text-success {
  color: var(--color-success);
  font-weight: 600;
}

.text-danger {
  color: var(--color-danger);
  font-weight: 600;
}

.text-warning {
  color: var(--color-warning);
  font-weight: 600;
}

.text-info {
  color: var(--color-info);
  font-weight: 600;
}

/* ============================================
   MESSAGES
   ============================================ */
.message {
  padding: 12px 15px;
  border-radius: 8px;
  margin: 15px 0;
  font-weight: 500;
}

.message.success {
  background: var(--color-status-success-bg);
  color: var(--color-status-success-text);
  border: 1px solid var(--color-status-success-border);
}

.message.error {
  background: var(--color-status-danger-bg);
  color: var(--color-status-danger-text);
  border: 1px solid var(--color-status-danger-border);
}

.message.warning {
  background: var(--color-status-warning-bg);
  color: var(--color-status-warning-text);
  border: 1px solid var(--color-status-warning-border);
}

.message.info {
  background: var(--color-status-info-bg);
  color: var(--color-status-info-text);
  border: 1px solid var(--color-status-info-border);
}

/* ============================================
   UTILITIES
   ============================================ */
.loading {
  display: none;
  text-align: center;
  padding: 20px;
  color: var(--color-primary-light);
  font-style: italic;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* ============================================
   STATS GRID (Dashboard)
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06);
  border-left: 4px solid var(--color-primary-light);
  border: 1px solid var(--color-border-light);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 5px;
}

.stat-label {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ============================================
   AUTOCOMPLETE
   ============================================ */
.autocomplete-container {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--color-primary-light);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.autocomplete-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-light);
  transition: background 0.2s ease;
}

.autocomplete-item:hover {
  background: var(--color-bg-header);
}

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

.autocomplete-code {
  font-weight: 600;
  color: var(--color-primary);
}

.autocomplete-name {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease;
}

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

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

.modal-header h3 {
  margin: 0;
  color: var(--color-primary);
  font-size: 1.3rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

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

.modal-body {
  padding: 25px;
}
