/**
 * Drawer styles
 * @countermeasure/web-components/navigation/drawer
 */

/* ============================================================================
   OVERLAY
   ============================================================================ */
.cmm-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 1000);
  background-color: hsl(0 0% 0% / 0.5);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.cmm-drawer-overlay--open {
  opacity: 1;
}

/* ============================================================================
   DRAWER PANEL
   ============================================================================ */
.cmm-drawer {
  position: fixed;
  z-index: calc(var(--z-modal, 1000) + 1);
  display: flex;
  flex-direction: column;
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

/* ============================================================================
   SIDE POSITIONS
   ============================================================================ */
.cmm-drawer--left {
  top: 0;
  left: 0;
  bottom: 0;
  max-width: 100%;
  transform: translateX(-100%);
}

.cmm-drawer--left.cmm-drawer--open {
  transform: translateX(0);
}

.cmm-drawer--right {
  top: 0;
  right: 0;
  bottom: 0;
  max-width: 100%;
  transform: translateX(100%);
}

.cmm-drawer--right.cmm-drawer--open {
  transform: translateX(0);
}

.cmm-drawer--top {
  top: 0;
  left: 0;
  right: 0;
  max-height: 100%;
  transform: translateY(-100%);
}

.cmm-drawer--top.cmm-drawer--open {
  transform: translateY(0);
}

.cmm-drawer--bottom {
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 100%;
  transform: translateY(100%);
}

.cmm-drawer--bottom.cmm-drawer--open {
  transform: translateY(0);
}

/* ============================================================================
   HEADER
   ============================================================================ */
.cmm-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.cmm-drawer__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.cmm-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.cmm-drawer__close:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--muted));
}

.cmm-drawer__close:focus-visible {
  outline: 2px solid hsl(var(--focus-ring));
  outline-offset: -1px;
}

/* ============================================================================
   CONTENT
   ============================================================================ */
.cmm-drawer__content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}
