

/* media beillesztese, Drupal 8 media modullal */
hr {
  border: none;
  margin: 0;
  clear: both;
}

.media--type-youtube-video,
.media--type-remote-video {
  &[class*="colorbox"] {
    position: relative;
    &:after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: url("../images/youtube.svg") no-repeat center center;
      background-size: 50px;
      opacity: 0.8;
      pointer-events: none;
    }
    &:hover {
      cursor: pointer;
      &:after {
        opacity: 1;
      }
    }
  }
}

.embedded-entity {
  float: none;
  display: block;
  margin: 0 0 10px 0;
  box-sizing: border-box;
  .media[class*="colorbox"] {
    line-height: 0;
    &:hover {
      cursor: pointer;
    }
  }
  .media--type-document {
    .button {
      color: #8E6D25;
      padding: 0.5rem 2rem;
      border: 1px solid #9E7929;
      border-radius: 15px;
      display: inline-block;
      text-decoration: none;
    }
  }
	.media--type-image {
    line-height: 0;
  }
  .media--type-video {
    video {
      max-width: 100%;
      height: auto;
    }
  }
  .media--type-youtube-video,
  .media--type-remote-video {
    > .field {
      position: relative;
      height: 0;
      padding-top: 56.25%;
      iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
      }
    }
    &[class*="colorbox"] {
      > .field {
        height: auto;
        padding: 0;
      }
    }
  }
  &[data-entity-embed-display*="full_width"] {
    width: 100%;
  }
  &[data-entity-embed-display*="half_width"] {
    width: 50%;
  }
  &[data-entity-embed-display*="onethird_width"] {
    width: 33.33%;
  }
  &[data-entity-embed-display*="quarter_width"] {
    width: 25%;
  }
  img {
    width: 100%;
  }
  &.align-left {
    float: left;
    clear: none;
    padding-right: 10px;
  }
  &.align-right {
    float: right;
    clear: none;
    padding-left: 10px;
  }
  &.align-center {
    float: none;
    clear: both;
    margin-left: auto;
    margin-right: auto;
  }
}
figure {
  @extend .embedded-entity;
  &[class*="full_width"] {
    width: 100%;
  }
  &[class*="half_width"] {
    width: 50%;
  }
  &[class*="onethird_width"] {
    width: 33.33%;
  }
  &[class*="quarter_width"] {
    width: 25%;
  }
  figcaption {
    text-align: center;
    display: block !important;
  }
  & > .embedded-entity {
    max-width: 100%;
    width: 100% !important;
    margin: 0;
    display: inline-block;
  }
}

.box {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  margin: 1em -10px;
  width: auto;
  max-width: calc(100% + 20px);
  clear: both;
  box-sizing: border-box;
  > .embedded-entity {
    -webkit-align-self: stretch;
    align-self: stretch;
  }
  > div[class*="item"] {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-flex-grow: 1;
    flex-grow: 1;
    padding: 10px;
    margin: 0;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
    > * {
      width: 100%;
    }
    > p {
      &:first-child {
        margin-top: 0;
      }
      &:last-child {
        margin-bottom: 0;
      }
    }
    &.item-20 {
      max-width: 20%;
      width: 20%;
    }
    &.item-25 {
      max-width: 25%;
      width: 25%;
    }
    &.item-33 {
      max-width: 33%;
      width: 33%;
    }
    &.item-50 {
      max-width: 50%;
      width: 50%;
    }
    &.item-66 {
      max-width: 66%;
      width: 66%;
    }
    &.item-75 {
      max-width: 75%;
      width: 75%;
    }
    &.item-80 {
      max-width: 80%;
      width: 80%;
    }
    &.item-100 {
      max-width: 100%;
      width: 100%;
      float: none;
    }
    &.top {
      -webkit-justify-content: flex-start;
      justify-content: flex-start;
    }
    &.middle {
      -webkit-justify-content: center;
      justify-content: center;
    }
    &.bottom {
      -webkit-justify-content: flex-end;
      justify-content: flex-end;
    }
  }
  &.top {
    -webkit-align-items: flex-start;
    align-items: flex-start;
  }
  &.middle{
    -webkit-align-items: center;
    align-items: center;
  }
  &.bottom {
    -webkit-align-items: flex-end;
    align-items: flex-end;
  }
  &.left {
    -webkit-justify-content: flex-start;
    justify-content: flex-start;
  }
  &.center {
    -webkit-justify-content: center;
    justify-content: center;
  }
  &.right {
    -webkit-justify-content: flex-end;
    justify-content: flex-end;
  }
  div[class*="item"] {
    .embedded-entity {
      &[data-entity-embed-display*="full_width"],
      &[data-entity-embed-display*="half_width"],
      &[data-entity-embed-display*="onethird_width"],
      &[data-entity-embed-display*="quarter_width"] {
        width: 100%;
      }
    }
    figure {
      &[class*="full_width"],
      &[class*="half_width"],
      &[class*="onethird_width"],
      &[class*="quarter_width"] {
        width: 100%;
      }
    }
  }
}
.box-25,
.box-33,
.box-50 {
  @extend .box;
  > *,
  > .embedded-entity,
  > figure {
    padding-left: 10px;
    padding-right: 10px;
    .media {
      height: 100%;
    }
  }
}
.box-25 {
  > *,
  > .embedded-entity,
  > figure {
    width: 25%;
  }
}
.box-33 {
  > *,
  > .embedded-entity,
  > figure {
    width: 33.33%;
  }
}
.box-50 {
  > *,
  > .embedded-entity,
  > figure {
    width: 50%;
  }
}

