/* [data-component="dialog-trigger"] { } */

[data-component="dialog-overlay"] {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: var(--v2-overlay-simple-overlay-scrim);
}

[data-component="dialog-v2"] {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;

  [data-slot="dialog-container"] {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 480px;
    height: 368px;
    background: var(--v2-background-bg-layer-01);
    box-shadow: var(--v2-elevation-overlay);
    border-radius: 6px;
    overflow: hidden;
    pointer-events: auto;

    [data-slot="dialog-content"] {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      align-self: stretch;
      width: 100%;
      max-height: 100%;
      flex: 1;
      overflow: auto;
      background: transparent;

      scrollbar-width: none;
      -ms-overflow-style: none;
      &::-webkit-scrollbar {
        display: none;
      }

      [data-slot="dialog-header"] {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        align-self: stretch;
        width: 100%;
        gap: 0;
        padding: 16px;
        flex-shrink: 0;

        [data-slot="dialog-header-title"] {
          margin: 0;
          flex: 1;
          min-width: 0;
          user-select: none;
          font-weight: 530;
          font-size: 13px;
          line-height: 16px;
          letter-spacing: -0.04px;
          color: var(--v2-text-text-base);
          font-variation-settings: "slnt" 0;
        }

        [data-slot="dialog-title-group"] {
          display: flex;
          flex-direction: column;
          align-items: flex-start;
          gap: 4px;
          flex: 1;
          min-width: 0;
        }

        [data-slot="dialog-title"] {
          margin: 0;
          flex: none;
          flex-grow: 0;
          user-select: none;
          font-weight: 530;
          font-size: 15px;
          line-height: 20px;
          letter-spacing: -0.13px;
          color: var(--v2-text-text-base);
          font-variation-settings: "slnt" 0;
        }

        [data-slot="dialog-description"] {
          flex: none;
          flex-grow: 0;
          user-select: none;
          font-weight: 440;
          font-size: 13px;
          line-height: 20px;
          letter-spacing: -0.04px;
          color: var(--v2-text-text-muted);
          font-variation-settings: "slnt" 0;
        }

        [data-slot="dialog-close-button"] {
          display: flex;
          justify-content: center;
          align-items: center;
          width: 20px;
          height: 20px;
          margin-top: -2px;
          margin-right: -2px;
          margin-left: auto;
          border-radius: 4px;
          flex-shrink: 0;
          cursor: pointer;
          color: var(--v2-icon-icon-muted);

          &:hover {
            background: var(--v2-overlay-simple-overlay-hover);
          }
        }

        &[data-hide-close] [data-slot="dialog-close-button"] {
          display: none;
        }
      }

      [data-slot="dialog-footer"] {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: flex-start;
        padding: 16px;
        gap: 8px;
        align-self: stretch;
        flex-shrink: 0;
      }

      [data-slot="dialog-body"] {
        width: 100%;
        position: relative;
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;

        &:focus-visible {
          outline: none;
        }
      }
      &:focus-visible {
        outline: none;
      }
    }
  }

  &[data-fit] {
    [data-slot="dialog-container"] {
      height: auto;

      [data-slot="dialog-content"] {
        min-height: 0;
      }
    }
  }

  &[data-size="large"] [data-slot="dialog-container"] {
    width: 640px;
    height: 480px;
  }

  /* Content-hugging card: the box shrink-wraps its children in both axes and centers them —
     no fixed-box dead zones (the tour/placeholder class of dialog). Children own their width
     bounds (e.g. min-w/max-w utility classes). */
  &[data-size="content"] [data-slot="dialog-container"] {
    width: fit-content;
    height: auto;
    max-width: min(calc(100vw - 32px), 640px);
    max-height: calc(100vh - 92px);
    align-items: center;

    [data-slot="dialog-content"] {
      min-height: 0;
      width: fit-content;
    }
  }

  &[data-size="x-large"] [data-slot="dialog-container"] {
    width: min(calc(100vw - 32px), 980px);
    height: min(calc(100vh - 92px), 600px);
  }
}
