/* ==========================================================================
   SHADCN PRIMITIVES CSS STYLESHEET
   Implements Radix/shadcn component contracts with zero external dependencies.
   ========================================================================== */

/* Base & Reset */
*, ::before, ::after {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  line-height: 1.5;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* Card */
.ui-card {
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.ui-card-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  border-bottom: 1px solid hsl(var(--border));
}

.ui-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.ui-card-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.ui-card-content {
  padding: 1.5rem;
}

.ui-card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Buttons */
.ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.375rem;
  padding: 0 1rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
}

.ui-button:focus-visible {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.ui-button-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.ui-button-primary:hover {
  filter: brightness(1.08);
}

.ui-button-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--border));
}
.ui-button-secondary:hover {
  background-color: hsl(var(--accent));
}

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

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

.ui-button-destructive {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.ui-button-sm {
  height: 1.875rem;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

/* Badges */
.ui-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
}

.ui-badge-default {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.ui-badge-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.ui-badge-outline {
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.ui-badge-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.25);
}

.ui-badge-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.25);
}

/* Tabs */
.ui-tabs-list {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background-color: hsl(var(--muted));
  padding: 0.25rem;
  gap: 0.25rem;
}

.ui-tabs-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  background: transparent;
  border: none;
  transition: all 0.15s ease;
}

.ui-tabs-trigger.active,
.ui-tabs-trigger[aria-selected="true"] {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Input & Form */
.ui-input {
  display: flex;
  height: 2.375rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: border-color 0.15s ease;
}

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

/* Data Table */
.ui-table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

.ui-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.ui-table th {
  padding: 0.75rem 1rem;
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ui-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

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

.ui-table tr:hover td {
  background-color: hsl(var(--accent));
}

/* Bottom Composer Primitive */
.ui-composer {
  display: flex;
  flex-direction: column;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ui-composer-body {
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.ui-composer-input {
  flex: 1;
  border: none;
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 0.9375rem;
  outline: none;
}

.ui-composer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
