/* ====================================================
   Components (Buttons, Cards, Forms, Badges)
   ==================================================== */

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.5;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #FFFFFF;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-secondary);
}
.btn-secondary:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-primary);
}

.btn-danger {
  background: var(--color-error);
  color: #FFFFFF;
}
.btn-danger:hover {
  background: #DC2626; /* Tailwind Red 600 */
}

.btn-success {
  background: var(--color-success);
  color: #FFFFFF;
}
.btn-success:hover {
  background: #059669; /* Tailwind Emerald 600 */
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.btn-sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn-lg { padding: 12px 24px; font-size: var(--text-base); }
.btn-xl { padding: 16px 32px; font-size: var(--text-lg); border-radius: var(--border-radius-lg); }
.btn-full { width: 100%; }

/* Loading State */
.btn.loading {
  position: relative;
  color: transparent !important;
}
.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #FFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  top: calc(50% - 8px);
  left: calc(50% - 8px);
}
.btn-secondary.loading::after, .btn-ghost.loading::after {
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: var(--color-primary);
}

/* === Cards === */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  box-shadow: var(--glass-shadow);
  transition: box-shadow var(--transition-base), transform var(--transition-base), background var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  background: var(--glass-bg-hover);
}

.card-header {
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
}

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

/* === Forms === */
.form-group {
  margin-bottom: var(--space-4);
}

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

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-secondary);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

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

.form-input:disabled {
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: not-allowed;
}

.password-wrapper {
  position: relative;
}
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
}
.password-toggle:hover { color: var(--text-primary); }

.form-error {
  color: var(--color-error);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.form-error::before { display: none; }

/* === Badges & Tags === */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  border-radius: var(--border-radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--border-radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: 0.02em;
}

.status-badge--pending { background: #FEF3C7; color: #D97706; }    /* Amber */
.status-badge--processing { background: #DBEAFE; color: #2563EB; } /* Blue */
.status-badge--printing { background: #E0E7FF; color: #4F46E5; }   /* Indigo */
.status-badge--shipped { background: #D1FAE5; color: #059669; }    /* Emerald */
.status-badge--cancelled { background: #FEE2E2; color: #DC2626; }  /* Red */

/* === Tables === */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-primary);
  background: var(--bg-base);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-primary);
}

.table td {
  padding: var(--space-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-primary);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: var(--bg-surface-2);
}

/* === Modals === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
}

.modal-content {
  background: var(--bg-base);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-xl);
  width: 100%;
  max-width: 500px;
  padding: var(--space-6);
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modalIn var(--transition-spring) forwards;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: var(--z-toast);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  animation: toastIn var(--transition-spring) forwards;
  min-width: 250px;
}

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.modal-header h3 { margin: 0; font-size: var(--text-xl); font-weight: var(--font-bold); }
.modal-body { margin-bottom: var(--space-6); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--space-3); }

/* === Badges colorés === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--border-radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.badge-success { background: #D1FAE5; color: #059669; }
.badge-danger  { background: #FEE2E2; color: #DC2626; }
.badge-info    { background: #DBEAFE; color: #2563EB; }
.badge-warning { background: #FEF3C7; color: #D97706; }

/* === Table container (alias de table-responsive) === */
.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-primary);
  background: var(--bg-base);
}

/* === Form hint === */
.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}
