/* RuniverseHub UI V2 · Componentes compartidos */

.rh-v2-button {
  display: inline-flex;
  min-height: var(--rh-v2-control-height);
  align-items: center;
  justify-content: center;
  gap: var(--rh-v2-space-2);
  border: 1px solid transparent;
  border-radius: var(--rh-v2-radius-md);
  padding: 0.5rem 1rem;
  background: var(--rh-v2-color-primary);
  color: var(--rh-v2-color-primary-foreground);
  box-shadow: var(--rh-v2-shadow-sm);
  font-size: var(--rh-v2-text-sm);
  font-weight: var(--rh-v2-weight-medium);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    border-color var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    color var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    opacity var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    transform var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    box-shadow var(--rh-v2-motion-fast) var(--rh-v2-ease-standard);
}

.rh-v2-button:hover {
  color: var(--rh-v2-color-primary-foreground);
  opacity: 0.9;
  transform: translate3d(0, -1px, 0);
}

.rh-v2-button:active {
  transform: translate3d(0, 0, 0);
}

.rh-v2-button:disabled,
.rh-v2-button[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.5;
}

.rh-v2-button svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  pointer-events: none;
  stroke: currentColor;
}

.rh-v2-button--secondary {
  background: var(--rh-v2-color-secondary);
  color: var(--rh-v2-color-secondary-foreground);
}

.rh-v2-button--secondary:hover {
  background: color-mix(in oklab, var(--rh-v2-color-secondary) 80%, var(--rh-v2-color-foreground));
  color: var(--rh-v2-color-secondary-foreground);
}

.rh-v2-button--outline {
  border-color: var(--rh-v2-color-input);
  background: transparent;
  color: var(--rh-v2-color-foreground);
  box-shadow: var(--rh-v2-shadow-sm);
}

.rh-v2-button--outline:hover {
  background: var(--rh-v2-color-accent);
  color: var(--rh-v2-color-accent-foreground);
  opacity: 1;
}

.rh-v2-button--ghost {
  background: transparent;
  color: var(--rh-v2-color-foreground);
  box-shadow: none;
}

.rh-v2-button--ghost:hover {
  background: var(--rh-v2-color-accent);
  color: var(--rh-v2-color-accent-foreground);
  opacity: 1;
}

.rh-v2-button--danger {
  background: var(--rh-v2-color-destructive);
  color: var(--rh-v2-color-destructive-foreground);
}

.rh-v2-button--link {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--rh-v2-color-primary);
  box-shadow: none;
  padding-inline: 0;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.rh-v2-button--link:hover {
  color: var(--rh-v2-color-primary);
  transform: none;
}

.rh-v2-button--sm {
  min-height: var(--rh-v2-control-height-sm);
  padding: 0.375rem 0.75rem;
  font-size: var(--rh-v2-text-xs);
}

.rh-v2-button--lg {
  min-height: var(--rh-v2-control-height-lg);
  padding-inline: 2rem;
}

.rh-v2-button--icon {
  width: var(--rh-v2-control-height);
  min-width: var(--rh-v2-control-height);
  padding: 0;
}

.rh-v2-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rh-v2-space-2);
}

.rh-v2-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rh-v2-color-border);
  border-radius: var(--rh-v2-radius-lg);
  background: var(--rh-v2-color-card);
  color: var(--rh-v2-color-card-foreground);
  box-shadow: var(--rh-v2-shadow-sm);
}

.rh-v2-card--elevated {
  box-shadow: var(--rh-v2-shadow-lg);
}

.rh-v2-card--context {
  border-color: color-mix(in oklab, var(--rh-v2-context-accent) 42%, var(--rh-v2-color-border));
  box-shadow: var(--rh-v2-shadow-context);
}

