/* === COMPONENTES === */

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-primary {
  background-color: var(--color-warm);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  color: var(--color-text-primary);
  background-color: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}

.btn-danger {
  background-color: transparent;
  color: var(--color-negative);
  border: 1px solid var(--color-negative-border);
}
.btn-danger:hover {
  background-color: var(--color-negative-soft);
  border-color: var(--color-negative);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: 12px; font-weight: 500;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}
.btn-sm:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}
.btn-sm svg { width: 13px; height: 13px; }

/* --- Formularios --- */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.input-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  transition: all 0.2s ease;
}
.input-control:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  background-color: var(--bg-input-focus);
}
.input-control::placeholder { color: #52525B; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-modal-overlay);
  display: flex; justify-content: center; align-items: center;
  z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 600px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--t-base) var(--ease-out);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }

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

.modal-title {
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; gap: var(--sp-2);
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--t-fast);
}
.modal-close:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body {
  padding: var(--sp-6);
  overflow-y: auto; flex: 1;
}

.modal-footer {
  display: flex; justify-content: flex-end; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--color-border);
}

/* --- Stats Grid / KPI Cards --- */
.stats-grid {
  display: flex;
  gap: 0;
  margin-bottom: 2.5rem;
  background: var(--color-surface);
  border-radius: var(--border-radius-xl);
  overflow: hidden;
}

.stat-card {
  flex: 1; min-width: 0;
  background: transparent;
  padding: 1.5rem;
  border: none; box-shadow: none;
  display: flex; align-items: flex-start; gap: 1.25rem;
  position: relative;
  transition: background var(--t-base) var(--ease-out);
}
.stat-card + .stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 1px;
  background: linear-gradient(180deg, transparent 0%, var(--color-border) 30%, var(--color-border) 70%, transparent 100%);
}
.stat-card:hover { background: rgba(255, 255, 255, 0.03); }
[data-theme="light"] .stat-card:hover { background: rgba(0, 0, 0, 0.02); }

.stat-icon-container {
  padding: 10px;
  border-radius: var(--border-radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--kpi-icon-bg);
}
.stat-icon-container svg { width: 20px; height: 20px; }
.card-primary .stat-icon-container { color: var(--color-accent); }
.card-positive .stat-icon-container { color: var(--color-positive); }
.card-negative .stat-icon-container { color: var(--color-negative); }
.card-warm .stat-icon-container { color: var(--color-warm); }

.stat-info { min-width: 0; }
.stat-label { font-size: 12px; color: var(--color-text-muted); margin-bottom: 4px; }
.stat-value {
  font-size: 1.5rem; font-weight: 700;
  font-family: var(--font-family-mono);
  color: var(--color-text-primary);
  line-height: 1.2;
}

/* --- Hero KPI --- */
.hero-kpi {
  background: var(--hero-gradient);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  margin-bottom: var(--sp-6);
  color: var(--hero-text);
}

.hero-kpi-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-2);
}

.hero-kpi-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  font-family: var(--font-family-mono);
  letter-spacing: -0.03em;
  color: var(--hero-text);
}

.hero-kpi-delta {
  font-size: var(--text-sm);
  margin-top: var(--sp-2);
}
.hero-kpi-delta.positive { color: var(--color-positive); }
.hero-kpi-delta.negative { color: var(--color-negative); }

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--color-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.data-table thead { background: var(--table-header-bg); }

.data-table th {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0;
  background: var(--table-header-bg);
}

.data-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.data-table tbody tr:hover { background: var(--table-row-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.col-number { text-align: right; font-family: var(--font-family-mono); }
.col-mono { font-family: var(--font-family-mono); font-size: var(--text-sm); }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  font-size: 11px; font-weight: 600;
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
}
.badge-channel {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  border: 1px solid var(--color-accent-border);
}
.badge-mavima { background: var(--color-warm-soft); color: var(--color-warm); border: 1px solid var(--color-warm-border); }
.badge-santafe { background: var(--color-info-soft); color: var(--color-info); border: 1px solid rgba(129, 140, 248, 0.25); }
.badge-ml { background: var(--color-warning-soft); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.badge-woocommerce { background: var(--color-positive-soft); color: var(--color-positive); border: 1px solid rgba(74, 222, 128, 0.25); }

/* --- Empty State --- */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
}
.empty-state svg { width: 48px; height: 48px; color: var(--color-text-disabled); margin-bottom: var(--sp-4); }
.empty-state-title { font-size: var(--text-md); font-weight: 600; color: var(--color-text-secondary); margin-bottom: var(--sp-2); }
.empty-state-desc { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 400px; }

/* --- Loading skeleton --- */
.skeleton {
  background: var(--bg-skeleton);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Last updated timestamp --- */
.last-updated {
  font-size: 12px; color: var(--color-text-muted);
  font-family: var(--font-family-mono);
}
