*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(160deg, #f5eef7 0%, #e8dcee 50%, #dfd0e8 100%);
  min-height: 100vh;
  color: #1a1a1a;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Page layout */
.page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 48px;
  animation: pageIn 0.45s ease-out;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 24px;
}

.page-header__user {
  font-weight: 500;
  color: #374151;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  border: none;
  text-decoration: none;
}

.btn--full {
  width: 100%;
}

.btn--primary {
  background: #742E84;
  color: #fff;
  box-shadow: 0 2px 8px rgba(116, 46, 132, 0.25);
}

.btn--primary:hover {
  background: #5e2670;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(116, 46, 132, 0.35);
}

.btn--secondary {
  background: transparent;
  color: #742E84;
  border: 2px solid #742E84;
}

.btn--secondary:hover {
  background: rgba(116, 46, 132, 0.08);
}

.btn--ghost {
  background: transparent;
  color: #742E84;
  border: 1px solid rgba(116, 46, 132, 0.35);
  padding: 8px 16px;
  font-size: 14px;
}

.btn--ghost:hover {
  background: rgba(116, 46, 132, 0.08);
}

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

/* Hero */
.main {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(116, 46, 132, 0.08), 0 0 0 1px rgba(116, 46, 132, 0.04);
  padding: 40px 32px 48px;
  margin-bottom: 24px;
}

.hero {
  text-align: center;
  margin-bottom: 36px;
}

.hero__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1a1a1a;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero__lead {
  font-size: 1rem;
  color: #5c5f66;
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Alerts */
.alerts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.alert {
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
}

.alert--error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.alert--success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* Status (subscription active) */
.status {
  background: linear-gradient(135deg, #faf5fc 0%, #f3eaf8 100%);
  border: 1px solid rgba(116, 46, 132, 0.15);
  border-radius: 20px;
  padding: 24px 28px;
  margin-bottom: 24px;
}

.status__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.status__body {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.6;
}

.status__body p {
  margin-bottom: 6px;
}

.status__body p:last-child {
  margin-bottom: 0;
}

/* Plans section */
.plans {
  position: relative;
}

.plans__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.plans__empty {
  text-align: center;
  color: #6b7280;
  padding: 32px 24px;
  font-size: 15px;
}

/* Loading */
.plans__loading.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: #6b7280;
}

.plans__loading.loading[hidden] {
  display: none !important;
}

.loading__spinner {
  width: 44px;
  height: 44px;
  border: 3px solid #e5e7eb;
  border-top-color: #742E84;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

.loading__text {
  font-size: 15px;
  font-weight: 500;
}

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

/* Plan card */
.plan {
  background: #fafafa;
  border: 1.5px solid #e5e7eb;
  border-radius: 20px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.plan:hover {
  border-color: rgba(116, 46, 132, 0.35);
  box-shadow: 0 12px 32px rgba(116, 46, 132, 0.12);
  transform: translateY(-2px);
}

.plan--featured {
  background: linear-gradient(165deg, #fdfbff 0%, #f8f3fb 100%);
  border-color: rgba(116, 46, 132, 0.25);
  box-shadow: 0 8px 24px rgba(116, 46, 132, 0.1);
}

.plan--featured:hover {
  border-color: rgba(116, 46, 132, 0.4);
  box-shadow: 0 16px 40px rgba(116, 46, 132, 0.15);
}

.plan__name {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.plan__price {
  margin-bottom: 8px;
}

.plan__amount {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.plan__period {
  font-size: 1rem;
  color: #6b7280;
  font-weight: 500;
}

.plan__yearly {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 20px;
}

.plan__cta {
  margin-top: auto;
  padding: 14px 24px;
  font-size: 1rem;
}

/* Login modal (dialog) */
.modal {
  padding: 0;
  border: none;
  max-width: 100%;
  width: 100%;
  background: transparent;
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 1000;
}

.modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal::backdrop {
  background: rgba(26, 26, 26, 0.5);
  backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 400px;
  margin: 24px;
  padding: 32px 28px;
  border-radius: 24px;
  box-shadow: 0 24px 56px rgba(116, 46, 132, 0.2), 0 0 0 1px rgba(116, 46, 132, 0.06);
  animation: modalIn 0.3s ease-out;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

.modal__close:hover {
  background: #e5e7eb;
  color: #1f2937;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal__title {
  font-size: 1.375rem;
  font-weight: 700;
  color: #1a1a1a;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.modal__desc {
  font-size: 14px;
  color: #5c5f66;
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Login form */
.login-form {
  margin-bottom: 12px;
}

.login-form__fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  background: #f9fafb;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input:hover {
  background: #f3f4f6;
}

.input:focus {
  outline: none;
  border-color: #742E84;
  box-shadow: 0 0 0 3px rgba(116, 46, 132, 0.12);
  background: #fff;
}

.input::placeholder {
  color: #9ca3af;
}

.login-form .btn--primary {
  margin-bottom: 10px;
}

/* Social login */
.social {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.social__divider {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
}

.social__buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-btn {
  width: 100%;
  padding: 12px 20px;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.social-btn:hover {
  border-color: rgba(116, 46, 132, 0.4);
  background: rgba(116, 46, 132, 0.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(116, 46, 132, 0.1);
}

.social-btn .social-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.social-btn .social-icon svg {
  width: 100%;
  height: 100%;
}

.social-btn.google {
  color: #1a1a1a;
}

.social-btn.apple {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.social-btn.apple:hover {
  background: #333;
  border-color: #333;
}

.social-btn.facebook {
  color: #1877F2;
}

.social-btn.github {
  color: #1a1a1a;
}

/* Responsive */
@media (max-width: 640px) {
  .page {
    padding: 24px 16px 32px;
  }

  .main {
    padding: 28px 20px 36px;
    border-radius: 20px;
  }

  .hero__title {
    font-size: 1.625rem;
  }

  .hero__lead {
    font-size: 0.9375rem;
  }

  .plans__grid {
    grid-template-columns: 1fr;
  }

  .plan__amount {
    font-size: 1.75rem;
  }
}