.rh-v2-card--sport {
  background:
    radial-gradient(600px 300px at 20% 0%, color-mix(in oklab, var(--rh-v2-color-primary) 22%, transparent), transparent 60%),
    radial-gradient(500px 260px at 100% 100%, color-mix(in oklab, var(--rh-v2-role-organizer) 18%, transparent), transparent 60%),
    linear-gradient(180deg, var(--rh-v2-color-surface-2), var(--rh-v2-color-surface));
}

.rh-v2-card--track {
  background-image:
    linear-gradient(90deg, color-mix(in oklab, var(--rh-v2-color-primary) 12%, transparent) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, var(--rh-v2-color-surface), var(--rh-v2-color-surface-2));
  background-size: 12px 100%, 100% 100%;
}

.rh-v2-card--interactive {
  transition:
    transform var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    border-color var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    box-shadow var(--rh-v2-motion-fast) var(--rh-v2-ease-standard);
}

.rh-v2-card--interactive:hover {
  transform: translate3d(0, -2px, 0);
  border-color: color-mix(in oklab, var(--rh-v2-context-accent) 34%, var(--rh-v2-color-border));
  box-shadow: var(--rh-v2-shadow-context);
}

.rh-v2-card__header,
.rh-v2-card__body,
.rh-v2-card__footer {
  padding: var(--rh-v2-space-6);
}

.rh-v2-card__header {
  display: flex;
  flex-direction: column;
  gap: var(--rh-v2-space-2);
}

.rh-v2-card__body {
  padding-top: 0;
}

.rh-v2-card__footer {
  display: flex;
  align-items: center;
  gap: var(--rh-v2-space-2);
  padding-top: 0;
}

.rh-v2-card__title {
  font-family: var(--rh-v2-font-display);
  font-size: var(--rh-v2-text-lg);
  font-weight: var(--rh-v2-weight-semibold);
  line-height: var(--rh-v2-leading-snug);
}

.rh-v2-card__description {
  color: var(--rh-v2-color-muted-foreground);
  font-size: var(--rh-v2-text-sm);
}

.rh-v2-chip,
.rh-v2-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid var(--rh-v2-color-border);
  border-radius: var(--rh-v2-radius-full);
  background: var(--rh-v2-color-surface-2);
  color: var(--rh-v2-color-muted-foreground);
  font-size: var(--rh-v2-text-xs);
  font-weight: var(--rh-v2-weight-medium);
  line-height: 1;
  white-space: nowrap;
}

.rh-v2-chip {
  padding: 0.25rem 0.5rem;
}

.rh-v2-badge {
  border-radius: var(--rh-v2-radius-md);
  padding: 0.25rem 0.625rem;
  font-weight: var(--rh-v2-weight-semibold);
}

.rh-v2-badge--primary,
.rh-v2-badge--success,
.rh-v2-badge--warning,
.rh-v2-badge--danger,
.rh-v2-badge--info,
.rh-v2-badge--context {
  border-color: transparent;
}

.rh-v2-badge--primary {
  background: var(--rh-v2-color-primary);
  color: var(--rh-v2-color-primary-foreground);
}

.rh-v2-badge--success {
  background: color-mix(in oklab, var(--rh-v2-color-success) 16%, transparent);
  color: var(--rh-v2-color-success);
}

.rh-v2-badge--warning {
  background: color-mix(in oklab, var(--rh-v2-color-warning) 16%, transparent);
  color: var(--rh-v2-color-warning);
}

.rh-v2-badge--danger {
  background: color-mix(in oklab, var(--rh-v2-color-danger) 16%, transparent);
  color: color-mix(in oklab, var(--rh-v2-color-danger) 78%, white);
}

.rh-v2-badge--info {
  background: color-mix(in oklab, var(--rh-v2-color-info) 16%, transparent);
  color: var(--rh-v2-color-info);
}

.rh-v2-badge--context {
  background: color-mix(in oklab, var(--rh-v2-context-accent) 16%, transparent);
  color: var(--rh-v2-context-accent);
}

.rh-v2-field {
  display: grid;
  gap: var(--rh-v2-space-2);
}

