/* ===== SHADCN/UI COMPONENTS FOR JBAKE ===== */
/* Static implementation of shadcn/ui components for JBake */

/* ===== BUTTON COMPONENT ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  focus-visible:outline-none;
  focus-visible:ring-2;
  focus-visible:ring-ring;
  focus-visible:ring-offset-2;
  disabled:pointer-events-none;
  disabled:opacity-50;
}

.btn--default {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}

.btn--default:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

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

.btn--destructive:hover {
  background-color: hsl(var(--destructive) / 0.9);
}

.btn--outline {
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

.btn--outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

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

.btn--secondary:hover {
  background-color: hsl(var(--secondary) / 0.8);
}

.btn--ghost {
  color: hsl(var(--foreground));
}

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

.btn--link {
  color: hsl(var(--primary));
  text-decoration: underline;
}

.btn--link:hover {
  color: hsl(var(--primary) / 0.8);
}

.btn--sm {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}

.btn--lg {
  height: 2.75rem;
  padding: 0 2rem;
  font-size: 1rem;
}

.btn--icon {
  height: 2.5rem;
  width: 2.5rem;
  padding: 0;
}

/* ===== CARD COMPONENT ===== */
.card {
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.card__header {
  display: flex;
  flex-direction: column;
  space-y: 1.5rem;
  padding: 1.5rem;
}

.card__title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
}

.card__description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.card__content {
  padding: 1.5rem;
}

.card__footer {
  display: flex;
  align-items: center;
  padding: 1.5rem;
}

/* ===== INPUT COMPONENT ===== */
.input {
  display: flex;
  height: 2.5rem;
  width: 100%;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  placeholder:color hsl(var(--muted-foreground));
  focus-visible:outline-none;
  focus-visible:ring-2;
  focus-visible:ring-ring;
  focus-visible:ring-offset-2;
  disabled:cursor-not-allowed;
  disabled:opacity-50;
}

.input:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* ===== LABEL COMPONENT ===== */
.label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  line-height: 1;
}

/* ===== BADGE COMPONENT ===== */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  focus:outline-none;
  focus:ring-2;
  focus:ring-ring;
  focus:ring-offset-2;
}

.badge--default {
  border: 1px solid transparent;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.badge--secondary {
  border: 1px solid transparent;
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.badge--destructive {
  border: 1px solid transparent;
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.badge--outline {
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}

/* ===== ALERT COMPONENT ===== */
.alert {
  position: relative;
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  padding: 1rem;
}

.alert--default {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

.alert--destructive {
  border-color: hsl(var(--destructive));
  color: hsl(var(--destructive));
}

.alert__title {
  margin-bottom: 0.25rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
}

.alert__description {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* ===== AVATAR COMPONENT ===== */
.avatar {
  position: relative;
  display: flex;
  height: 2.5rem;
  width: 2.5rem;
  overflow: hidden;
  border-radius: 9999px;
}

.avatar__image {
  aspect-ratio: 1 / 1;
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.avatar__fallback {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
}

/* ===== SEPARATOR COMPONENT ===== */
.separator {
  height: 1px;
  width: 100%;
  background-color: hsl(var(--border));
  margin: 1rem 0;
}

.separator--vertical {
  height: 100%;
  width: 1px;
  margin: 0 1rem;
}

/* ===== SCROLL AREA COMPONENT ===== */
.scroll-area {
  position: relative;
  overflow: hidden;
}

.scroll-area__viewport {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.scroll-area__scrollbar {
  display: flex;
  user-select: none;
  touch-action: none;
  padding: 2px;
  background: transparent;
  transition: background 160ms ease-out;
}

.scroll-area__scrollbar:hover {
  background: hsl(var(--border));
}

.scroll-area__scrollbar--vertical {
  width: 0.75rem;
  border-left: 1px solid hsl(var(--border));
}

.scroll-area__scrollbar--horizontal {
  flex-direction: column;
  height: 0.75rem;
  border-top: 1px solid hsl(var(--border));
}

.scroll-area__thumb {
  flex: 1;
  background: hsl(var(--border));
  border-radius: 0.75rem;
  position: relative;
}

.scroll-area__thumb::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  height: 100%;
  min-height: 2.25rem;
  width: 100%;
  min-width: 2.25rem;
  transform: translate(-50%, -50%);
}

/* ===== TOOLTIP COMPONENT ===== */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip__content {
  z-index: 50;
  overflow: hidden;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  animation-duration: 0.2s;
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.tooltip__content[data-state="delayed-open"] {
  animation-name: slideDownAndFade;
}

.tooltip__content[data-state="closed"] {
  animation-name: slideUpAndFade;
}

@keyframes slideDownAndFade {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUpAndFade {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-2px);
  }
}

/* ===== DROPDOWN MENU COMPONENT ===== */
.dropdown-menu {
  z-index: 50;
  min-width: 8rem;
  overflow: hidden;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  padding: 0.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  animation-duration: 0.2s;
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-menu__item {
  position: relative;
  display: flex;
  cursor: default;
  user-select: none;
  align-items: center;
  border-radius: 0.25rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  focus:bg-accent;
  focus:text-accent-foreground;
}

.dropdown-menu__item--disabled {
  pointer-events: none;
  opacity: 0.5;
}

.dropdown-menu__separator {
  margin: 0.25rem -0.25rem;
  height: 1px;
  background-color: hsl(var(--border));
}

/* ===== RESPONSIVE UTILITIES ===== */
@media (max-width: 640px) {
  .btn--sm {
    height: 1.75rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
  }
  
  .card__header,
  .card__content,
  .card__footer {
    padding: 1rem;
  }
  
  .input {
    height: 2.25rem;
    font-size: 0.875rem;
  }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  .card {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  }
  
  .tooltip__content {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  }
  
  .dropdown-menu {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .input,
  .badge,
  .tooltip__content,
  .dropdown-menu {
    transition: none;
  }
  
  .tooltip__content[data-state="delayed-open"],
  .tooltip__content[data-state="closed"] {
    animation: none;
  }
}

/* ===== FOCUS STYLES ===== */
.btn:focus-visible,
.input:focus-visible,
.badge:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */
@media print {
  .btn,
  .badge,
  .tooltip,
  .dropdown-menu {
    display: none;
  }
  
  .card {
    border: 1px solid #000;
    box-shadow: none;
  }
}
