/**
 * DAM P8 � library edit sheet, overlay backdrop, anchored menus.
 */

.dam-overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1190;
  background: rgba(15, 18, 22, 0.38);
  backdrop-filter: blur(2px);
}

.dam-overlay-backdrop[hidden] {
  display: none !important;
}

.dam-library-edit-popover.dam-overlay-sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(400px, calc(100vw - 24px));
  max-height: none;
  margin: 0;
  border-radius: 0;
  border-right: 0;
  border-top: 0;
  border-bottom: 0;
  overflow-y: auto;
  z-index: 1200;
  transform: none !important;
  box-shadow: -8px 0 32px rgba(15, 18, 22, 0.12);
}

.dam-library-edit-popover.dam-overlay-sheet .dam-library-edit-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  box-sizing: border-box;
  padding-bottom: 0;
}

.dam-library-edit-popover.dam-overlay-sheet .dam-library-edit-form-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
}

.dam-library-edit-popover.dam-overlay-sheet .dam-popover-actions {
  position: sticky;
  bottom: 0;
  flex-shrink: 0;
  margin: 0;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line, #e4e2de);
  background: #fff;
  z-index: 2;
}

.dam-workspace .dam-chrome-row--context {
  align-items: center;
}

.dam-workspace .dam-ventura-nav-context,
.dam-workspace .dam-ventura-breadcrumb-wrap {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.dam-workspace .dam-ventura-header-actions {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
}

.dam-upload-actions-wrap {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.dam-upload-split:not(.studio-action-btn--primary) {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: var(--btn-primary-bg, #2d2a26);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  min-height: 36px;
  overflow: hidden;
}

.dam-upload-split:not(.studio-action-btn--primary):hover {
  background: var(--btn-primary-bg-hover, #1b1814);
}

.dam-upload-split-label {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  white-space: nowrap;
}

.dam-upload-split-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  flex-shrink: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
}

.dam-upload-split[aria-expanded="true"] {
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.18);
}

.dam-upload-actions-wrap .dam-upload-primary {
  border-radius: 8px 0 0 8px;
}

.dam-upload-actions-wrap .dam-upload-more {
  border-radius: 0 8px 8px 0;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 10px;
  min-width: 36px;
  background: var(--btn-primary-bg, #2d2a26);
  color: #fff;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
}

.dam-upload-actions-wrap .dam-upload-more:hover {
  background: var(--btn-primary-bg-hover, #1b1814);
}

.dam-new-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.dam-new-menu-wrap .dam-new-menu:not(.dam-new-menu--portaled) {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  width: max-content;
  min-width: 0;
  max-width: min(280px, calc(100vw - 24px));
}

.dam-new-menu.dam-new-menu--portaled {
  position: fixed;
  z-index: 240;
  display: flex;
  flex-direction: column;
  width: max-content;
  min-width: 0;
  max-width: min(280px, calc(100vw - 24px));
  padding: 6px;
  border: 1px solid var(--dam-ventura-line, #e8e6e2);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(27, 24, 20, 0.14);
}

.dam-new-menu.dam-new-menu--portaled button[data-dam-new-action] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: max-content;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1b1814;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}

.dam-new-menu.dam-new-menu--portaled button[data-dam-new-action]:hover:not(:disabled) {
  background: #f3f1ed;
}

.dam-new-menu.dam-new-menu--portaled button[data-dam-new-action]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dam-new-menu.dam-new-menu--portaled .dam-new-menu-icon {
  width: 18px;
  flex-shrink: 0;
}

.dam-new-menu.dam-new-menu--portaled .dam-new-menu-label {
  flex: 0 1 auto;
}

/* --- Advanced filter drawer (portaled overlay) --- */

body.dam-filter-drawer-open {
  overflow: hidden;
}

.dam-filter-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(27, 24, 20, 0.28);
}

.dam-filter-drawer-backdrop[hidden] {
  display: none !important;
}

.dam-filter-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 510;
  display: flex;
  flex-direction: column;
  width: min(420px, 92vw);
  max-width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  background: #fff;
  box-shadow: -8px 0 32px rgba(27, 24, 20, 0.12);
}

.dam-filter-drawer[hidden] {
  display: none !important;
}

.dam-filter-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--dam-ventura-line, #e8e6e2);
  flex-shrink: 0;
}

.dam-filter-drawer-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.dam-filter-drawer-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
}

.dam-filter-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px 12px;
  -webkit-overflow-scrolling: touch;
}

.dam-filter-drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--dam-ventura-line, #e8e6e2);
  background: #fff;
}

.dam-filter-drawer-clear {
  margin-right: auto;
  font-size: 0.86rem;
  font-weight: 500;
}

.dam-filter-drawer-done {
  min-width: 88px;
}

.dam-filter-drawer-body .dam-filter-panel-primary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--dam-ventura-line, #e8e6e2);
}

.dam-filter-drawer-body .dam-filter-panel-primary:empty {
  display: none;
  margin: 0;
  padding: 0;
  border: 0;
}

.dam-filter-drawer-body .dam-filter-panel-label {
  margin: 14px 0 8px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dam-ventura-muted, #6b6560);
}

.dam-filter-drawer-body .dam-filter-drawer-section:first-of-type .dam-filter-panel-label {
  margin-top: 0;
}

.dam-filter-drawer-body .dam-filter-primary-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.dam-filter-drawer-body .dam-filter-primary-label {
  flex: 0 0 100%;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dam-ventura-muted, #6b6560);
}

@media (max-width: 900px) {
  .dam-filter-drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: min(88vh, 720px);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(27, 24, 20, 0.14);
  }

  .dam-library-edit-popover.dam-overlay-sheet {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(88vh, 640px);
    border-radius: 16px 16px 0 0;
    border-left: 0;
  }
}