.rh-v2-label {
  color: var(--rh-v2-color-foreground);
  font-size: var(--rh-v2-text-sm);
  font-weight: var(--rh-v2-weight-medium);
}

.rh-v2-label__required {
  color: var(--rh-v2-color-danger);
}

.rh-v2-help,
.rh-v2-error {
  font-size: var(--rh-v2-text-xs);
  line-height: var(--rh-v2-leading-normal);
}

.rh-v2-help {
  color: var(--rh-v2-color-muted-foreground);
}

.rh-v2-error {
  color: color-mix(in oklab, var(--rh-v2-color-danger) 78%, white);
}

.rh-v2-input,
.rh-v2-select,
.rh-v2-textarea {
  display: flex;
  width: 100%;
  border: 1px solid var(--rh-v2-color-input);
  border-radius: var(--rh-v2-radius-md);
  background: transparent;
  color: var(--rh-v2-color-foreground);
  box-shadow: var(--rh-v2-shadow-sm);
  font-size: var(--rh-v2-text-base);
  transition:
    border-color var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    background-color var(--rh-v2-motion-fast) var(--rh-v2-ease-standard),
    box-shadow var(--rh-v2-motion-fast) var(--rh-v2-ease-standard);
}

.rh-v2-input,
.rh-v2-select {
  min-height: var(--rh-v2-control-height);
  padding: 0.25rem 0.75rem;
}

.rh-v2-textarea {
  min-height: 5rem;
  resize: vertical;
  padding: 0.5rem 0.75rem;
}

.rh-v2-input::placeholder,
.rh-v2-textarea::placeholder {
  color: var(--rh-v2-color-muted-foreground);
}

.rh-v2-input:focus,
.rh-v2-select:focus,
.rh-v2-textarea:focus {
  border-color: var(--rh-v2-color-ring);
  outline: none;
  box-shadow: var(--rh-v2-shadow-focus);
}

.rh-v2-input[aria-invalid="true"],
.rh-v2-select[aria-invalid="true"],
.rh-v2-textarea[aria-invalid="true"] {
  border-color: var(--rh-v2-color-danger);
}

.rh-v2-input:disabled,
.rh-v2-select:disabled,
.rh-v2-textarea:disabled {
  opacity: 0.5;
}

.rh-v2-select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--rh-v2-color-muted-foreground) 50%),
    linear-gradient(135deg, var(--rh-v2-color-muted-foreground) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}

.rh-v2-check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--rh-v2-space-2);
  color: var(--rh-v2-color-foreground);
  font-size: var(--rh-v2-text-sm);
}

.rh-v2-check input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.15rem;
  accent-color: var(--rh-v2-context-accent);
}

.rh-v2-alert {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--rh-v2-space-3);
  width: 100%;
  border: 1px solid var(--rh-v2-color-border);
  border-radius: var(--rh-v2-radius-lg);
  background: var(--rh-v2-color-background);
  padding: var(--rh-v2-space-4);
  color: var(--rh-v2-color-foreground);
  font-size: var(--rh-v2-text-sm);
}

.rh-v2-alert--success { border-color: color-mix(in oklab, var(--rh-v2-color-success) 50%, var(--rh-v2-color-border)); }
.rh-v2-alert--warning { border-color: color-mix(in oklab, var(--rh-v2-color-warning) 50%, var(--rh-v2-color-border)); }
.rh-v2-alert--danger { border-color: color-mix(in oklab, var(--rh-v2-color-danger) 50%, var(--rh-v2-color-border)); }
.rh-v2-alert--info { border-color: color-mix(in oklab, var(--rh-v2-color-info) 50%, var(--rh-v2-color-border)); }

.rh-v2-alert__icon {
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  place-items: center;
  color: var(--rh-v2-context-accent);
}

.rh-v2-alert__icon svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke: currentColor;
}