.ck-content {
  margin: 0;
  padding: 8px;
  box-sizing: border-box;
  display: inline-block;
  width: 100%;
  img,
  video {
    max-width: 100%;
    height: auto;
  }
  iframe {
    pointer-events: none;
  }
  hr {
    border: 1px dotted;
  }
  
  .box {
    border: 2px dashed #999;
    background: #fff;
    margin-left: 0;
    margin-right: 0;
    > p {
      border: 1px dotted red;
      min-width: 8px;
      width: auto;
      margin: 5px;
      padding: 5px;
      /*-webkit-user-select: all;
      -moz-user-select: all;
      -ms-user-select: all;
      user-select: all;*/
      &:hover,
      &:focus {
        background-color: #ccc;
      }
    }
    > .ck-widget {
      -webkit-align-self: stretch;
      align-self: stretch;
      .embedded-entity {
        width: 100%;
      }
    }
    > div[class*="item"] {
      background-color: #eee;
      border: 2px solid #fff;
      p {
        border: 1px dotted #aaa;
      }
      &:hover,
      &:focus-within {
        background-color: #ccc;
      }
    }
    div[class*="item"] {
      .embedded-entity {
        &[data-entity-embed-display*="full_width"],
        &[data-entity-embed-display*="half_width"],
        &[data-entity-embed-display*="onethird_width"],
        &[data-entity-embed-display*="quarter_width"] {
          width: 100%;
        }
      }
    }
    .ck-widget {
      & + p {
        min-width: 8px;
        border: 1px dotted red;
      }
    }
  }
  .box-25,
  .box-33,
  .box-50 {
    padding: 3px;
    > *,
    > p,
    > div {
      padding: 3px;
      margin: 3px;
      -webkit-align-self: stretch;
      align-self: stretch;
      &:hover {
        background-color: #ccc;
      }
    }
    > *,
    > p {
      border: 1px dotted red;
    }
    > div {
      border: 1px dashed #333;
    }
  }
  .box-25 {
    > *,
    > p,
    > div  {
      width: calc(25% - 6px);
    }
  }
  .box-33 {
    > *,
    > p,
    > div  {
      width: calc(33.33% - 6px);
    }
  }
  .box-50 {
    > *
    > p,
    > div {
      width: calc(50% - 6px);
    }
  }
}


@media screen and (max-width: 1023px) {
  body:not(.cke_editable) {
    .box {
      > div[class*="item"] {
        &.item-20 {
          max-width: 25%;
          width: 25%;
        }
        &.item-25 {
          max-width: 33%;
          width: 33%;
        }
        &.item-75 {
          max-width: 66%;
          width: 66%;
        }
        &.item-80 {
          max-width: 75%;
          width: 75%;
        }
      }
    }
  }
}

@media screen and (max-width: 767px) {
  body:not(.cke_editable) {
    .box {
      > div[class*="item"] {
        &.item-20 {
          max-width: 33%;
          width: 33%;
        }
        &.item-33,
        &.item-66 {
          max-width: 50%;
          width: 50%;
        }
        &.item-80 {
          max-width: 66%;
          width: 66%;
        }
      }
    }
  }
}

@media screen and (max-width: 639px) {
  body:not(.cke_editable) {
    .box {
      > div[class*="item"] {
        &.item-20,
        &.item-25,
        &.item-75,
        &.item-80 {
          max-width: 50%;
          width: 50%;
        }
        &.item-50 {
          max-width: 100%;
          width: 100%;
        }
      }
    }
  }
}

@media screen and (max-width: 479px) {
  body:not(.cke_editable) {
    .box {
      > div[class*="item"] {
        max-width: 100% !important;
        width: 100% !important;
      }
    }
  }
}
