/* ============================================
   FBA Listing Suite — Design System
   Estilo inspirado en dashboard.png (Soft UI)
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  /* Colores principales */
  --bg-primary: #E8ECF1;
  --bg-secondary: #DDE2E9;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8F9FB;
  --bg-input: #F2F4F7;
  --bg-input-focus: #FFFFFF;
  --bg-dark: #1A1D23;

  /* Colores de texto */
  --text-primary: #1A1D23;
  --text-secondary: #5A6170;
  --text-tertiary: #8A91A0;
  --text-inverse: #FFFFFF;
  --text-link: #4F7DF3;

  /* Colores de acento */
  --accent-orange: #E8603C;
  --accent-orange-light: #FEF0EC;
  --accent-blue: #4F7DF3;
  --accent-blue-light: #EBF0FE;
  --accent-green: #34C759;
  --accent-green-light: #E8F9ED;
  --accent-red: #E53E3E;
  --accent-red-light: #FEE8E8;
  --accent-yellow: #F5A623;
  --accent-yellow-light: #FFF8EB;
  --accent-purple: #7C5CFC;
  --accent-purple-light: #F0ECFE;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.10);
  --shadow-inner: inset 0 2px 4px rgba(0,0,0,0.04);

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Espaciado */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Tipografía */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.9375rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.375rem;
  --font-size-2xl: 1.75rem;
  --font-size-3xl: 2.25rem;
  --font-size-4xl: 3rem;

  /* Transiciones */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-modal: 200;
  --z-toast: 300;
  --z-tooltip: 400;
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-blue); }

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }

.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}
.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}
.card-body { flex: 1; }
.card-footer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--bg-secondary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent-orange);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(232, 96, 60, 0.3);
}
.btn-primary:hover {
  background: #d4532f;
  box-shadow: 0 4px 16px rgba(232, 96, 60, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-secondary);
}

.btn-blue {
  background: var(--accent-blue);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(79, 125, 243, 0.3);
}
.btn-blue:hover {
  background: #3d6be0;
  box-shadow: 0 4px 16px rgba(79, 125, 243, 0.4);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.btn-success {
  background: var(--accent-green);
  color: var(--text-inverse);
}

.btn-danger {
  background: var(--accent-red);
  color: var(--text-inverse);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--font-size-md);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Inputs --- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}
.form-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(79, 125, 243, 0.12);
}
.form-input::placeholder {
  color: var(--text-tertiary);
}
.form-input.error {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.1);
}

.form-textarea {
  min-height: 120px;
  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='%235A6170' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}
.form-error {
  font-size: var(--font-size-xs);
  color: var(--accent-red);
  margin-top: var(--space-xs);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-orange { background: var(--accent-orange-light); color: var(--accent-orange); }
.badge-blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.badge-green { background: var(--accent-green-light); color: var(--accent-green); }
.badge-red { background: var(--accent-red-light); color: var(--accent-red); }
.badge-yellow { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); }
.badge-gray { background: var(--bg-input); color: var(--text-secondary); }

/* --- Tags --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  transition: width var(--transition-slow);
}
.progress-bar-fill.success {
  background: linear-gradient(90deg, var(--accent-green), #2CBE4E);
}
.progress-bar-fill.warning {
  background: linear-gradient(90deg, var(--accent-yellow), var(--accent-orange));
}
.progress-bar-fill.danger {
  background: linear-gradient(90deg, var(--accent-red), #C53030);
}

/* --- Toggle Switch --- */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}
.toggle input:checked + .toggle-slider {
  background: var(--accent-blue);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 29, 35, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-base);
}
.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}
.modal-close:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

/* --- Toast / Notification --- */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.toast {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 300px;
  animation: slideIn var(--transition-base) ease forwards;
}
.toast.toast-success { border-left: 4px solid var(--accent-green); }
.toast.toast-error { border-left: 4px solid var(--accent-red); }
.toast.toast-warning { border-left: 4px solid var(--accent-yellow); }
.toast.toast-info { border-left: 4px solid var(--accent-blue); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Metric Card --- */
.metric-card {
  text-align: center;
}
.metric-value {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--space-xs);
}
.metric-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
}
.metric-delta {
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-top: var(--space-xs);
}
.metric-delta.up { color: var(--accent-green); }
.metric-delta.down { color: var(--accent-red); }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}
.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}
.empty-state-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto var(--space-lg);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 3px;
}
.tab {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* --- Stepper --- */
.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}
.step {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 700;
}
.step.active .step-number {
  background: var(--accent-blue);
  color: white;
}
.step.completed .step-number {
  background: var(--accent-green);
  color: white;
}
.step-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-tertiary);
}
.step.active .step-label { color: var(--text-primary); }
.step.completed .step-label { color: var(--accent-green); }
.step-connector {
  flex: 1;
  height: 2px;
  background: var(--bg-secondary);
  min-width: 24px;
}
.step-connector.completed { background: var(--accent-green); }

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* --- Utility --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-fade-in { animation: fadeIn var(--transition-base) ease forwards; }
.animate-fade-in-up { animation: fadeInUp var(--transition-slow) ease forwards; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* Stagger children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-secondary) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
