---
interface Props {
  title: string;
  description: string;
  buttonText: string;
  buttonHref: string;
  className?: string;
  dataAnimation?: string;
  dataDelay?: string | number;
}

const {
  title = 'Авторизуйтесь, чтобы продолжить',
  description = 'Для продолжения, пожалуйста, войдите в аккаунт.',
  buttonText = 'Войдите в аккаунт',
  buttonHref = '/auth/sign-in',
  className = '',
  dataAnimation = 'fade-up',
  dataDelay = 0
} = Astro.props;

const delay = typeof dataDelay === 'number' ? dataDelay : parseInt(String(dataDelay)) || 0;
---

<div 
  class={`auth-lock-card animate-on-scroll ${className}`}
  data-animation={dataAnimation}
  data-delay={delay}
>
  <div class="lock-icon-container">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lock-icon">
      <rect width="18" height="11" x="3" y="11" rx="2" ry="2"></rect>
      <path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
    </svg>
  </div>
  <h3 class="lock-title">{title}</h3>
  <p class="lock-text">{description}</p>
  <a href={buttonHref} class="auth-button">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="button-icon">
      <path d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"/>
    </svg>
    {buttonText}
  </a>
  <p class="auth-hint">
    Нет аккаунта? <a href="/auth/sign-up" class="register-link">Зарегистрироваться</a>
  </p>
</div>

<style>
  .auth-lock-card {
    max-width: 700px;
    margin: 0 auto;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem;
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  @media (min-width: 768px) {
    .auth-lock-card {
      padding: 3rem;
    }
  }

  .lock-icon-container {
    width: 5rem;
    height: 5rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(30, 64, 175, 0.3) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.15);
  }

  .lock-icon { width: 2rem; height: 2rem; }
  
  .lock-title { 
    color: #0f172a; 
    font-size: 1.375rem; 
    font-weight: 700; 
    margin: 0 0 0.75rem; 
  }
  
  .lock-text { 
    color: #475569; 
    line-height: 1.6; 
    margin: 0 0 1.75rem; 
    max-width: 420px;
  }

  .auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #2563eb, #1e40af);
    color: #ffffff;
    padding: 0.875rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
  }

  .auth-button:hover { 
    background: linear-gradient(to bottom, #1d4ed8, #1e3a8a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  }

  .button-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
  }

  .auth-hint {
    margin: 1.25rem 0 0;
    color: #64748b;
    font-size: 0.875rem;
  }

  .register-link {
    color: #2563eb;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .register-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
  }

  @media (max-width: 640px) {
    .auth-lock-card {
      padding: 2rem 1.25rem;
    }

    .lock-title {
      font-size: 1.125rem;
    }

    .lock-text {
      font-size: 0.875rem;
    }

    .auth-button {
      font-size: 0.8125rem;
      padding: 0.75rem 1rem;
    }

    .button-icon {
      width: 1rem;
      height: 1rem;
      margin-right: 0.375rem;
    }
  }
</style>
