@import "../../src/scss/init";
@import "auth-variables";

@mixin smooth-transition {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@mixin card-base {
  border-radius: $auth-border-radius;
  box-shadow: $auth-card-shadow;
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

// === AUTH BASE STYLES ===
.auth-wrapper {
  font-family: $auth-font-family;
  @include gradient--bg($auth-primary-start, $auth-primary-end);
  position: relative;
  min-height: 100vh;

  // MAIN CARD
  .card {
    @include card-base;
    max-width: $auth-card-max-width;
    margin: 0 auto;
    position: relative;
  }

  // BRAND LOGO
  .brand-logo-corner {
    display: block;
    width: 100%;

    a img.logo-image {
      max-width: 220px;
      display: block;
      object-fit: contain;
      filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));
      margin: 0 auto 2rem;
    }

    div.back-to-home{
      display: block;
      a {
        color: $auth-primary-start;
      }
    }
  }

  // FORM CONTAINER
  .auth-form-container {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);

    .brand-title {
      font-weight: 800;
      font-size: $auth-title-size-desktop;
      @include gradient--bg($auth-title-start, $auth-title-end);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      margin-bottom: 2rem;
      letter-spacing: -0.02em;
      text-align: center;
    }

    p {
      color: #64748b;
      font-size: 0.95rem;
      line-height: 1.5;
    }
  }

  // FORM CONTENT
  .auth-form {
    padding: 2rem 0 0;
    .form-item {
      margin-bottom: 1.5rem;

      label {
        font-weight: 600;
        color: #2d3748;
        margin-bottom: 0.75rem;
        font-size: 0.95rem;
        display: block;
        letter-spacing: 0.025em;
      }

      input,
      textarea,
      select {
        border: 2px solid #e2e8f0;
        border-radius: $auth-input-border-radius;
        padding: 1rem 1.25rem;
        font-size: 1rem;
        width: 100%;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(8px);
        box-shadow: $auth-input-shadow;
        @include smooth-transition;

        &:focus {
          border-color: $auth-primary-start;
          box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1),
                      0 4px 12px rgba(102, 126, 234, 0.15);
          background: #fff;
          outline: none;
          transform: translateY(-1px);
        }

        &:hover {
          border-color: #cbd5e0;
          transform: translateY(-1px);
        }

        &::placeholder {
          color: #a0aec0;
          font-weight: 400;
        }
      }

      input[type="checkbox"] {
        width: auto;
        margin-right: 0.5rem;
        transform: scale(1.2);
      }

      .description {
        font-size: 0.85rem;
        color: #64748b;
        margin-top: 0.5rem;
      }
    }

    // Submit Button
    input[type="submit"] {
      @include gradient--bg($auth-primary-start, $auth-primary-end);
      border: none;
      padding: 1rem 2rem;
      color: #fff;
      border-radius: $auth-input-border-radius;
      font-weight: 700;
      width: 100%;
      font-size: 1.1rem;
      cursor: pointer;
      letter-spacing: 0.025em;
      box-shadow: $auth-button-shadow;
      @include smooth-transition;
      position: relative;
      overflow: hidden;

      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s;
      }

      &:hover {
        @include gradient--bg($auth-primary-hover-start, $auth-primary-hover-end);
        transform: translateY(-2px);
        box-shadow: $auth-button-hover-shadow;

        &::before { left: 100%; }
      }

      &:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3),
                    0 1px 3px rgba(0, 0, 0, 0.1);
      }
    }
  }

  // FOOTER LINKS
  .auth-links {
    margin-top: 2rem;
    text-align: center;

    p { margin-bottom: 0.75rem; }

    small { font-size: 0.9rem; }

    a {
      color: $auth-primary-start;
      font-weight: 500;
      position: relative;
      @include smooth-transition;

      &::after {
        content: '';
        position: absolute;
        width: 0;
        height: 2px;
        bottom: -2px;
        left: 0;
        @include gradient--bg($auth-primary-start, $auth-primary-end);
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      }

      &:hover {
        color: $auth-primary-hover-start;
        transform: translateY(-1px);

        &::after { width: 100%; }
      }
    }
  }

  // IMAGE SECTION
  .auth-image-container {
    position: relative;
    overflow: hidden;

    .auth-image { @include auth-responsive-image; }
  }

  // RESPONSIVE
  @media (max-width: 767.98px) {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;

    .card {
      width: 100%;
      max-width: $auth-mobile-max-width;
      box-shadow: $auth-card-shadow-mobile;
    }

    .brand-logo-corner .logo-image { max-height: 300px; }

    .auth-image-container {
      display: block;
      height: $auth-mobile-image-height;
      border-radius: $auth-border-radius $auth-border-radius 0 0 !important;

      .auth-image {
        border-radius: inherit;
        object-fit: cover;
        object-position: center;
        height: $auth-mobile-image-height;
      }
    }

    .auth-form-container {
      border-radius: 0 0 $auth-border-radius $auth-border-radius !important;
      padding: $auth-padding-mobile !important;
      text-align: center;
    }

    .brand-title { font-size: $auth-title-size-mobile !important; }

    .auth-form .form-item { text-align: left; }
  }

  @media (min-width: 768px) {
    .auth-image-container {
      min-height: $auth-desktop-min-height;

      .auth-image {
        border-radius: 0 $auth-border-radius $auth-border-radius 0;
        min-height: $auth-desktop-min-height;
      }
    }

    .auth-form-container {
      display: flex;
      flex-direction: column;
      justify-content: center;
      min-height: $auth-desktop-min-height;
    }
  }

  @media (min-width: 992px) {
    .auth-form-container { padding: 2rem !important; }
    .brand-title { font-size: $auth-title-size-large !important; }
  }
}

