/* ============================================================
   PEGADROM - Unified Auth Modal Styles
   Professional Flat Aesthetic & Pegadrom Brand Palette
   ============================================================ */

.pgd-auth-modal[hidden],
.pgd-ak-modal[hidden] {
  display: none !important;
}

.pgd-auth-modal,
.pgd-ak-modal {
  --pga-gold: #e8a020;
  --pga-gold-hover: #dc9215;
  --pga-gold-active: #c8810b;
  --pga-gold-edge: #d38d0f;
  --pga-gold-dark: #a05e03;
  --pga-gold-soft: #fbecc9;
  --pga-gold-bg: #fff7e3;
  --pga-card: #ffffff;
  --pga-tint: #faf6ef;
  --pga-line: #dccfbb;
  --pga-line-2: #cfbc97;
  --pga-ink: #1f1912;
  --pga-text: #352517;
  --pga-muted: #6d5a43;
  --pga-muted-light: #85725c;
  --pga-focus: rgba(232, 160, 32, 0.22);

  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.pgd-auth-modal.is-visible,
.pgd-ak-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.pgd-auth-modal__backdrop,
.pgd-ak-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 12, 6, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  cursor: pointer;
}

.pgd-auth-modal__dialog,
.pgd-ak-modal__dialog {
  position: relative;
  width: min(430px, 100%);
  max-width: 430px;
  background: #ffffff;
  border: 1px solid var(--pga-line);
  border-radius: 16px;
  padding: 22px 22px 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
  text-align: center;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  z-index: 1;
}

.pgd-auth-modal.is-visible .pgd-auth-modal__dialog,
.pgd-ak-modal.is-visible .pgd-ak-modal__dialog {
  transform: translateY(0) scale(1);
}

/* Close button: Placed on the top-right corner outside the form so it never covers tab buttons */
.pgd-auth-modal__close,
.pgd-ak-modal__close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--pga-line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--pga-muted);
  display: grid;
  place-items: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  padding: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.pgd-auth-modal__close:hover,
.pgd-ak-modal__close:hover {
  background: #faf6ee;
  color: var(--pga-ink);
  border-color: var(--pga-line-2);
  transform: scale(1.05);
}

/* Google Button - Clean flat style */
.pgd-auth-modal__google-btn,
.pgd-ak-modal__google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--pga-line);
  color: var(--pga-ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
  margin-bottom: 14px;
}

.pgd-auth-modal__google-btn:hover,
.pgd-ak-modal__google-btn:hover {
  background: #faf6ee;
  border-color: var(--pga-line-2);
}

.pgd-auth-modal__google-btn svg,
.pgd-ak-modal__google-btn svg {
  flex-shrink: 0;
}

/* Divider */
.pgd-auth-modal__divider,
.pgd-ak-modal__divider {
  position: relative;
  text-align: center;
  margin: 14px 0 14px;
}

.pgd-auth-modal__divider:before,
.pgd-ak-modal__divider:before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--pga-line);
}

.pgd-auth-modal__divider span,
.pgd-ak-modal__divider span {
  position: relative;
  background: #ffffff;
  padding: 0 12px;
  color: var(--pga-muted);
  font-size: 12px;
  font-weight: 500;
}

/* Segmented Tabs - Professional flat container */
.pgd-auth-modal__tabs,
.pgd-ak-modal__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  background: #f5efe4;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 16px;
}

.pgd-auth-modal__tab,
.pgd-ak-modal__tab {
  border: none;
  background: transparent;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--pga-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.pgd-auth-modal__tab:hover,
.pgd-ak-modal__tab:hover {
  color: var(--pga-ink);
}

.pgd-auth-modal__tab.is-active,
.pgd-ak-modal__tab.is-active {
  background: #ffffff;
  color: var(--pga-ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Forms */
.pgd-auth-modal__form,
.pgd-ak-modal__form {
  display: flex;
  flex-direction: column;
  gap: 11px;
  text-align: left;
}

.pgd-auth-modal__field-row,
.pgd-ak-modal__field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pgd-auth-modal__input,
.pgd-ak-modal__input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--pga-line);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--pga-ink);
  background: #fffdfa;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pgd-auth-modal__input:focus,
.pgd-ak-modal__input:focus {
  background: #ffffff;
  border-color: var(--pga-gold);
  box-shadow: 0 0 0 3px var(--pga-focus);
}

/* Prevent Chrome autofill from turning inputs blue */
.pgd-auth-modal__input:-webkit-autofill,
.pgd-auth-modal__input:-webkit-autofill:hover,
.pgd-auth-modal__input:-webkit-autofill:focus,
.pgd-ak-modal__input:-webkit-autofill,
.pgd-ak-modal__input:-webkit-autofill:hover,
.pgd-ak-modal__input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px #fffdfa inset !important;
  -webkit-text-fill-color: var(--pga-ink) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Checkbox */
.pgd-auth-modal__checkbox,
.pgd-ak-modal__checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--pga-muted);
  cursor: pointer;
  user-select: none;
  margin: 2px 0 3px;
}

