/* BioStudio AI — authentication gate */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: linear-gradient(145deg, #0a1628 0%, #1a2d4a 40%, #0d2137 100%);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  transition: opacity 0.4s ease;
}

.auth-gate.fade-out {
  opacity: 0;
  pointer-events: none;
}

.auth-gate-loading {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(78, 139, 255, 0.18), transparent 34%),
    radial-gradient(circle at 15% 18%, rgba(55, 214, 180, 0.1), transparent 28%),
    linear-gradient(145deg, #071524 0%, #102944 48%, #091c30 100%);
}

.auth-gate-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.32;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(129, 175, 223, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 175, 223, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
}

.auth-loading-card {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 40px));
  box-sizing: border-box;
  padding: 42px 44px 34px;
  border: 1px solid rgba(163, 201, 238, 0.16);
  border-radius: 28px;
  background: rgba(6, 20, 35, 0.58);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: #f4f8fc;
  text-align: center;
}

.auth-loading-visual {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 26px;
}

.auth-loading-core {
  position: absolute;
  inset: 41px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(125, 204, 255, 0.28);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(43, 120, 210, 0.34), rgba(31, 211, 177, 0.14));
  box-shadow: 0 0 46px rgba(55, 164, 255, 0.2), inset 0 0 24px rgba(255, 255, 255, 0.05);
  transform: rotate(45deg);
  animation: auth-core-breathe 2.8s ease-in-out infinite;
}

.auth-loading-core-mark {
  font-size: 33px;
  filter: drop-shadow(0 4px 12px rgba(2, 13, 24, 0.4));
  transform: rotate(-45deg);
}

.auth-loading-orbit {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(120, 190, 255, 0.18);
  border-radius: 50%;
  animation: auth-orbit-spin 8s linear infinite;
}

.auth-loading-orbit-two {
  inset: 28px;
  border-color: rgba(63, 223, 185, 0.2);
  animation-duration: 5.5s;
  animation-direction: reverse;
}

.auth-loading-orbit span {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #72c4ff;
  box-shadow: 0 0 16px rgba(114, 196, 255, 0.8);
}

.auth-loading-orbit span:nth-child(1) { top: -5px; left: calc(50% - 5px); }
.auth-loading-orbit span:nth-child(2) { right: 8px; bottom: 20px; background: #55dfbd; }
.auth-loading-orbit span:nth-child(3) { left: 4px; bottom: 30px; width: 6px; height: 6px; }
.auth-loading-orbit-two span:nth-child(2) { left: 5px; top: 50%; }

.auth-loading-eyebrow {
  margin: 0 0 9px;
  color: #7fd5ff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.auth-loading-card h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.15rem);
  font-weight: 650;
  letter-spacing: -0.035em;
}

.auth-loading-message {
  min-height: 24px;
  margin: 15px 0 20px;
  color: rgba(229, 240, 250, 0.72);
  font-size: 0.96rem;
}

.auth-loading-track {
  position: relative;
  height: 4px;
  margin: 0 auto 22px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(173, 207, 237, 0.11);
}

.auth-loading-track span {
  position: absolute;
  inset-block: 0;
  left: -42%;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #4ca9ff 34%, #4de0bc 70%, transparent);
  animation: auth-loading-track 2.2s ease-in-out infinite;
}

.auth-loading-note {
  max-width: 430px;
  margin: 0 auto;
  color: rgba(205, 222, 237, 0.52);
  font-size: 0.78rem;
  line-height: 1.6;
}

.auth-loading-steps {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 22px;
}

.auth-loading-steps span {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: rgba(179, 211, 239, 0.18);
  transition: width 0.35s ease, background 0.35s ease;
}

.auth-loading-steps span.active {
  width: 22px;
  background: linear-gradient(90deg, #4ba9ff, #50dfbd);
}

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

@keyframes auth-core-breathe {
  0%, 100% { transform: rotate(45deg) scale(0.96); }
  50% { transform: rotate(45deg) scale(1.04); }
}

@keyframes auth-loading-track {
  0% { left: -42%; }
  65%, 100% { left: 100%; }
}

@media (max-width: 600px) {
  .auth-loading-card {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    width: calc(100vw - 28px);
    padding: 32px 24px 28px;
    border-radius: 22px;
  }

  .auth-loading-visual {
    width: 128px;
    height: 128px;
    margin-bottom: 20px;
  }

  .auth-loading-core { inset: 36px; }
  .auth-loading-orbit { inset: 10px; }
  .auth-loading-orbit-two { inset: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-loading-core,
  .auth-loading-orbit,
  .auth-loading-track span {
    animation: none;
  }

  .auth-loading-track span {
    left: 29%;
  }
}

.auth-card {
  width: min(420px, 92vw);
  padding: 2.5rem 2rem 2rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  color: #e8edf5;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-tagline {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.55);
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 0.55rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tab.active {
  background: rgba(47, 107, 255, 0.35);
  color: #fff;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.35rem;
}

.auth-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.auth-field input:focus {
  border-color: #2f6bff;
}

.auth-error {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: rgba(220, 53, 69, 0.2);
  color: #ff8a95;
  font-size: 0.85rem;
}

.auth-info {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: rgba(47, 107, 255, 0.15);
  color: #8ab4ff;
  font-size: 0.85rem;
}

.auth-server-warn {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(220, 53, 69, 0.18);
  border: 1px solid rgba(255, 138, 149, 0.35);
  color: #ffc9cf;
  font-size: 0.85rem;
  line-height: 1.5;
}

.auth-server-warn strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #ff8a95;
}

.auth-server-warn p {
  margin: 0 0 0.5rem;
}

.auth-server-warn ol {
  margin: 0 0 0.75rem 1.1rem;
  padding: 0;
}

.auth-server-warn li {
  margin-bottom: 0.25rem;
}

.auth-server-warn code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.9em;
}

.auth-server-link {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  background: #2f6bff;
  color: #fff !important;
  font-weight: 600;
  text-decoration: none;
}

.auth-server-link:hover {
  background: #2558d4;
}

.auth-submit {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: #2f6bff;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.auth-submit:hover:not(:disabled) {
  background: #2558d4;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-forgot {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.5rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

.auth-forgot:hover {
  color: rgba(255, 255, 255, 0.7);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.25rem 0 1rem;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.auth-guest-btn {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #e8edf5;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.auth-guest-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
}

.auth-guest-note {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.auth-setup-msg {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
}

.auth-setup-msg code {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.85em;
}

/* Sync status indicator in taskbar */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: default;
  color: rgba(255, 255, 255, 0.7);
}

.sync-status.synced { color: #4ade80; }
.sync-status.syncing { color: #fbbf24; }
.sync-status.offline { color: rgba(255, 255, 255, 0.45); }
.sync-status.error { color: #f87171; }