// === REGISTER SPECIFIC STYLES ===
.auth-wrapper {

  // === FORM CONTAINER - Registro ===
  .auth-form-container {
    display: flex;
    flex-direction: column;
    max-height: $auth-desktop-height;

    .brand-title,
    p,
    .auth-links {
      margin-bottom: 1.5rem;
      flex-shrink: 0;
    }

    .auth-links {
      border-top: 1px solid rgba(0, 0, 0, 0.1);
      padding-top: 1.5rem;
    }
  }

  // === FORM CONTENT ===
  .auth-form {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    margin-right: -0.5rem;

    // Scrollbar personalizada
    &::-webkit-scrollbar {
      width: $auth-scrollbar-width;
    }

    &::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.1);
      border-radius: 3px;
    }

    &::-webkit-scrollbar-thumb {
      background: linear-gradient(135deg, $auth-primary-start 0%, $auth-primary-end 100%);
      border-radius: 3px;

      &:hover {
        background: linear-gradient(135deg, $auth-primary-hover-start 0%, $auth-primary-hover-end 100%);
      }
    }
  }

  // === RESPONSIVE ===
  @media (max-width: 767.98px) {
    .card {
      margin: 2rem 0;
    }

    .auth-image-container {
      display: block;
      height: $auth-mobile-image-height;
      border-radius: $auth-border-radius $auth-border-radius 0 0;

      .auth-image {
        border-radius: inherit;
        height: $auth-mobile-image-height;
        object-fit: cover;
        object-position: center;
      }
    }

    .auth-form-container {
      max-height: none;
      display: block;
      border-radius: 0 0 $auth-border-radius $auth-border-radius;
    }

    .auth-form {
      overflow: visible;
      flex: none;
      padding-right: 0;
      margin-right: 0;
    }
  }

  @media (min-width: 768px) {
    .auth-image-container {
      min-height: $auth-desktop-height;

      .auth-image {
        min-height: $auth-desktop-height;
      }
    }

    .auth-form-container {
      height: $auth-desktop-height;
    }

    .auth-form {
      padding-right: $auth-scroll-padding-tablet;
      margin-right: -$auth-scroll-padding-tablet;
    }
  }

  @media (min-width: 992px) {
    .auth-form {
      padding-right: $auth-scroll-padding-desktop;
      margin-right: -$auth-scroll-padding-desktop;
    }
  }
}
