/* public/css/components.css */
/* ==========================================================================
   DEVPORTFOLIO — COMPONENTES DE UI
   Toasts, Skeletons, Botones, Cards, Badges, Modales, Tooltips & Form Inputs
   ========================================================================== */

/* --- BOTONES DE VANGUARDIA --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

/* Botones de ancho completo (width:100%, usados en CTAs largos) pueden
   necesitar más de una línea en mobile — si el texto no entra, que baje
   de línea en vez de desbordar cortado. Los botones cortos/pill siguen
   en una sola línea (el texto real nunca las excede). */
@media (max-width: 480px) {
  .btn {
    white-space: normal;
    text-align: center;
  }
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5), 0 0 20px rgba(6, 182, 212, 0.3);
  transform: translateY(-2px);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-surface-elev);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-glow);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
  color: var(--text-main);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-danger:hover {
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.4);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-md);
  aspect-ratio: 1;
}

/* --- TARJETAS GLASSMORPHISM CON SPOTLIGHT INTERACTIVO --- */
.card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
  overflow: hidden;
}

/* Halo de luz que sigue al cursor del mouse (estilo Linear.app) */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: radial-gradient(
    400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(99, 102, 241, 0.12),
    transparent 40%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}

/* Bisel de borde reflectivo */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    300px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(6, 182, 212, 0.5),
    rgba(99, 102, 241, 0.2) 30%,
    transparent 60%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.card:hover::before,
.card:hover::after {
  opacity: 1;
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(99, 102, 241, 0.15);
  transform: translateY(-3px);
}

.card > * {
  position: relative;
  z-index: 2;
}

/* --- INPUTS & AUTOCOMPLETADO (MEMORIA.MD) --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  position: relative;
}

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

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background-color: rgba(15, 23, 42, 0.85);
  outline: none;
}

/* Input con botón de limpiar X (Memoria.md) */
.input-clearable-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-input-clear {
  position: absolute;
  right: 0.625rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: none;
}
.btn-input-clear:hover { color: var(--text-main); }

/* Menú de Autocompletado Flotante */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: var(--bg-surface-elev);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: none;
}

.autocomplete-item {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color var(--transition-fast);
}
.autocomplete-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* --- BADGES & CHIPS LUMINOSOS --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.badge-primary { background: rgba(99, 102, 241, 0.15); color: #818cf8; border-color: rgba(99, 102, 241, 0.3); }
.badge-success { background: var(--success-bg); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(245, 158, 11, 0.3); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: rgba(244, 63, 94, 0.3); }
.badge-info    { background: var(--info-bg);    color: var(--info);    border-color: rgba(6, 182, 212, 0.3); }
.badge-neutral { background: var(--bg-surface-elev); color: var(--text-muted); border-color: var(--border-subtle); }

/* --- TOAST NOTIFICATIONS (MEMORIA.MD) --- */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  padding: 0.875rem 1.125rem;
  background-color: var(--bg-surface-elev);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success { border-left-color: var(--success); }
.toast-danger  { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* --- SKELETON LOADERS (MEMORIA.MD) --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface-elev) 25%, var(--bg-surface-hover) 50%, var(--bg-surface-elev) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonPulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 1rem; margin-bottom: 0.5rem; width: 100%; }
.skeleton-title { height: 1.75rem; width: 60%; margin-bottom: 1rem; }
.skeleton-card { height: 140px; width: 100%; }

/* --- TOOLTIPS (MEMORIA.MD) --- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #000;
  color: #fff;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 50;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* --- MODAL --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}
