@import '../../utils/shared-styles.scss';

/* ===== CONTAINER ===== */

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* ===== CONTACT SECTION ===== */

.contact {
  padding-bottom: 1rem;

  @media (min-width: 960px) {
    padding-bottom: 0;
  }
}

/* ===== MOBILE SERVICE BADGE ===== */

.mobile-service-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, rgba($color-brand-primary, 0.1), rgba($color-brand-primary, 0.05));
  border: 2px solid rgba($color-brand-primary, 0.2);
  border-radius: $radius-lg;
  animation: slideDown 0.3s ease;

  @media (min-width: 960px) {
    display: none;
  }

  &__emoji {
    font-size: 1.5rem;
    flex-shrink: 0;
  }

  &__title {
    flex: 1;
    font-weight: 700;
    font-size: 0.9375rem;
    color: $color-text-primary;
  }

  &__remove {
    background: rgba(0, 0, 0, 0.08);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;

    .material-symbols-outlined {
      font-size: 20px;
      color: $color-text-secondary;
    }

    &:active {
      transform: scale(0.95);
      background: rgba(0, 0, 0, 0.15);
    }
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== GRID LAYOUT ===== */

.contact__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;

  @media (min-width: 960px) {
    grid-template-columns: 380px 1fr;
    gap: 2.5rem;
  }
}

/* ===== SIDEBAR ===== */

.contact__sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;

  @media (max-width: 959px) {
    order: 2;
  }
}

/* ===== SELECTED SERVICE CARD (Desktop) ===== */

.selected-service {
  background: linear-gradient(135deg, rgba($color-brand-primary, 0.08), rgba($color-brand-primary, 0.02));
  border: 2px solid rgba($color-brand-primary, 0.15);
  border-radius: $radius-lg;
  padding: 1.25rem;
  animation: fadeIn 0.3s ease;

  // Hide on mobile - show mobile-service-badge instead
  @media (max-width: 959px) {
    display: none;
  }

  &__header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  &__emoji {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
  }

  &__info {
    flex: 1;
    min-width: 0;
  }

  &__label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    color: $color-brand-primary;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.125rem;
  }

  &__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: $color-text-primary;
    margin: 0;
    line-height: 1.3;
  }

  &__remove {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;

    .material-symbols-outlined {
      font-size: 18px;
      color: $color-text-secondary;
    }

    &:hover {
      background: rgba(0, 0, 0, 0.1);
    }
  }

  &__desc {
    font-size: 0.875rem;
    color: $color-text-secondary;
    line-height: 1.6;
    margin: 0;
    padding-left: 2.5rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Quick Contact */
.quick-contact {
  h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: $color-text-primary;
    margin-bottom: 1rem;
  }

  .quick__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .quick__card {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: $glass-bg;
    backdrop-filter: blur(10px);
    border: 1px solid $glass-border;
    border-radius: $radius-lg;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: $shadow-md;

    &:hover {
      transform: translateY(-2px);
      box-shadow: $shadow-glass-hover;
      border-color: $color-brand-primary;
    }

    .quick__icon {
      width: 48px;
      height: 48px;
      flex-shrink: 0;
      background: $gradient-primary;
      border-radius: $radius-md;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      box-shadow: $shadow-brand;

      .material-symbols-outlined {
        font-size: 24px;
      }
    }

    .quick__content {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      flex: 1;

      .quick__title {
        font-weight: 700;
        font-size: 1rem;
        color: $color-text-primary;
      }

      .quick__value {
        font-weight: 600;
        font-size: 0.9375rem;
        color: $color-brand-primary;
      }

      .quick__meta {
        font-size: 0.875rem;
        color: $color-text-secondary;
      }
    }
  }
}

/* Info Card */
.info-card {
  background: $gradient-subtle;
  border: 1px solid $color-gray-200;
  border-radius: $radius-lg;
  padding: 1.5rem;

  .info-card__icon {
    width: 40px;
    height: 40px;
    background: $color-brand-primary;
    border-radius: $radius-md;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 1rem;

    .material-symbols-outlined {
      font-size: 24px;
    }
  }

  h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: $color-text-primary;
    margin-bottom: 1rem;
  }

  .info-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;

    li {
      display: flex;
      align-items: flex-start;
      gap: 0.5rem;
      font-size: 0.9375rem;
      color: $color-text-secondary;
      line-height: 1.5;

      .material-symbols-outlined {
        color: $color-success;
        font-size: 20px;
        flex-shrink: 0;
        margin-top: 0.125rem;
      }
    }
  }
}

/* Trust Badge */
.trust-badge {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: $color-white;
  border: 2px solid $color-success;
  border-radius: $radius-md;
  align-items: center;

  .material-symbols-outlined {
    font-size: 32px;
    color: $color-success;
    flex-shrink: 0;
  }

  strong {
    display: block;
    font-weight: 700;
    color: $color-text-primary;
    margin-bottom: 0.125rem;
  }

  p {
    margin: 0;
    font-size: 0.875rem;
    color: $color-text-secondary;
    line-height: 1.4;
  }
}

