:root {
  --auth-tab-border: rgba(7, 22, 43, 0.12);
  --auth-muted: #5f6572;
}

body.modal-open {
  overflow: hidden;
}

.auth-modal-overlay {
  padding: var(--sp-l);
  align-items: flex-start;
}

.auth-modal {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - var(--sp-xl));
  overflow-y: auto;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(7, 22, 43, 0.25);
  border: 1px solid rgba(7, 22, 43, 0.08);
  
  /* Custom slim scrollbar - Firefox */
  scrollbar-width: thin;
  scrollbar-color: rgba(7, 22, 43, 0.2) transparent;
}

/* Custom slim scrollbar - Webkit (Chrome, Safari, Edge) */
.auth-modal::-webkit-scrollbar {
  width: 6px;
}

.auth-modal::-webkit-scrollbar-track {
  background: transparent;
  margin: 12px 0;
}

.auth-modal::-webkit-scrollbar-thumb {
  background: rgba(7, 22, 43, 0.2);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.auth-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(7, 22, 43, 0.35);
}

.auth-modal__header {
  padding: var(--sp-xl);
  border-bottom: 1px solid var(--light-grey);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-l);
}

.auth-modal__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--p-sm-size);
  color: var(--auth-muted);
  margin-bottom: var(--sp-xs);
}

.auth-modal__header h2 {
  margin: 0 0 var(--sp-xs);
  font-size: var(--h4-size);
  color: var(--dark-blue);
}

.auth-modal__header p {
  margin: 0;
  color: var(--auth-muted);
}

.auth-modal__close span {
  font-size: 32px;
  line-height: 1;
}

.auth-modal__body {
  padding: var(--sp-xl);
}

.auth-modal__tabs {
  display: flex;
  gap: var(--sp-xs);
  border: 1px solid var(--auth-tab-border);
  border-radius: var(--radius);
  padding: var(--sp-xs);
  margin-bottom: var(--sp-l);
  background-color: #f7f9fc;
}

.auth-modal__tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: var(--sp-sm) var(--sp-m);
  border-radius: calc(var(--radius) - 4px);
  font-weight: var(--font-weight-bold);
  color: var(--auth-muted);
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.auth-modal__tabs button.is-active,
.auth-modal__tabs button[aria-selected="true"] {
  background-color: var(--white);
  color: var(--dark-blue);
  box-shadow: 0 4px 10px rgba(7, 22, 43, 0.08);
}

.auth-modal__tabs button:focus-visible {
  outline: 3px solid var(--accent-1);
  outline-offset: 2px;
}

.auth-modal__feedback {
  min-height: 40px;
  margin-bottom: var(--sp-m);
  border-radius: var(--radius);
  font-weight: var(--font-weight-bold);
  padding: 0;
}

.auth-modal__feedback:not(:empty) {
  padding: var(--sp-sm) var(--sp-m);
  background-color: var(--light-blue);
  color: var(--dark-blue);
}

.auth-modal__feedback.is-error {
  background-color: #fdecea;
  color: #611a15;
}

.auth-modal__feedback.is-success {
  background-color: #e7f6ed;
  color: #1a472a;
}

.auth-modal__view {
  display: none;
}

.auth-modal__view.is-active {
  display: block;
  padding-top: 0;
  margin-top: 0;
}

.auth-modal__intro {
  color: var(--auth-muted);
  margin: 0 0 var(--sp-l);
}

.auth-modal__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-m);
}

.auth-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-m);
  margin-top: var(--sp-l);
}

.auth-modal__footer {
  margin-top: var(--sp-ml);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.auth-modal__link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--main);
  cursor: pointer;
  text-decoration: underline;
}

.auth-modal__link:focus-visible {
  outline: 3px solid var(--accent-1);
  outline-offset: 2px;
}

.auth-modal__helper {
  color: var(--auth-muted);
  margin: 0;
  font-size: var(--p-sm-size);
}

.auth-modal__meta {
  font-size: var(--p-sm-size);
  font-weight: var(--font-weight-regular);
  color: var(--auth-muted);
  margin-left: var(--sp-xs);
}

.auth-modal__actions .btn {
  flex: 1;
  min-width: 120px;
  justify-content: center;
  text-align: center;
}

@media (max-width: 768px) {
  .auth-modal-overlay {
    padding: 0;
    align-items: stretch;
  }
  
  .auth-modal {
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
  }
  
  .auth-modal__body {
    flex: 1;
    overflow-y: auto;
  }
  
  .auth-modal__header,
  .auth-modal__body {
    padding: var(--sp-l);
  }

  .auth-modal__grid {
    grid-template-columns: 1fr;
  }

  .auth-modal__tabs {
    display: none;
  }
  
  .auth-modal__actions {
    flex-direction: column;
  }
  
  .auth-modal__actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-modal,
  .auth-modal__tabs button {
    transition: none;
  }
}

