@import './czi-vars.css';

.czi-image-view {
  clear: both;
  display: inline-block;
  line-height: 0;
  margin: 0 2px; /* This should be synced to the constant IMAGE_MARGIN in JS. */
  max-width: 100%;
  text-align: center;
  vertical-align: baseline;
}

.czi-image-view.ProseMirror-selectednode {
  outline: none;
}

.czi-image-view.align-left {
  float: left;
  margin: 0 40px 20px 0;
}

.czi-image-view.align-right {
  float: right;
  margin: 0 0 20px 40px;
}

.czi-image-view.align-center {
  clear: both;
  display: block;
  float: none;
  margin: 20px 0;
}

.czi-image-view-body-img-clip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

.czi-image-view-body {
  clear: both;
  display: inline-block;
  max-width: 100%;
  position: relative;
}

.czi-image-view-body.loading::before {
  animation: czi_animation_blink normal 800ms infinite ease-in-out;
  background-color: #cdcdcd;
  bottom: 0;
  content: '';
  cursor: wait;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

.czi-image-view-body.error::before {
  background-color: #fff;
  outline: solid 1px #cdcdcd;
  bottom: 0;
  content: '';
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

.czi-image-view-body .czi-icon.error {
  color: red;
  left: 50%;
  position: absolute;
  top: 50%;
  z-index: 4;
  margin: -11px 0 0 -11px;
  font-size: 22px;
}

.czi-image-view-body.selected::after {
  /* simulated selection highlight */
  background-color: var(--czi-selection-highlight-color-dark);
  bottom: 0;
  content: '';
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 2;
}

.czi-image-view-body.active.selected::after {
  /* hide the highlight so user can resize the image easily. */
  display: none;
}

.czi-image-view-body.active {
  background-color: transparent;
  box-shadow: 0 0 0 2px var(--czi-selection-highlight-color-dark);
}

.czi-image-view-body.error {
  /* outline: var(--czi-border-red); */
}

@media only print {
  .czi-image-view-body.active {
    box-shadow: none;
  }
}

@keyframes czi_animation_blink {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}