/* ===== MAIN CONTENT ===== */

.contact__main {
  @media (max-width: 959px) {
    order: 1;
  }
}

/* ===== SUCCESS CARD ===== */

.success-card {
  background: $glass-bg;
  backdrop-filter: blur(20px);
  border: 1px solid $glass-border;
  border-radius: $radius-xl;
  padding: 2rem;
  text-align: center;
  box-shadow: $shadow-glass;
  animation: scaleIn 0.4s ease;

  @media (min-width: 768px) {
    padding: 2.5rem;
  }

  .success-icon {
    width: 72px;
    height: 72px;
    background: $gradient-primary;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    box-shadow: $shadow-brand;
    animation: bounce 0.6s ease 0.2s;

    @media (min-width: 768px) {
      width: 80px;
      height: 80px;
      margin-bottom: 1.5rem;
    }

    .material-symbols-outlined {
      font-size: 40px;
      color: white;

      @media (min-width: 768px) {
        font-size: 48px;
      }
    }
  }

  h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: $color-text-primary;
    margin-bottom: 0.5rem;

    @media (min-width: 768px) {
      font-size: 1.75rem;
      margin-bottom: 0.75rem;
    }
  }

  p {
    font-size: 1rem;
    color: $color-text-secondary;
    margin-bottom: 1.5rem;

    @media (min-width: 768px) {
      font-size: 1.0625rem;
    }
  }

  .success-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;

    @media (min-width: 480px) {
      flex-direction: row;
    }

    .btn {
      width: 100%;

      @media (min-width: 480px) {
        width: auto;
      }
    }
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* ===== FORM ===== */

.contact__form {
  background: $glass-bg;
  backdrop-filter: blur(20px);
  border: 1px solid $glass-border;
  border-radius: $radius-xl;
  padding: 1.5rem;
  box-shadow: $shadow-glass;
  transition: opacity 0.3s ease;

  @media (min-width: 768px) {
    padding: 2.5rem;
  }

  &.is-loading {
    pointer-events: none;
    opacity: 0.7;
  }

  .form-header {
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;

    @media (min-width: 768px) {
      margin-bottom: 1.75rem;
    }

    h2 {
      font-size: 1.5rem;
      font-weight: 800;
      color: $color-text-primary;
      margin-bottom: 0.375rem;

      @media (min-width: 768px) {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
      }
    }

    .form-subtitle {
      font-size: 0.9375rem;
      color: $color-text-secondary;
      margin: 0;

      @media (min-width: 768px) {
        font-size: 1rem;
      }

      strong {
        color: $color-brand-primary;
      }
    }
  }
}

/* ===== FORM FIELDS ===== */