.rh-v2-alert--success .rh-v2-alert__icon { color: var(--rh-v2-color-success); }
.rh-v2-alert--warning .rh-v2-alert__icon { color: var(--rh-v2-color-warning); }
.rh-v2-alert--danger .rh-v2-alert__icon { color: var(--rh-v2-color-danger); }
.rh-v2-alert--info .rh-v2-alert__icon { color: var(--rh-v2-color-info); }

.rh-v2-alert__title {
  margin-bottom: var(--rh-v2-space-1);
  color: var(--rh-v2-color-foreground);
  font-weight: var(--rh-v2-weight-medium);
  line-height: var(--rh-v2-leading-snug);
}

.rh-v2-alert__description {
  color: var(--rh-v2-color-muted-foreground);
  line-height: var(--rh-v2-leading-relaxed);
}

.rh-v2-empty-state {
  display: grid;
  justify-items: center;
  gap: var(--rh-v2-space-3);
  border: 1px dashed var(--rh-v2-color-border-strong);
  border-radius: var(--rh-v2-radius-xl);
  background: color-mix(in oklab, var(--rh-v2-color-surface-2) 68%, transparent);
  padding: var(--rh-v2-space-8) var(--rh-v2-space-5);
  text-align: center;
}

.rh-v2-empty-state__icon,
.rh-v2-icon-frame {
  display: grid;
  place-items: center;
  border-radius: var(--rh-v2-radius-lg);
  background: color-mix(in oklab, var(--rh-v2-context-accent) 20%, transparent);
  color: var(--rh-v2-context-accent);
}

.rh-v2-empty-state__icon {
  width: 3rem;
  height: 3rem;
}

.rh-v2-icon-frame {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
}

.rh-v2-empty-state__icon svg,
.rh-v2-icon-frame svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
}

.rh-v2-empty-state__title {
  color: var(--rh-v2-color-foreground);
  font-family: var(--rh-v2-font-display);
  font-size: var(--rh-v2-text-lg);
  font-weight: var(--rh-v2-weight-semibold);
}

.rh-v2-empty-state__description {
  max-width: 30rem;
  color: var(--rh-v2-color-muted-foreground);
  font-size: var(--rh-v2-text-sm);
}

.rh-v2-metric {
  display: grid;
  gap: var(--rh-v2-space-1);
  min-width: 0;
}

.rh-v2-metric__label {
  color: var(--rh-v2-color-muted-foreground);
  font-size: var(--rh-v2-text-xs);
  font-weight: var(--rh-v2-weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rh-v2-metric__value {
  color: var(--rh-v2-color-foreground);
  font-family: var(--rh-v2-font-display);
  font-size: clamp(var(--rh-v2-text-2xl), 4vw, var(--rh-v2-text-3xl));
  font-weight: var(--rh-v2-weight-bold);
  line-height: var(--rh-v2-leading-none);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.rh-v2-metric__meta {
  color: var(--rh-v2-color-muted-foreground);
  font-size: var(--rh-v2-text-xs);
}

.rh-v2-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--rh-v2-color-border);
  border-radius: var(--rh-v2-radius-lg);
}

.rh-v2-table {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  color: var(--rh-v2-color-foreground);
  font-size: var(--rh-v2-text-sm);
}

.rh-v2-table caption {
  padding: var(--rh-v2-space-4);
  color: var(--rh-v2-color-muted-foreground);
  text-align: left;
}

.rh-v2-table th,
.rh-v2-table td {
  padding: var(--rh-v2-space-3);
  border-bottom: 1px solid var(--rh-v2-color-border);
  text-align: left;
  vertical-align: middle;
}

.rh-v2-table th {
  height: 2.5rem;
  color: var(--rh-v2-color-muted-foreground);
  font-weight: var(--rh-v2-weight-medium);
}

.rh-v2-table tbody tr {
  transition: background-color var(--rh-v2-motion-fast) var(--rh-v2-ease-standard);
}

.rh-v2-table tbody tr:hover {
  background: color-mix(in oklab, var(--rh-v2-color-muted) 50%, transparent);
}

.rh-v2-table tbody tr:last-child td {
  border-bottom: 0;
}

.rh-v2-list {
  display: grid;
  gap: var(--rh-v2-space-2);
  list-style: none;
}

.rh-v2-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rh-v2-space-3);
  border: 1px solid var(--rh-v2-color-border);
  border-radius: var(--rh-v2-radius-lg);
  background: color-mix(in oklab, var(--rh-v2-color-surface-2) 70%, transparent);
  padding: var(--rh-v2-space-3);
}

