@use '../globals';
@use '../variables' as *;

.contact-section {
  background: var(--contact-background);

  &__container {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1rem;

    @include globals.desktop-only {
      padding: 0 1.5rem;
    }
  }

  &__header {
    text-align: center;
    margin-bottom: 4rem;
  }

  &__title {
    font-size: 1.875rem;
    font-weight: bold;
    margin-bottom: 1rem;
    background: var(--gradient-contact-title);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;

    @include globals.desktop-only {
      font-size: 2.25rem;
    }
  }

  &__subtitle {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    max-width: 48rem;
    margin: 0 auto;
  }

  &__grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      'connect'
      'sidebar'
      'social';
    gap: 3rem;
    align-items: start;

    @include globals.desktop-only {
      grid-template-columns: 2fr 1fr;
      grid-template-areas:
        'connect sidebar'
        'social .';
      gap: 4rem;
      align-items: stretch;
    }
  }

  // Connect Card
  &__connect-card {
    grid-area: connect;
    background: var(--form-background);
    border-radius: var(--card-border-radius);
    padding: var(--card-padding);
    transition: var(--transition-default);
    display: flex;
    flex-direction: column;
  }

  &__connect-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: flex-start;
  }

  &__connect-text {
    flex: 1;
  }

  &__email-icon {
    width: 2rem;
    height: 2rem;
    color: var(--primary-color);
    background: rgba(147, 51, 234, 0.1);
    border-radius: 0.75rem;
    padding: 0.5rem;
    flex-shrink: 0;
  }

  &__email-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.75rem;
    background: var(--gradient-contact-title);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }

  &__email-description {
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
  }

  // Social Card - positioned below connect card
  &__social-card {
    grid-area: social;
    background: var(--form-background);
    border: 1px solid var(--form-border);
    border-radius: var(--card-border-radius);
    padding: var(--card-padding);
  }

  &__social-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text);
    margin-bottom: var(--card-padding-sm);
  }

  &__social-list {
    display: flex;
    flex-direction: column;
    gap: var(--card-gap-sm);
  }

  // Sidebar
  &__sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  &__info-card {
    background: var(--form-background);
    border: 1px solid var(--form-border);
    border-radius: var(--card-border-radius);
    padding: var(--card-padding);
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  &__availability {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--card-padding);
    padding: var(--card-gap-sm);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 0.75rem;
  }

  &__status-indicator {
    width: 0.75rem;
    height: 0.75rem;
    background: #22c55e;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 2s infinite;
  }

  @keyframes pulse {
    0% {
      opacity: 1;
    }
    50% {
      opacity: 0.5;
    }
    100% {
      opacity: 1;
    }
  }

  &__status-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #22c55e;
  }

  &__quick-facts {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  &__fact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  &__fact-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  &__fact-value {
    font-size: 0.875rem;
    color: var(--color-text);
    font-weight: 500;
  }

  // Contact Info Section
  &__info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  &__connect-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1.5rem;
  }

  &__connect-description {
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
  }

  &__details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  &__detail-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  &__detail-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-contact-primary);
    flex-shrink: 0;
  }

  &__detail-text {
    color: var(--color-text);
    font-size: 0.875rem;
  }

  &__social {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
  }

  &__social-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--contact-social-border);
    border-radius: 0.375rem;
    background: var(--contact-social-bg);
    color: var(--contact-social-text);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;

    &:hover {
      background: var(--contact-social-hover-bg);
      border-color: var(--contact-social-hover-border);
      transform: translateY(-1px);
    }

    // Brand-specific icon colors with better contrast
    &--email .contact-section__social-icon {
      color: #2563eb; // Stronger blue for email
    }

    &--github .contact-section__social-icon {
      color: #1f2937; // Darker for GitHub
    }

    &--linkedin .contact-section__social-icon {
      color: #0d67b5; // Stronger LinkedIn blue
    }
  }

  &__social-icon {
    width: 1rem;
    height: 1rem;
  }

  // Contact Form Section
  &__form-card {
    background: var(--contact-form-bg);
    border: 1px solid var(--contact-form-border);
    border-radius: 1rem;
    box-shadow: var(--contact-form-shadow);
    overflow: hidden;
  }

  &__form-header {
    padding: 1.5rem 1.5rem 0;
    margin-bottom: 1.5rem;
  }

  &__form-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
  }

  &__form-description {
    color: var(--color-text-muted);
    font-size: 0.875rem;
  }

  // Status Message Styles
  &__status {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;

    &--success {
      background-color: var(--contact-status-success-bg);
      border: 1px solid var(--contact-status-success-border);
      color: var(--contact-status-success-text);
    }

    &--error {
      background-color: var(--contact-status-error-bg);
      border: 1px solid var(--contact-status-error-border);
      color: var(--contact-status-error-text);
    }
  }

  &__status-message {
    margin: 0;
    line-height: 1.4;
  }

  &__form {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  // Honeypot field - hidden from users but visible to bots
  &__honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
  }

  &__honeypot-label,
  &__honeypot-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
  }

  &__form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;

    @include globals.mobile-only {
      grid-template-columns: 1fr 1fr;
    }
  }

  &__form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  &__form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
  }

  &__form-input,
  &__form-textarea {
    padding: 0.75rem;
    border: 1px solid var(--contact-input-border);
    border-radius: 0.375rem;
    background: var(--contact-input-bg);
    color: var(--color-text);
    font-size: 0.875rem;
    transition: all 0.2s ease;

    &::placeholder {
      color: var(--color-text-muted);
    }

    &:focus {
      outline: none;
      border-color: var(--color-contact-primary);
      box-shadow: 0 0 0 3px var(--contact-input-focus-ring);
    }
  }

  &__form-textarea {
    resize: vertical;
    min-height: 5rem;
    font-family: inherit;
  }

  &__form-button {
    background: var(--contact-button-bg);
    color: var(--contact-button-text);
    border: none;
    border-radius: 0.375rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;

    &:hover:not(:disabled) {
      background: var(--contact-button-hover-bg);
      transform: translateY(-1px);
    }

    &:active:not(:disabled) {
      transform: translateY(0);
    }

    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
    }
  }

  // Responsive adjustments
  @include globals.mobile-only {
    &__grid {
      gap: 2rem;
    }

    &__form-card,
    &__email-card {
      border-radius: 0.75rem;
    }

    &__form-header,
    &__form,
    &__email-header {
      padding-left: 1rem;
      padding-right: 1rem;
    }

    &__social {
      justify-content: center;
      margin-top: 1.5rem;
    }
  }

  // Email Button Card Styles
  &__email-card {
    background: var(--form-background);
    border-radius: 1rem;
    border: 1px solid var(--form-border);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
      0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;

    &:hover {
      box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
      transform: translateY(-2px);
    }
  }

  &__email-header {
    margin-bottom: 2rem;
    padding: 0;
  }

  &__email-icon {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
    margin: 0 auto 1rem;
    display: block;
  }

  &__email-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
  }

  &__email-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
  }

  &__email-button {
    background: var(--contact-button-bg);
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: var(--card-padding-sm) 0;
    text-decoration: none;
    color: var(--contact-button-text);
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.25),
      0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    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 ease;
    }

    &:hover {
      background: var(--contact-button-hover-bg);
      transform: translateY(-2px);
      box-shadow: 0 8px 25px 0 rgba(37, 99, 235, 0.35),
        0 4px 6px -2px rgba(0, 0, 0, 0.1);

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

    &:active {
      transform: translateY(-1px);
    }
  }

  &__button-text {
    color: var(--contact-button-text);
    font-weight: 600;
    font-size: 1.1rem;
  }

  &__button-icon {
    color: var(--contact-button-text);
    width: 1.25rem;
    height: 1.25rem;
  }

  &__email-info {
    margin-top: 1.5rem;
  }

  &__email-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;

    strong {
      color: var(--primary-color);
      font-weight: 600;
    }
  }
}

// Mobile responsive adjustments
@include globals.mobile-only {
  .contact-section {
    &__grid {
      gap: 2rem;
    }

    &__connect-card {
      margin-bottom: 0.5rem;
    }

    &__social-card {
      margin-top: 0.5rem;
    }

    &__email-button {
      padding: 0.875rem 1.5rem;
      font-size: 1rem;
    }

    &__email-icon {
      width: 1.5rem;
      height: 1.5rem;
      padding: 0.375rem;
    }

    &__email-title {
      font-size: 1.25rem;
    }

    &__connect-header {
      margin-bottom: 1.5rem;
    }

    &__email-description {
      margin-bottom: 1.5rem;
    }
  }
}