.field {
  margin-bottom: 1rem;

  &:last-of-type {
    margin-bottom: 0;
  }

  label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: $color-text-primary;
    margin-bottom: 0.5rem;

    .required {
      color: $color-error;
      margin-left: 0.125rem;
    }

    .label-hint {
      font-weight: 400;
      color: $color-text-tertiary;
      font-size: 0.8125rem;
    }
  }

  .input-wrapper {
    position: relative;

    .input-icon {
      position: absolute;
      left: 1rem;
      top: 50%;
      transform: translateY(-50%);
      color: $color-text-secondary;
      font-size: 20px;
      pointer-events: none;
      transition: color 0.2s ease;
    }

    .input-check {
      position: absolute;
      right: 1rem;
      top: 50%;
      transform: translateY(-50%);
      color: $color-success;
      font-size: 20px;
      pointer-events: none;
      animation: popIn 0.3s ease;
    }

    input,
    select,
    textarea {
      width: 100%;
      padding: 1rem;
      padding-left: 3rem;
      border: 2px solid $color-gray-200;
      border-radius: $radius-md;
      font-size: 1rem; // 16px prevents zoom on iOS
      font-family: inherit;
      color: $color-text-primary;
      background: $color-white;
      transition: all 0.3s ease;
      -webkit-appearance: none;

      &::placeholder {
        color: $color-gray-400;
      }

      &:hover:not(:disabled) {
        border-color: $color-gray-300;
      }

      &:focus {
        outline: none;
        border-color: $color-brand-primary;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);

        &+.input-icon,
        &~.input-icon {
          color: $color-brand-primary;
        }
      }

      &:disabled {
        background: $color-gray-100;
        color: $color-text-tertiary;
        cursor: not-allowed;
      }
    }

    textarea {
      padding: 1rem;
      min-height: 100px;
      resize: vertical;
      line-height: 1.6;

      @media (min-width: 768px) {
        min-height: 120px;
      }
    }

    select {
      cursor: pointer;
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
      background-position: right 1rem center;
      background-repeat: no-repeat;
      background-size: 1.25rem;
      padding-right: 3rem;
    }
  }

  &.has-error {
    .input-wrapper {

      input,
      select,
      textarea {
        border-color: $color-error;
        animation: shake 0.4s ease;
      }
    }
  }

  &.has-value {
    .input-wrapper {

      input:not(:focus),
      textarea:not(:focus) {
        border-color: $color-success;
      }

      .input-icon {
        color: $color-success;
      }
    }
  }

  .field-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.375rem;
  }

  .char-counter {
    font-size: 0.75rem;
    color: $color-text-tertiary;
    transition: color 0.2s ease;

    &.near-limit {
      color: $color-warning;
      font-weight: 600;
    }
  }

  .error-message {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: $color-error;
    font-weight: 500;
    animation: slideDown 0.2s ease;

    .material-symbols-outlined {
      font-size: 16px;
    }
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-50%) scale(0.5);
  }

  to {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

/* Field Phone Animation */
.field--phone {
  animation: slideDown 0.3s ease;
}

/* Checkbox Field */
.field--checkbox {
  margin-top: 0.5rem;

  .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 1rem;
    background: $color-gray-50;
    border: 2px solid $color-gray-200;
    border-radius: $radius-md;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;

    &:hover {
      border-color: $color-brand-primary;
      background: rgba(37, 99, 235, 0.04);
    }

    &:active {
      transform: scale(0.99);
    }

    input[type="checkbox"] {
      position: absolute;
      opacity: 0;
      pointer-events: none;

      &:checked+.checkbox-custom {
        background: $gradient-primary;
        border-color: $color-brand-primary;

        &::after {
          opacity: 1;
          transform: scale(1);
        }
      }

      &:focus-visible+.checkbox-custom {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
      }
    }

    .checkbox-custom {
      width: 26px;
      height: 26px;
      min-width: 26px;
      border: 2px solid $color-gray-300;
      border-radius: 6px;
      background: $color-white;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s ease;
      position: relative;

      &::after {
        content: '✓';
        color: white;
        font-weight: 700;
        font-size: 14px;
        opacity: 0;
        transform: scale(0.5);
        transition: all 0.2s ease;
      }
    }

    .checkbox-text {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.9375rem;
      font-weight: 500;
      color: $color-text-primary;

      .material-symbols-outlined {
        font-size: 20px;
        color: $color-text-secondary;
      }
    }
  }
}

/* ===== FORM ACTIONS ===== */

.form-actions {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;

  @media (min-width: 768px) {
    margin-top: 2rem;
  }

  .btn--submit {
    width: 100%;
    min-height: 52px;

    @media (min-width: 640px) {
      width: auto;
      min-width: 220px;
    }
  }

  .btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
  }

  .form-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: $color-text-secondary;

    @media (min-width: 640px) {
      justify-content: flex-start;
    }

    .material-symbols-outlined {
      font-size: 18px;
      color: $color-brand-primary;
    }
  }
}

/* Loading State */
.loading-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== PRIVACY NOTICE ===== */

.privacy-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1rem;
  background: $color-gray-50;
  border-radius: $radius-md;
  font-size: 0.875rem;
  line-height: 1.6;
  color: $color-text-secondary;
  margin-top: 1.5rem;

  .material-symbols-outlined {
    font-size: 18px;
    color: $color-text-secondary;
    flex-shrink: 0;
    margin-top: 0.125rem;
  }

  a {
    color: $color-brand-primary;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;

    &:hover {
      text-decoration: underline;
    }
  }
}

/* ===== ALERT ===== */

.alert {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: $radius-md;
  margin-top: 1.5rem;

  .material-symbols-outlined {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 0.125rem;
  }

  strong {
    display: block;
    margin-bottom: 0.25rem;
  }

  p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
  }

  &--error {
    background: $color-error-light;
    border: 1px solid darken($color-error-light, 10%);
    color: darken($color-error, 10%);

    .material-symbols-outlined {
      color: $color-error;
    }
  }
}

/* ===== MOTION PREFERENCES ===== */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== MOBILE STICKY SUBMIT ===== */

.mobile-sticky-submit {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-top: 1px solid $color-gray-200;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  animation: slideUp 0.3s ease;

  @media (min-width: 768px) {
    display: none;
  }

  .btn--full {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
    font-weight: 700;
  }

  .btn-content,
  .loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== GHOST BUTTON ===== */

.btn--ghost {
  background: transparent;
  border: 2px solid $color-gray-200;
  color: $color-text-primary;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: $radius-md;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    border-color: $color-gray-300;
    background: $color-gray-50;
  }

  .material-symbols-outlined {
    font-size: 20px;
  }
}