@import "../../../../theme.scss";

$gray-50: #f8fafc;
$gray-100: #f1f5f9;
$gray-200: #e2e8f0;
$text-tertiary: #94a3b8;
$gradient-brand: linear-gradient(112.87deg, $primary 0%, $secondary 100%);

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */

.splash-screen-container {
  position: fixed;
  top: 32px;
  left: 160px;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0;
  z-index: 1;
  overflow: hidden;
  background: $gray-50;
}

body.folded .splash-screen-container {
  left: 36px;
}

@media screen and (max-width: 782px) {
  .splash-screen-container {
    top: 46px;
    left: 0;
  }

  body.folded .splash-screen-container {
    left: 0;
  }
}

body.is-fullscreen-mode .splash-screen-container {
  top: 0;
  left: 0;
}

.splash-screen {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* ========================================
   LEFT PANEL
   ======================================== */

.splash-screen__left {
  width: 41.67%;
  padding: 3rem 2.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border-right: 1px solid $gray-200;
}

.splash-screen__logo {
  margin-bottom: 2rem;
}

.splash-screen__logo svg {
  height: 36px;
  width: auto;
}

.splash-screen__header {
  margin-bottom: 2rem;
}

.splash-screen__headline {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: $text-primary !important;
  line-height: 1.2 !important;
  margin: 0 0 0.75rem !important;
}

.splash-screen__subtext {
  font-size: 1rem !important;
  font-weight: 400 !important;
  color: $text-secondary !important;
  line-height: 1.625 !important;
  margin: 0 !important;
}

.splash-screen__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 1.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: $text-secondary;
  transition: color 150ms ease-out;
}

.splash-screen__toggle:hover {
  color: $text-primary;
}

.splash-screen__toggle svg {
  flex-shrink: 0;
  transition: transform 150ms ease-out;
}

.splash-screen__toggle--open svg {
  transform: rotate(180deg);
}

/* ========================================
   API KEY INPUT
   ======================================== */

.splash-screen__field-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.splash-screen__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: $text-primary;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.splash-screen__input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.splash-screen__input-wrapper {
  position: relative;
  flex: 1;
}

.splash-screen__input {
  width: 100%;
  height: 48px;
  padding: 0 1.25rem;
  font-size: 1rem;
  background: #fff;
  color: $text-primary;
  border: 1.5px solid $border-field;
  border-radius: $border-radius;
  box-shadow: $shadow-sm;
  transition: all 300ms ease-out;
}

.splash-screen__input::placeholder {
  color: $text-placeholder;
}

.splash-screen__input:hover:not(:disabled) {
  border-color: $secondary-light;
}

.splash-screen__input:focus {
  outline: none !important;
  border-color: $secondary !important;
  box-shadow: 0 0 0 3px rgba($secondary, 0.15) !important;
}

.splash-screen__input--error {
  border-color: $red !important;
  background: $error-bg;
}

.splash-screen__input--error:focus {
  outline: none !important;
  border-color: $red !important;
  box-shadow: 0 0 0 3px rgba($red, 0.2) !important;
}

.splash-screen__clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 20px;
  color: $text-tertiary;
  cursor: pointer;
  padding: 0.25rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all 150ms ease-out;
}

.splash-screen__clear:hover {
  background: $gray-100;
  color: $text-primary;
}

.splash-screen__submit {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: $gradient-brand;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 300ms ease-out;
  box-shadow: $shadow-sm;
}

.splash-screen__submit svg {
  width: 22px;
  height: 22px;
}

.splash-screen__submit:hover:not(:disabled) {
  filter: brightness(0.9);
  box-shadow: $shadow-md;
  transform: scale(1.05);
}

.splash-screen__submit:active:not(:disabled) {
  transform: scale(0.95);
}

.splash-screen__submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.splash-screen__error {
  font-size: 0.875rem;
  font-weight: 500;
  color: $red;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.splash-screen__error::before {
  content: "⚠";
  font-size: 1rem;
}

/* ========================================
   NOTICE BOX
   ======================================== */

.splash-screen__notice {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: $gray-50;
  border-radius: $border-radius;
  margin-top: auto;
}

.splash-screen__notice-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.splash-screen__notice-content {
  flex: 1;
}

.splash-screen__notice-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: $text-primary;
}

.splash-screen__notice-text {
  font-size: 0.875rem;
  font-weight: 400;
  margin: 0;
  color: $text-secondary;
  line-height: 1.625;
}

/* ========================================
   RIGHT PANEL
   ======================================== */

.splash-screen__right {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.splash-screen__iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.splash-screen__validating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
}

.splash-screen__validating-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* ========================================
   SPINNER
   ======================================== */

.splash-screen__spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: splash-spin 0.6s linear infinite;
}

@keyframes splash-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
  .splash-screen__left {
    padding: 2rem;
  }
}

@media (max-width: 900px) {
  .splash-screen-container {
    overflow-y: auto;
  }

  .splash-screen {
    flex-direction: column;
    min-height: calc(100vh - 46px);
    height: auto;
  }

  .splash-screen__left {
    width: 100%;
    padding: 2rem;
    border-right: none;
    border-bottom: 1px solid $gray-200;
  }

  .splash-screen__right {
    min-height: 50vh;
  }
}

@media (max-width: 640px) {
  .splash-screen__logo {
    margin-bottom: 1.5rem;
  }

  .splash-screen__input {
    height: 44px;
  }
}

@media (min-width: 901px) {
  .splash-screen {
    min-height: calc(100vh - 32px);
  }
}
