/**
 * ============================================================================
 * TECNOFIX SOLUTIONS — Componentes CSS
 * ============================================================================
 * 
 * Estilos para todos los componentes reutilizables del sistema:
 * botones, inputs, tarjetas, tablas, badges, modales, toasts, etc.
 * Todos siguen el estilo neumórfico definido en neumorphism.css.
 * ============================================================================
 */

/* ═══════════════════════════════════════════════════════════════════════════
   BOTONES — Estilo neumórfico con variantes de color
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--neu-shadow-raised-sm);
  white-space: nowrap;
}

.btn:hover {
  box-shadow: var(--neu-shadow-hover);
  transform: translateY(-1px);
}

.btn:active {
  box-shadow: var(--neu-shadow-inset);
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Variantes de color */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 4px 4px 12px rgba(var(--primary-rgb), 0.3), var(--neu-shadow-raised-sm);
}

.btn-primary:hover {
  box-shadow: 6px 6px 18px rgba(var(--primary-rgb), 0.4), var(--neu-shadow-hover);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #00a381);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #c0392b);
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), var(--warning-dark));
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-base);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* ═══════════════════════════════════════════════════════════════════════════
   INPUTS — Estilo hundido neumórfico
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  box-shadow: var(--neu-shadow-inset);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  box-shadow: var(--neu-shadow-inset), 0 0 0 2px rgba(var(--primary-rgb), 0.3);
}

.form-input::placeholder {
  color: var(--text-muted);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23636e72' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--space-xs);
}

.form-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ── Checkbox neumórfico ───────────────────────────────────────────── */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  box-shadow: var(--neu-shadow-inset-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-wrapper input:checked + .checkbox-custom {
  background: linear-gradient(135deg, var(--success), #00a381);
  box-shadow: var(--neu-shadow-raised-sm);
  color: white;
}

.checkbox-custom::after {
  content: '';
  display: none;
}

.checkbox-wrapper input:checked + .checkbox-custom::after {
  content: '✓';
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TARJETAS — Contenedores neumórficos elevados
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-shadow-raised);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--neu-shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  box-shadow: var(--neu-shadow-raised-sm);
}

.card-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  font-family: var(--font-heading);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* Stat cards del dashboard */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card .stat-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: width var(--transition-slow);
}

.stat-bar.success { background: var(--success); }
.stat-bar.warning { background: var(--warning); }
.stat-bar.danger { background: var(--danger); }
.stat-bar.primary { background: var(--primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLAS — Con bordes suaves y hover
   ═══════════════════════════════════════════════════════════════════════════ */
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-shadow-raised);
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
}

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

.data-table th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.data-table tbody tr {
  transition: all var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.04);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Paginación ────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: var(--space-xs);
}

.pagination-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  box-shadow: var(--neu-shadow-raised-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  color: var(--primary);
  box-shadow: var(--neu-shadow-hover);
}

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

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

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES — Indicadores de estado y prioridad
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: rgba(0, 184, 148, 0.15); color: var(--success); }
.badge-warning { background: rgba(253, 203, 110, 0.3); color: #e17055; }
.badge-danger { background: rgba(214, 48, 49, 0.15); color: var(--danger); }
.badge-info { background: rgba(9, 132, 227, 0.15); color: var(--info); }
.badge-primary { background: rgba(108, 92, 231, 0.15); color: var(--primary); }
.badge-muted { background: rgba(178, 190, 195, 0.2); color: var(--text-muted); }

/* Priority badges */
.priority-baja { background: rgba(178, 190, 195, 0.2); color: var(--text-secondary); }
.priority-normal { background: rgba(9, 132, 227, 0.15); color: var(--info); }
.priority-alta { background: rgba(253, 203, 110, 0.3); color: #e17055; }
.priority-urgente { background: rgba(214, 48, 49, 0.15); color: var(--danger); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALES — Dialog neumórfico centrado
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  padding: var(--space-md);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--neu-shadow-raised);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-base);
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
}

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

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  box-shadow: var(--neu-shadow-raised-sm);
  cursor: pointer;
  font-size: var(--text-lg);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--danger);
  box-shadow: var(--neu-shadow-hover);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOASTS — Notificaciones flotantes
   ═══════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--neu-shadow-raised);
  font-size: var(--text-sm);
  min-width: 300px;
  max-width: 420px;
  animation: slideInRight var(--transition-base) ease;
  color: var(--text-primary);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

.toast-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-lg);
  padding: 0;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SEARCH BAR — Barra de búsqueda global
   ═══════════════════════════════════════════════════════════════════════════ */
.search-bar {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-bar .search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md) var(--space-sm) 40px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  box-shadow: var(--neu-shadow-inset-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  outline: none;
  transition: all var(--transition-fast);
}

.search-bar .search-input:focus {
  box-shadow: var(--neu-shadow-inset), 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--text-sm);
  pointer-events: none;
}

/* ── Search results dropdown ───────────────────────────────────────── */
.search-results-dropdown {
  position: absolute;
  top: calc(100% + var(--space-sm));
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--neu-shadow-raised);
  max-height: 400px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  display: none;
}

.search-results-dropdown.open {
  display: block;
  animation: fadeIn var(--transition-fast) ease;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

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

.search-result-item:hover {
  background: rgba(var(--primary-rgb), 0.05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS BAR — Barra de progreso neumórfica
   ═══════════════════════════════════════════════════════════════════════════ */
.progress-bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  box-shadow: var(--neu-shadow-inset-sm);
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.progress-bar .progress-fill.success {
  background: linear-gradient(90deg, var(--success), var(--success-light));
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING SPINNER — Indicador de carga neumórfico
   ═══════════════════════════════════════════════════════════════════════════ */
.spinner {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

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

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  gap: var(--space-md);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE — Cuando no hay datos
   ═══════════════════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 300px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER BAR — Barra de filtros para listas
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .form-select,
.filter-bar .form-input {
  width: auto;
  min-width: 150px;
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
}
