/* Three Column Content Section */

.three-column-content-section {
  &.full-width {
    width: 100%;
    margin-left: 0;
    margin-right: 0;

    .three-column-content-container {
      max-width: 100%;
      padding-left: 0;
      padding-right: 0;
    }
  }

  .three-column-content-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--column-gap, 40px);
    align-items: start;
    overflow: visible;

    @media screen and (min-width: 769px) {
      grid-template-columns: repeat(3, 1fr);
    }

    &.vertical-align-top {
      align-items: start;
    }

    &.vertical-align-center {
      align-items: center;
    }

    &.vertical-align-bottom {
      align-items: end;
    }
  }

  /* Content Column */
  .content-column {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 40px;
    box-sizing: border-box;

    @media screen and (max-width: 768px) {
      padding: unset;
      gap: .5em;
    }

    /* Figtree Font Support */
    &.font-figtree,
    &.font-figtree * {
      font-family: 'Figtree', sans-serif !important;
    }

    &.font-figtree {
      .heading-text,
      h2.heading-text,
      h3.copy-heading,
      h5.copy-heading,
      .copy-text,
      .copy-text p,
      .block-image-caption,
      .btn,
      .btn-primary,
      .btn-secondary,
      .block-button-group,
      .block-button-group .btn,
      .block-button-group .btn-primary,
      .block-button-group .btn-secondary,
      .block-button-group a.btn,
      .block-button-group a.btn-primary,
      .block-button-group a.btn-secondary,
      .block-button-group a,
      .video-preview-text {
        font-family: 'Figtree', sans-serif !important;
      }
    }

    /* Content Alignment */
    &.content-align-left {
      text-align: left;
      align-items: flex-start;

      .block-image,
      .block-heading,
      .block-copy,
      .block-button-group,
      .block-video-preview {
        text-align: left;
        align-self: flex-start;
      }

      .block-image {
        margin-left: 0;
        margin-right: auto;
      }
    }

    &.content-align-center {
      text-align: center;
      align-items: center;

      .block-image,
      .block-heading,
      .block-copy,
      .block-button-group,
      .block-video-preview {
        text-align: center;
        align-self: center;
      }

      .block-image {
        margin-left: auto;
        margin-right: auto;
      }

      .video-preview-wrapper {
        justify-content: center;
      }
    }

    &.content-align-right {
      text-align: right;
      align-items: flex-end;

      .block-image,
      .block-heading,
      .block-copy,
      .block-button-group,
      .block-video-preview {
        text-align: right;
        align-self: flex-end;
      }

      .block-image {
        margin-left: auto;
        margin-right: 0;
      }

      .video-preview-wrapper {
        justify-content: flex-end;
      }
    }
  }

  /* Block Styles */
  .block-image {
    margin-bottom: 16px;
    width: 100%;

    @media screen and (max-width: 768px) {
      &[style*="--min-width-mobile"] {
        min-width: var(--min-width-mobile);

        .block-image-img {
          min-width: var(--min-width-mobile);
        }
      }
    }
  }

  .block-image-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    max-width: 100%;
  }

  .block-image-caption {
    margin-top: 8px;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: #666;
    font-style: italic;
    text-align: inherit;
  }

  .heading-text {
    font-size: 2em;
    font-weight: 600;
    line-height: 1.5;
    color: #8f2e60;
    margin: 0;

    @media screen and (max-width: 768px) {
      font-size: 24px;
    }

    @media screen and (max-width: 480px) {
      font-size: 22px;
    }
  }

  .block-copy {
    margin-bottom: 16px;
  }

  .copy-heading {
    font-weight: 600;
    line-height: 1.5;
    color: #8f2e60;
    margin: 0;
    font-size: 0.875em;
  }

  .copy-text {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.8;
    color: #666;

    @media screen and (min-width: 768px) {
      font-size: 16px;
    }

    p {
      margin: 0 0 16px 0;
      font-size: 0.875rem;

      &:last-child {
        margin-bottom: 0;
      }
    }
  }

  /* Button Group */
  .block-button-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
    --button-bg-color: transparent;
    --button-text-color: inherit;
    --button-border-color: transparent;

    @media screen and (max-width: 768px) {
      flex-direction: column;
      width: 100%;
    }

    .btn {
      margin: 0;
      border: 1px solid var(--button-border-color);
      transition: opacity 0.2s ease-out;
      background-color: var(--button-bg-color);
      color: var(--button-text-color);

      @media screen and (max-width: 768px) {
        width: 100%;
      }

      &:hover {
        opacity: 0.9;
      }
    }

    /* Button Style Variants */
    &.button-style-square .btn {
      border-radius: 0;
    }

    &.button-style-slightly_rounded .btn {
      border-radius: 4px;
    }

    &.button-style-pill .btn {
      border-radius: 9999px;
    }

    .btn-primary {
      background-color: var(--button-bg-color);
      color: var(--button-text-color);
      border-color: var(--button-border-color);
    }

    .btn-secondary {
      background-color: transparent;
      color: var(--button-border-color);
      border-color: var(--button-border-color);
    }
  }

  /* Responsive Styles */
  @media screen and (max-width: 768px) {
    .three-column-content-container {
      gap: 30px;
      grid-template-columns: 1fr;
    }
  }

  /* Video Preview Block */
  .block-video-preview {
    margin-bottom: 16px;
    width: 100%;
  }

  .video-preview-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;

    @media screen and (max-width: 768px) {
      flex-direction: column;
      align-items: flex-start;
    }
  }

  .video-popup-trigger {
    cursor: pointer;
    flex-shrink: 0;

    &:hover {
      .video-preview-thumbnail {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
      }

      .video-play-button {
        transform: translate(-50%, -50%) scale(1.1);
      }
    }
  }

  .video-preview-thumbnail {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    width: 10em;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;

    @media screen and (max-width: 768px) {
      width: 100%;
      height: auto;
    }
  }

  .video-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .video-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }

  .video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: transform 0.2s ease;

    svg {
      filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    }
  }

  .video-preview-text {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    color: #333;

    @media screen and (max-width: 768px) {
      width: 100%;
    }
  }
}

/* Video Popup Modal - Global styles (appended to body) */
.video-popup-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;

  &.is-open {
    opacity: 1;
    visibility: visible;

    .video-popup-container {
      transform: scale(1);
    }
  }
}

.video-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.video-popup-container {
  position: relative;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  z-index: 1;
  transform: scale(0.9);
  transition: transform 0.3s ease;

  @media screen and (max-width: 768px) {
    width: 95%;
    max-height: 85vh;
  }

  media-video-player {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-height: 0;

    @media screen and (max-width: 768px) {
      aspect-ratio: 16 / 9;
    }

    video {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: block;
      object-fit: contain;
    }
  }
}

.video-popup-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 2;
  color: #333;

  @media screen and (max-width: 768px) {
    top: -40px;
    width: 36px;
    height: 36px;
  }

  &:hover {
    background: white;
    transform: rotate(90deg);
  }

  svg {
    width: 20px;
    height: 20px;

    @media screen and (max-width: 768px) {
      width: 18px;
      height: 18px;
    }
  }
}
