/* Sheet Component Styles with Design Tokens */

:host {
  --seki-sheet-bg: var(--seki-background, hsl(0 0% 100%));
  --seki-sheet-border: var(--seki-border, hsl(240 5.9% 90%));
  --seki-sheet-text: var(--seki-foreground, hsl(240 10% 3.9%));
  --seki-sheet-text-muted: var(--seki-muted-foreground, hsl(240 3.8% 46.1%));
  --seki-sheet-overlay-bg: var(--seki-overlay, light-dark(rgb(0 0 0 / 0.5), rgb(0 0 0 / 0.7)));
  --seki-sheet-shadow: var(--seki-shadow-overlay, 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1));
  --seki-sheet-font-family: var(--seki-font-sans, system-ui, -apple-system, sans-serif);
  --seki-sheet-width: 24rem;
  --seki-sheet-height: 24rem;
  --seki-sheet-z-index: 50;
  --seki-sheet-animation-duration: 0.3s;

  display: contents;
}

/* Root sheet container */
.seki-sheet {
  display: contents;
}

/* Overlay */
.seki-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--seki-sheet-overlay-bg);
  z-index: var(--seki-sheet-z-index);
  animation: fadeIn var(--seki-sheet-animation-duration) ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Trigger */
.seki-sheet-trigger {
  display: inline-flex;
  cursor: pointer;
}

/* Content container */
.seki-sheet-content {
  position: fixed;
  z-index: calc(var(--seki-sheet-z-index) + 1);
  background: var(--seki-sheet-bg);
  box-shadow: var(--seki-sheet-shadow);
  font-family: var(--seki-sheet-font-family);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* Right side (default) */
.seki-sheet-content--right {
  top: 0;
  right: 0;
  height: 100%;
  width: var(--seki-sheet-width);
  max-width: 100%;
  border-left: 1px solid var(--seki-sheet-border);
  animation: slideInRight var(--seki-sheet-animation-duration) ease;
}

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

/* Left side */
.seki-sheet-content--left {
  top: 0;
  left: 0;
  height: 100%;
  width: var(--seki-sheet-width);
  max-width: 100%;
  border-right: 1px solid var(--seki-sheet-border);
  animation: slideInLeft var(--seki-sheet-animation-duration) ease;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Top side */
.seki-sheet-content--top {
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--seki-sheet-height);
  max-height: 100%;
  border-bottom: 1px solid var(--seki-sheet-border);
  animation: slideInTop var(--seki-sheet-animation-duration) ease;
}

@keyframes slideInTop {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Bottom side */
.seki-sheet-content--bottom {
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--seki-sheet-height);
  max-height: 100%;
  border-top: 1px solid var(--seki-sheet-border);
  animation: slideInBottom var(--seki-sheet-animation-duration) ease;
}

@keyframes slideInBottom {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Close button (built into content) */
.seki-sheet-close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: var(--seki-radius-sm, 4px);
  background: transparent;
  color: var(--seki-sheet-text-muted);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.seki-sheet-close-button:hover {
  opacity: 1;
}

.seki-sheet-close-button:focus-visible {
  outline: 2px solid var(--seki-ring, hsl(240 5.9% 10%));
  outline-offset: 2px;
}

.seki-sheet-close-button svg {
  width: 1rem;
  height: 1rem;
}

/* Header */
.seki-sheet-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem;
  padding-right: 3rem; /* Space for close button */
}

/* Title */
.seki-sheet-title {
  margin: 0;
  font-size: var(--seki-font-size-lg, 18px);
  font-weight: var(--seki-font-weight-semibold, 600);
  color: var(--seki-sheet-text);
  line-height: var(--seki-line-height-tight, 1.25);
}

/* Description */
.seki-sheet-description {
  margin: 0;
  font-size: var(--seki-font-size-sm, 14px);
  color: var(--seki-sheet-text-muted);
  line-height: var(--seki-line-height-normal, 1.5);
}

/* Footer */
.seki-sheet-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  margin-top: auto;
}

@media (min-width: 640px) {
  .seki-sheet-footer {
    flex-direction: row;
    justify-content: flex-end;
  }
}

/* Close wrapper */
.seki-sheet-close {
  display: inline-flex;
  cursor: pointer;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .seki-sheet-overlay,
  .seki-sheet-content--right,
  .seki-sheet-content--left,
  .seki-sheet-content--top,
  .seki-sheet-content--bottom,
  .seki-sheet-close-button {
    animation: none;
    transition: none;
  }
}

/* The panel itself takes focus only when it holds nothing focusable
   (tabindex="-1", see utils/overlay.ts); no ring on the whole panel. */
.seki-sheet-content:focus {
  outline: none;
}