.rh-v2-progress {
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border-radius: var(--rh-v2-radius-full);
  background: var(--rh-v2-color-surface-3);
}

.rh-v2-progress__bar {
  width: clamp(0%, var(--rh-v2-progress, 0%), 100%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rh-v2-context-accent), var(--rh-v2-color-primary));
  transform-origin: left center;
}

.rh-v2-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--rh-v2-radius-md);
  background: color-mix(in oklab, var(--rh-v2-color-primary) 10%, var(--rh-v2-color-surface-2));
}

.rh-v2-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, oklch(1 0 0 / 8%), transparent);
  animation: rh-v2-shine 1.6s linear infinite;
}

.rh-v2-next-action {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--rh-v2-context-accent) 42%, var(--rh-v2-color-border));
  border-radius: var(--rh-v2-radius-lg);
  background: var(--rh-v2-color-card);
  padding: var(--rh-v2-space-4);
  box-shadow: var(--rh-v2-shadow-context);
}

.rh-v2-next-action::before {
  content: "";
  position: absolute;
  top: -4rem;
  right: -4rem;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: radial-gradient(circle, var(--rh-v2-context-accent), transparent 65%);
  opacity: 0.4;
  filter: blur(2rem);
  pointer-events: none;
}

.rh-v2-next-action__inner {
  position: relative;
  display: grid;
  gap: var(--rh-v2-space-3);
}

.rh-v2-next-action__main {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: var(--rh-v2-space-3);
}

.rh-v2-next-action__eyebrow {
  color: var(--rh-v2-context-accent);
  font-size: var(--rh-v2-text-2xs);
  font-weight: var(--rh-v2-weight-semibold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rh-v2-next-action__title {
  color: var(--rh-v2-color-foreground);
  font-family: var(--rh-v2-font-display);
  font-size: var(--rh-v2-text-lg);
  font-weight: var(--rh-v2-weight-semibold);
  line-height: var(--rh-v2-leading-tight);
}

.rh-v2-next-action__description {
  margin-top: var(--rh-v2-space-1);
  color: var(--rh-v2-color-muted-foreground);
  font-size: var(--rh-v2-text-sm);
}

.rh-v2-divider {
  width: 100%;
  height: 1px;
  border: 0;
  background: var(--rh-v2-color-border);
}

@media (min-width: 48rem) {
  .rh-v2-input,
  .rh-v2-select,
  .rh-v2-textarea {
    font-size: var(--rh-v2-text-sm);
  }

  .rh-v2-next-action {
    padding: var(--rh-v2-space-5);
  }

  .rh-v2-next-action__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

@media (max-width: 30rem) {
  .rh-v2-button-group > .rh-v2-button {
    width: 100%;
  }

  .rh-v2-card__header,
  .rh-v2-card__body,
  .rh-v2-card__footer {
    padding-inline: var(--rh-v2-space-4);
  }

  .rh-v2-card__body,
  .rh-v2-card__footer {
    padding-top: 0;
  }
}

/* Utilidades visuales del laboratorio y futuras composiciones compartidas */
.rh-v2-card__body--top {
  padding-top: var(--rh-v2-space-6);
}

.rh-v2-swatch {
  height: 4rem;
  background: var(--rh-v2-swatch, var(--rh-v2-context-accent));
}

.rh-v2-skeleton--dynamic {
  width: var(--rh-v2-skeleton-width, 100%);
  height: var(--rh-v2-skeleton-height, 0.75rem);
}
