/* ── GitHub Login — Button Styles ── */
#widget-login-dropdown {
  position: fixed;
  right: 21px;
  top: 21px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
}

#widget-login-dropdown .login-btn:not(.gh-login-btn),
#widget-login-dropdown .widget-kpr,
#widget-login-dropdown iframe,
#widget-login-kpr:not(.gh-modal-overlay) {
  display: none !important;
}

html.mornikar-external-shell #widget-login-dropdown,
html.mornikar-external-shell #widget-login-kpr.gh-modal-overlay {
  z-index: 2147483002 !important;
  pointer-events: auto !important;
}

/* Sign In Button */
.gh-login-btn {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 49px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  color: #fff;
  font-family: 'IBMPlexMono', 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gh-login-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #00d4ff;
}

.gh-login-btn svg {
  transition: fill 0.2s;
}

.gh-login-btn:hover svg {
  fill: #00d4ff;
}

/* Logged-in User Button */
.gh-user-btn {
  display: flex;
  align-items: center;
  padding: 4px 12px 4px 4px;
  height: 49px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  color: #fff;
  font-family: 'IBMPlexMono', 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gh-user-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
}

.gh-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gh-username {
  text-transform: none;
}

/* User Dropdown Menu */
.gh-user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 220px;
  background: #0b0b1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  overflow: hidden;
}

.gh-menu-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 10px;
}

.gh-avatar-md {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gh-menu-info {
  display: flex;
  flex-direction: column;
}

.gh-menu-name {
  font-size: 13px;
  font-weight: 600;
  color: #e4e4e8;
}

.gh-menu-login {
  font-size: 11px;
  color: #8a8a9a;
  font-family: 'IBMPlexMono', monospace;
}

.gh-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0;
}

.gh-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: #e4e4e8;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.gh-menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.gh-menu-danger {
  color: #ff3344;
}

.gh-menu-danger:hover {
  background: rgba(255, 51, 68, 0.08);
  color: #ff5566;
}

.gh-menu-primary {
  color: #00d4ff;
}

.gh-menu-primary:hover {
  background: rgba(0, 212, 255, 0.08);
  color: #6ee8ff;
}

/* ── Login Modal ── */
#widget-login-kpr.gh-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.gh-modal {
  position: relative;
  width: 380px;
  max-width: 90vw;
  background: #0b0b1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
  animation: gh-modal-in 0.25s ease-out;
}

@keyframes gh-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gh-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: #8a8a9a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.gh-modal-close:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.gh-modal-logo {
  margin-bottom: 20px;
  color: #fff;
}

.gh-modal-logo svg {
  width: 48px;
  height: 48px;
}

.gh-modal-title {
  font-family: 'ABCWhyteVariable', 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: #e4e4e8;
  margin: 0 0 8px;
}

.gh-modal-desc {
  font-size: 13px;
  color: #8a8a9a;
  line-height: 1.5;
  margin: 0 0 28px;
}

.gh-oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 24px;
  background: #fff;
  color: #0b0b1a;
  border: none;
  border-radius: 2px;
  font-family: 'IBMPlexMono', 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.01em;
}

.gh-oauth-btn:hover {
  background: #e4e4e8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.gh-oauth-btn:active {
  transform: translateY(0);
}

.gh-oauth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.gh-oauth-btn svg {
  margin-right: 8px;
}

.gh-modal-hint {
  margin-top: 16px;
  font-size: 11px;
  color: #ff3344;
  opacity: 0.8;
}

html.mornikar-auth-lock .mornikar-external-shell-bg iframe {
  visibility: hidden !important;
}

html.mornikar-auth-lock .mornikar-external-shell-bg {
  background: #05070c !important;
}

.gh-callback-message {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05070c;
  color: #fff;
  font-family: 'IBMPlexMono', 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* Spinner */
.gh-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #0b0b1a;
  border-radius: 50%;
  animation: gh-spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* Hide original KPR wallet connect button */
.btn-wallet-connect,
.wallet-info {
  display: none !important;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  #widget-login-dropdown {
    right: 0;
    top: 0;
  }
  .gh-login-btn {
    border-top-right-radius: 0 !important;
    height: 4rem !important;
  }
}

@media (max-width: 535px) {
  #widget-login-kpr.gh-modal-overlay {
    background-color: rgba(0, 0, 0, 0.85);
  }
  .gh-modal {
    width: 95vw;
    padding: 32px 20px;
  }
}
