/*
 * Framework-independent styles for the shared UI primitives.
 * Feature styles extend these defaults with ordinary class selectors.
 */

.ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease,
    box-shadow 150ms ease, opacity 150ms ease;
}

.ui-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px hsl(var(--ring));
}

.ui-button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.ui-button svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  pointer-events: none;
}

.ui-button--default {
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}
.ui-button--default:hover { background: hsl(var(--primary) / 0.9); }

.ui-button--destructive {
  color: hsl(var(--destructive-foreground));
  background: hsl(var(--destructive));
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.ui-button--destructive:hover { background: hsl(var(--destructive) / 0.9); }

.ui-button--outline {
  color: inherit;
  border: 1px solid hsl(var(--input));
  background: transparent;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.ui-button--outline:hover {
  color: hsl(var(--accent-foreground));
  background: hsl(var(--accent));
}

.ui-button--secondary {
  color: hsl(var(--secondary-foreground));
  background: hsl(var(--secondary));
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.ui-button--secondary:hover { background: hsl(var(--secondary) / 0.8); }

.ui-button--ghost { color: inherit; background: transparent; }
.ui-button--ghost:hover {
  color: hsl(var(--accent-foreground));
  background: hsl(var(--accent));
}

.ui-button--link {
  height: auto;
  padding: 0;
  color: hsl(var(--primary));
  background: transparent;
  text-underline-offset: 4px;
}
.ui-button--link:hover { text-decoration: underline; }

.ui-button--size-default { height: 2.25rem; padding: 0.5rem 1rem; }
.ui-button--size-small { height: 2rem; padding: 0 0.75rem; font-size: 0.75rem; }
.ui-button--size-large { height: 2.5rem; padding: 0 2rem; }
.ui-button--size-icon { width: 2.25rem; height: 2.25rem; padding: 0; }

.ui-card {
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}
.ui-card__header { display: flex; flex-direction: column; padding: 1.5rem; }
.ui-card__header > :not([hidden]) ~ :not([hidden]) { margin-top: 0.375rem; }
.ui-card__title { font-weight: 600; line-height: 1; letter-spacing: -0.025em; }
.ui-card__description { color: hsl(var(--muted-foreground)); font-size: 0.875rem; line-height: 1.25rem; }
.ui-card__content { padding: 0 1.5rem 1.5rem; }
.ui-card__footer { display: flex; align-items: center; padding: 0 1.5rem 1.5rem; }

.ui-input,
.ui-textarea {
  display: flex;
  width: 100%;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  color: inherit;
  background: transparent;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 1rem;
}
.ui-input { height: 2.25rem; padding: 0.25rem 0.75rem; transition: color 150ms ease, border-color 150ms ease; }
.ui-textarea { min-height: 3.75rem; padding: 0.5rem 0.75rem; }
.ui-input::placeholder,
.ui-textarea::placeholder { color: hsl(var(--muted-foreground)); }
.ui-input:focus-visible,
.ui-textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px hsl(var(--ring));
}
.ui-input:disabled,
.ui-textarea:disabled { cursor: not-allowed; opacity: 0.5; }
.ui-input::file-selector-button {
  border: 0;
  color: hsl(var(--foreground));
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
}

.ui-label { font-size: 0.875rem; font-weight: 500; line-height: 1; }
.peer:disabled ~ .ui-label { cursor: not-allowed; opacity: 0.7; }

.ui-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
  transition: color 150ms ease, background-color 150ms ease;
}
.ui-badge:focus { outline: none; box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring)); }
.ui-badge--default { color: hsl(var(--primary-foreground)); background: hsl(var(--primary)); box-shadow: 0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1); }
.ui-badge--default:hover { background: hsl(var(--primary) / 0.8); }
.ui-badge--secondary { color: hsl(var(--secondary-foreground)); background: hsl(var(--secondary)); }
.ui-badge--secondary:hover { background: hsl(var(--secondary) / 0.8); }
.ui-badge--destructive { color: hsl(var(--destructive-foreground)); background: hsl(var(--destructive)); box-shadow: 0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1); }
.ui-badge--destructive:hover { background: hsl(var(--destructive) / 0.8); }
.ui-badge--outline { border-color: hsl(var(--border)); color: hsl(var(--foreground)); background: transparent; }

.ui-alert {
  position: relative;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  font-size: 0.875rem;
}
.ui-alert > svg { position: absolute; top: 1rem; left: 1rem; color: hsl(var(--foreground)); }
.ui-alert > svg + div { transform: translateY(-3px); }
.ui-alert > svg ~ * { padding-left: 1.75rem; }
.ui-alert--destructive { border-color: hsl(var(--destructive) / .5); color: hsl(var(--destructive)); }
.dark .ui-alert--destructive { border-color: hsl(var(--destructive)); }
.ui-alert--destructive > svg { color: hsl(var(--destructive)); }
.ui-alert__title { margin: 0 0 0.25rem; font-weight: 500; line-height: 1; letter-spacing: -0.025em; }
.ui-alert__description { font-size: 0.875rem; }
.ui-alert__description p { line-height: 1.625; }

@media (min-width: 768px) {
  .ui-input, .ui-textarea { font-size: 0.875rem; }
}