.pgd-auth-modal__checkbox input[type="checkbox"],
.pgd-ak-modal__checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--pga-gold);
  cursor: pointer;
}

.pgd-auth-modal__checkbox a,
.pgd-ak-modal__checkbox a {
  color: var(--pga-gold-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Error banner */
.pgd-auth-modal__error,
.pgd-ak-modal__error {
  padding: 8px 12px;
  border-radius: 7px;
  background: #fdefee;
  border: 1px solid #efc3c0;
  color: #9d2a2a;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  line-height: 1.4;
}

.pgd-auth-modal__error a,
.pgd-ak-modal__error a {
  color: #7a1f1f;
  text-decoration: underline;
}

/* Flat Primary Button - Pure Flat Aesthetic */
.pgd-auth-modal__btn,
.pgd-ak-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  border: 1px solid transparent;
  box-sizing: border-box;
  box-shadow: none !important;
  letter-spacing: 0.01em;
}

.pgd-auth-modal__btn:active,
.pgd-ak-modal__btn:active {
  transform: translateY(1px);
}

.pgd-auth-modal__btn--primary,
.pgd-ak-modal__btn--primary {
  background: var(--pga-gold);
  border-color: var(--pga-gold-edge);
  color: #17100a;
}

.pgd-auth-modal__btn--primary:hover,
.pgd-ak-modal__btn--primary:hover {
  background: var(--pga-gold-hover);
  border-color: #c47c05;
  color: #17100a;
}

.pgd-auth-modal__btn--primary:active,
.pgd-ak-modal__btn--primary:active {
  background: var(--pga-gold-active);
}

.pgd-auth-modal__btn--secondary,
.pgd-ak-modal__btn--secondary {
  background: #faf6ef;
  color: var(--pga-ink);
  border: 1px solid var(--pga-line);
}

.pgd-auth-modal__btn--secondary:hover,
.pgd-ak-modal__btn--secondary:hover {
  background: #f4ede0;
  border-color: var(--pga-line-2);
}

.pgd-auth-modal__btn--ghost,
.pgd-ak-modal__btn--ghost {
  background: transparent;
  color: var(--pga-muted);
}

.pgd-auth-modal__btn--ghost:hover,
.pgd-ak-modal__btn--ghost:hover {
  background: #f7f3eb;
  color: var(--pga-ink);
}

.pgd-auth-modal__btn:disabled,
.pgd-ak-modal__btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Footer Links */
.pgd-auth-modal__footer-links,
.pgd-ak-modal__footer-links {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--pga-muted-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pgd-auth-modal__link,
.pgd-ak-modal__link {
  color: var(--pga-muted-light);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.pgd-auth-modal__link:hover,
.pgd-ak-modal__link:hover {
  color: var(--pga-gold-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Membership Upgrade / Gated Content Features */
.pgd-auth-modal__badge,
.pgd-ak-modal__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--pga-gold-bg);
  border: 1px solid #e0af59;
  border-radius: 999px;
  color: var(--pga-gold-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.pgd-auth-modal__title,
.pgd-ak-modal__title {
  margin: 0 0 8px;
  color: var(--pga-ink);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.pgd-auth-modal__desc,
.pgd-ak-modal__desc {
  margin: 0 0 16px;
  color: var(--pga-muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.pgd-auth-modal__features,
.pgd-ak-modal__features {
  display: grid;
  gap: 8px;
  text-align: left;
  background: #faf6ef;
  border: 1px solid var(--pga-line);
  border-radius: 10px;
  padding: 13px 15px;
  margin-bottom: 18px;
}

.pgd-auth-modal__features div,
.pgd-ak-modal__features div {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--pga-ink);
  font-size: 13px;
  font-weight: 600;
}

.pgd-auth-modal__features i,
.pgd-ak-modal__features i {
  color: var(--pga-gold-dark);
  font-size: 15px;
}

.pgd-auth-modal__actions,
.pgd-ak-modal__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* Success Card */
.pgd-auth-modal__success {
  text-align: center;
  padding: 16px 8px;
}

.pgd-auth-modal__success-icon {
  font-size: 38px;
  color: var(--pga-gold-dark);
  margin-bottom: 8px;
  line-height: 1;
}

.pgd-auth-modal__success-title {
  font-size: 17px;
  font-weight: 750;
  color: var(--pga-ink);
  margin: 0 0 8px;
}

.pgd-auth-modal__success-text {
  font-size: 13px;
  color: var(--pga-muted);
  line-height: 1.5;
  margin: 0 0 18px;
}

/* Spinner */
@keyframes pgdAuthSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin,
.pgd-auth-spin {
  animation: pgdAuthSpin 0.8s linear infinite;
  display: inline-block;
}

/* Dark Mode Support */
[data-theme="dark"] .pgd-auth-modal__dialog,
[data-theme="dark"] .pgd-ak-modal__dialog,
body.dark-mode .pgd-auth-modal__dialog,
body.dark-mode .pgd-ak-modal__dialog {
  background: #1e1710;
  border-color: #3d2c1c;
  color: #f5eedf;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .pgd-auth-modal__close,
[data-theme="dark"] .pgd-ak-modal__close,
body.dark-mode .pgd-auth-modal__close,
body.dark-mode .pgd-ak-modal__close {
  background: #2b1f14;
  border-color: #3d2c1c;
  color: #c4b59d;
}

[data-theme="dark"] .pgd-auth-modal__close:hover,
[data-theme="dark"] .pgd-ak-modal__close:hover,
body.dark-mode .pgd-auth-modal__close:hover,
body.dark-mode .pgd-ak-modal__close:hover {
  background: #3d2c1c;
  color: #fff;
}

[data-theme="dark"] .pgd-auth-modal__google-btn,
[data-theme="dark"] .pgd-ak-modal__google-btn,
body.dark-mode .pgd-auth-modal__google-btn,
body.dark-mode .pgd-ak-modal__google-btn {
  background: #2b1f14;
  border-color: #3d2c1c;
  color: #f5eedf;
}

[data-theme="dark"] .pgd-auth-modal__google-btn:hover,
[data-theme="dark"] .pgd-ak-modal__google-btn:hover,
body.dark-mode .pgd-auth-modal__google-btn:hover,
body.dark-mode .pgd-ak-modal__google-btn:hover {
  background: #352618;
  border-color: #523b26;
}

[data-theme="dark"] .pgd-auth-modal__divider:before,
[data-theme="dark"] .pgd-ak-modal__divider:before,
body.dark-mode .pgd-auth-modal__divider:before,
body.dark-mode .pgd-ak-modal__divider:before {
  background: #3d2c1c;
}

[data-theme="dark"] .pgd-auth-modal__divider span,
[data-theme="dark"] .pgd-ak-modal__divider span,
body.dark-mode .pgd-auth-modal__divider span,
body.dark-mode .pgd-ak-modal__divider span {
  background: #1e1710;
  color: #a89880;
}

[data-theme="dark"] .pgd-auth-modal__tabs,
[data-theme="dark"] .pgd-ak-modal__tabs,
body.dark-mode .pgd-auth-modal__tabs,
body.dark-mode .pgd-ak-modal__tabs {
  background: #2b1f14;
}

[data-theme="dark"] .pgd-auth-modal__tab,
[data-theme="dark"] .pgd-ak-modal__tab,
body.dark-mode .pgd-auth-modal__tab,
body.dark-mode .pgd-ak-modal__tab {
  color: #a89880;
}

[data-theme="dark"] .pgd-auth-modal__tab.is-active,
[data-theme="dark"] .pgd-ak-modal__tab.is-active,
body.dark-mode .pgd-auth-modal__tab.is-active,
body.dark-mode .pgd-ak-modal__tab.is-active {
  background: #1e1710;
  color: #fcecc7;
}

[data-theme="dark"] .pgd-auth-modal__input,
[data-theme="dark"] .pgd-ak-modal__input,
body.dark-mode .pgd-auth-modal__input,
body.dark-mode .pgd-ak-modal__input {
  background: #2b1f14;
  border-color: #3d2c1c;
  color: #f5eedf;
}

[data-theme="dark"] .pgd-auth-modal__input:focus,
[data-theme="dark"] .pgd-ak-modal__input:focus,
body.dark-mode .pgd-auth-modal__input:focus,
body.dark-mode .pgd-ak-modal__input:focus {
  border-color: var(--pga-gold);
}

[data-theme="dark"] .pgd-auth-modal__title,
[data-theme="dark"] .pgd-ak-modal__title,
body.dark-mode .pgd-auth-modal__title,
body.dark-mode .pgd-ak-modal__title {
  color: #f5eedf;
}

[data-theme="dark"] .pgd-auth-modal__desc,
[data-theme="dark"] .pgd-ak-modal__desc,
body.dark-mode .pgd-auth-modal__desc,
body.dark-mode .pgd-ak-modal__desc {
  color: #a89880;
}

[data-theme="dark"] .pgd-auth-modal__features,
[data-theme="dark"] .pgd-ak-modal__features,
body.dark-mode .pgd-auth-modal__features,
body.dark-mode .pgd-ak-modal__features {
  background: #2b1f14;
  border-color: #3d2c1c;
}

[data-theme="dark"] .pgd-auth-modal__features div,
[data-theme="dark"] .pgd-ak-modal__features div,
body.dark-mode .pgd-auth-modal__features div,
body.dark-mode .pgd-ak-modal__features div {
  color: #f5eedf;
}

[data-theme="dark"] .pgd-auth-modal__success-title,
body.dark-mode .pgd-auth-modal__success-title {
  color: #f5eedf;
}

[data-theme="dark"] .pgd-auth-modal__success-text,
body.dark-mode .pgd-auth-modal__success-text {
  color: #a89880;
}
