/**
 * The following styles get applied both on the front of your site
 * and in the editor.
 */


.wpengine-chatkit-block {
  // Inline mode styles
  &__container {
    width: 100%;
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;

    openai-chatkit {
      display: block;
      width: 100%;
      height: 100%;

      // Ensure smooth transitions
      &:not([style*="position: absolute"]) {
        position: relative;
        z-index: 1;
      }
    }
  }

  // FAB container styles
  &__fab-container {
    position: fixed;
    z-index: 9999;

    &--bottom-right {
      bottom: 20px;
      right: 20px;
    }

    &--bottom-left {
      bottom: 20px;
      left: 20px;
    }
  }

  // FAB button styles
  &__fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0073aa;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
      background: #005a87;
      box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
      transform: scale(1.05);
    }

    &:focus {
      outline: 2px solid #0073aa;
      outline-offset: 2px;
    }

    svg {
      width: 24px;
      height: 24px;
    }
  }

  // FAB widget (chat interface)
  &__widget {
    position: fixed;
    bottom: 90px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    overflow: hidden;

    openai-chatkit {
      display: block;
      width: 100%;
      height: 100%;
    }

    &--hidden {
      opacity: 0;
      visibility: hidden;
      transform: translateY(20px);
    }

    &--visible {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }
  }

  // Position the widget based on FAB position
  .wpengine-chatkit-block__fab-container--bottom-right & {
    &__widget {
      right: 20px;
    }
  }

  .wpengine-chatkit-block__fab-container--bottom-left & {
    &__widget {
      left: 20px;
    }
  }

  // Editor preview styles
  &__preview {
    width: 100%;
  }

  &__preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;

    svg {
      color: #0073aa;
      margin-bottom: 20px;
    }

    h3 {
      margin: 0 0 10px 0;
      font-size: 18px;
      font-weight: 600;
      color: #1e1e1e;
    }

    p {
      margin: 0 0 20px 0;
      color: #757575;
      max-width: 400px;
    }

    .components-notice {
      width: 100%;
      max-width: 500px;
      margin: 0;
    }
  }

  &__theme-preview {
    width: 100%;
    max-width: 500px;
    margin-top: 16px;
    transition: all 0.3s ease;

    strong {
      display: block;
      margin-bottom: 8px;
    }

    p {
      margin: 8px 0 !important;
    }

    input {
      margin-top: 8px;
      outline: none;

      &:focus {
        outline: 2px solid #0073aa;
        outline-offset: 2px;
      }
    }
  }

  &__inline-preview {
    border: 2px dashed #0073aa;
    border-radius: 8px;
    background: #f0f6fc;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
  }

  &__fab-preview {
    border: 2px dashed #0073aa;
    border-radius: 8px;
    background: #f0f6fc;
    padding: 40px 20px;
    min-height: 300px;
  }

  // Responsive styles
  @media (max-width: 768px) {
    &__widget {
      width: calc(100vw - 40px);
      height: calc(100vh - 120px);
    }
  }
}
