/* Craftella Authentication & Login Gate Styles */

/* Lock body scroll when unauthenticated */
body.auth-locked {
  overflow: hidden !important;
  height: 100vh !important;
}

/* Fullscreen Auth Gate */
#craftella-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

#craftella-auth-gate.auth-gate-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Auth Card */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid #e8dec9;
  border-radius: 28px;
  padding: 44px 36px 36px;
  box-shadow: 0 20px 48px -12px rgba(32, 61, 121, 0.18), 0 8px 18px -6px rgba(0, 0, 0, 0.08);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: authCardEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-card-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e8dec9;
  background: #fdfaf6;
  color: #555;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.auth-card-close:hover {
  background: #f0e6d2;
  color: #1a1a1a;
  transform: scale(1.08);
}

@keyframes authCardEnter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #203d79, #e06c4b, #203d79);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  text-decoration: none;
}

.auth-brand img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(32, 61, 121, 0.15);
}

.auth-brand-name {
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #203d79;
}

.auth-brand-name .brand-star {
  color: #e06c4b;
  margin-left: 2px;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.25;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 15px;
  color: #555555;
  line-height: 1.55;
  margin: 0 0 26px;
}

/* Official Google Sign-In Button */
.btn-google-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  padding: 0 20px;
  background-color: #ffffff;
  color: #1f1f1f;
  border: 1px solid #747775;
  border-radius: 25px;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  text-decoration: none;
  position: relative;
}

.btn-google-signin:hover {
  background-color: #f8fafd;
  border-color: #5f6368;
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.2);
}

.btn-google-signin:active {
  background-color: #f1f3f4;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.2);
}

.btn-google-signin:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.google-icon-svg {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  flex-shrink: 0;
}

/* Auth features / perks */
.auth-perks {
  margin: 24px 0 20px;
  padding: 16px;
  background: #fdfaf6;
  border-radius: 16px;
  border: 1px dashed #e8dec9;
  text-align: left;
}

.auth-perks-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #203d79;
  margin-bottom: 8px;
  display: block;
}

.auth-perk-item {
  font-size: 13px;
  color: #555555;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.auth-perk-item:last-child {
  margin-bottom: 0;
}

.auth-perk-item svg {
  width: 14px;
  height: 14px;
  color: #2a7e43;
  flex-shrink: 0;
}

/* Auth Setup Banner & Guest Preview */
.auth-setup-notice {
  margin-top: 20px;
  padding: 14px 16px;
  background: #fff8eb;
  border: 1px solid #ffd899;
  border-radius: 14px;
  font-size: 13px;
  color: #8c5300;
  text-align: left;
  line-height: 1.45;
}

.auth-setup-notice strong {
  display: block;
  font-size: 13px;
  color: #6d4100;
  margin-bottom: 4px;
}

.auth-setup-notice code {
  background: #ffecce;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

.btn-guest-bypass {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
  background: #203d79;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-guest-bypass:hover {
  opacity: 0.9;
}

.auth-footer-note {
  margin-top: 20px;
  font-size: 12px;
  color: #888888;
  line-height: 1.4;
}

.auth-footer-note a {
  color: #203d79;
  text-decoration: underline;
}

/* Header User Profile Pill */
.header-user-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: rgba(32, 61, 121, 0.06);
  border: 1px solid rgba(32, 61, 121, 0.12);
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  color: #203d79;
  transition: all 0.2s ease;
}

.header-user-profile:hover {
  background: rgba(32, 61, 121, 0.1);
}

.header-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #203d79;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.header-user-name {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-btn-logout {
  background: transparent;
  border: none;
  color: #993333;
  padding: 2px 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s ease;
  margin-left: 2px;
}

.header-btn-logout:hover {
  color: #cc0000;
  text-decoration: underline;
}

@media (max-width: 600px) {
  .auth-card {
    padding: 32px 24px 28px;
  }
  .auth-title {
    font-size: 22px;
  }
  .header-user-name {
    display: none;
  }
  .header-user-profile {
    padding: 3px 6px 3px 3px;
  }
}


/* Phone Sign-In Section */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0 14px;
  color: #8c97aa;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e6dfd1;
}

.auth-divider span {
  padding: 0 10px;
}

.auth-method-tabs {
  display: flex;
  background: #f7f1e6;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 12px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab-btn.active {
  background: #ffffff;
  color: #203d79;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.auth-phone-section {
  margin-bottom: 16px;
  text-align: left;
}

.auth-phone-input-row,
.auth-otp-row {
  display: flex;
  align-items: center;
  position: relative;
  gap: 8px;
}

.auth-phone-prefix {
  position: absolute;
  left: 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: #555;
  pointer-events: none;
  z-index: 2;
}

.auth-phone-input {
  flex: 1;
  padding: 10px 14px 10px 44px;
  border: 1px solid #d4c8b0;
  border-radius: 12px;
  font-size: 13.5px;
  color: #1a1a1a;
  background: #ffffff;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

.auth-phone-input:focus {
  border-color: #203d79;
  box-shadow: 0 0 0 3px rgba(32, 61, 121, 0.1);
}

.auth-otp-input {
  padding-left: 14px !important;
  letter-spacing: 3px;
  font-weight: 700;
  text-align: center;
}

.btn-auth-phone-action {
  background: #203d79;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-auth-phone-action:hover {
  background: #172d59;
}

.btn-auth-phone-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-auth-link {
  background: transparent;
  border: none;
  color: #666;
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

.auth-phone-msg {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 600;
}

.auth-phone-msg.error {
  color: #b91c1c;
}

.auth-phone-msg.success {
  color: #15803d;
}

/* Name Selection Step after Phone Verification */
.auth-name-section {
  animation: authCardEnter 0.25s ease-out both;
}

.btn-auth-skip-name {
  background: #f4efe6;
  border: 1px solid #dcd4c3;
  color: #5c4e3c;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-auth-skip-name:hover {
  background: #eae2d3;
  color: #3f2713;
  border-color: #cbbfab;
}

/* Ensure Google reCAPTCHA challenge modal & overlays sit on top of auth modal */
iframe[src*="recaptcha/api2/bframe"],
iframe[src*="recaptcha/enterprise/bframe"],
div:has(> iframe[src*="recaptcha/api2/bframe"]),
div:has(> iframe[src*="recaptcha/enterprise/bframe"]),
div:has(> div > iframe[src*="recaptcha/api2/bframe"]),
div:has(> div > iframe[src*="recaptcha/enterprise/bframe"]),
body > div[style*="2000000000"] {
  z-index: 2147483647 !important;
}
