/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@use 'sass:math';

@import '../../../variables';

$icon-width: 100px;
$actual-icon-width: 520px;
$actual-icon-height: 400px;
$config-width: 400px;

@mixin sunk-panel {
  background: rgba($dark-gray1, 0.5);
  border-radius: $pt-border-radius;
  box-shadow: inset 0 1px 3px rgba($black, 0.32);
}

.input-source-step {
  position: relative;

  .ingestion-cards {
    position: absolute;
    top: 0;
    bottom: 0;
    right: $config-width + 20px;
    left: 0;
    @include sunk-panel;
    overflow: auto;
    display: grid;
    gap: $thin-padding;
    grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
    grid-template-rows: repeat(auto-fill, 150px);
    padding: 10px;

    .ingestion-card {
      position: relative;
      display: inline-block;
      vertical-align: top;
      text-align: center;

      & > * {
        user-select: none;
        pointer-events: none;
      }

      &.selected::after {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        content: '';
        border: 2px solid $blue3;
        border-radius: $pt-border-radius;

        .#{$bp-ns}-dark & {
          border: 2px solid $blue4;
        }
      }

      &.disabled {
        opacity: 0.4;
      }

      img {
        width: $icon-width;
        height: $icon-width * math.div($actual-icon-height, $actual-icon-width);
        display: inline-block;
      }
    }

    textarea {
      width: 100%;
      height: 100%;
      resize: none;
      white-space: pre;
    }

    .center-message {
      width: 100%;
      height: 100%;
    }
  }

  .config {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: $config-width;
    display: flex;
    flex-direction: column;
    gap: 10px;

    .top-controls {
      flex: 1;
      overflow: auto;

      .example-label {
        display: inline-block;
        vertical-align: top;

        .description {
          opacity: 0.6;
        }
      }

      .error-callout {
        overflow: auto;
      }
    }

    .bottom-controls {
      text-align: right;
    }
  }
}
