/* ==========================================================================
   GAMEOSOPHY AUTHENTICATION - MODERN SAAS MODAL SYSTEM
   ========================================================================== */

:root {
  --gm-auth-primary: #6a11cb;
  --gm-auth-primary-hover: #5008a3;
  --gm-auth-secondary: #2575fc;
  --gm-auth-gradient: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  --gm-auth-text-dark: #0f172a;
  --gm-auth-text-body: #334155;
  --gm-auth-text-muted: #64748b;
  --gm-auth-text-light: #94a3b8;
  --gm-auth-border: #e2e8f0;
  --gm-auth-border-focus: #c7d2fe;
  --gm-auth-bg-card: #ffffff;
  --gm-auth-bg-page: #f8fafc;
  --gm-auth-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(226, 232, 240, 0.8);
  --gm-auth-radius: 20px;
  --gm-auth-radius-sm: 12px;
}

/* Prevent body scrolling when modal is open */
body.gm-auth-modal-open {
  overflow: hidden !important;
  touch-action: none;
}

/* ==========================================================================
   MODAL OVERLAY (DARK BLURRED BACKDROP)
   ========================================================================== */
.gm-auth-modal-overlay {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 105000;
  background-color: rgba(10, 16, 38, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.gm-auth-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Centered Popup Dialog */
.gm-auth-modal-dialog {
  width: 100%;
  max-width: 520px;
  background: var(--gm-auth-bg-card);
  border-radius: var(--gm-auth-radius);
  box-shadow: var(--gm-auth-shadow);
  padding: 36px 36px 30px 36px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.94) translateY(14px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

/* Sleek Scrollbar for Dialog */
.gm-auth-modal-dialog::-webkit-scrollbar {
  width: 6px;
}
.gm-auth-modal-dialog::-webkit-scrollbar-track {
  background: transparent;
}
.gm-auth-modal-dialog::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.gm-auth-modal-overlay.is-open .gm-auth-modal-dialog {
  transform: scale(1) translateY(0);
}

/* Top-Right Close Button */
.gm-auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gm-auth-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  padding: 0;
}

.gm-auth-modal-close:hover {
  background: #e2e8f0;
  color: var(--gm-auth-text-dark);
  transform: rotate(90deg);
}

.gm-auth-modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--gm-auth-primary);
}

/* Modal Brand Header */
.gm-auth-modal-header {
  text-align: center;
  margin-bottom: 22px;
}

.gm-auth-modal-logo-wrap {
  display: inline-block;
  margin-bottom: 14px;
  transition: transform 0.2s ease;
}

.gm-auth-modal-logo-wrap:hover {
  transform: translateY(-1px);
}

.gm-auth-modal-logo-img {
  height: 34px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.gm-auth-modal-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--gm-auth-text-dark);
  margin: 0 0 5px 0;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.gm-auth-modal-subtitle {
  font-size: 13.5px;
  color: var(--gm-auth-text-muted);
  margin: 0;
  line-height: 1.45;
}

/* ==========================================================================
   SOCIAL BUTTONS
   ========================================================================= */
.gm-social-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 16px;
}

.gm-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 46px;
  background: #ffffff;
  border: 1.5px solid var(--gm-auth-border);
  border-radius: var(--gm-auth-radius-sm);
  color: #0f172a !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  position: relative;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

.gm-social-btn,
.gm-social-btn:visited,
.gm-social-btn:focus,
.gm-social-btn:active {
  color: #0f172a !important;
  text-decoration: none !important;
}

.gm-social-btn:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.07);
  color: #0f172a !important;
  text-decoration: none !important;
}

.gm-social-btn .gm-social-text,
.gm-social-btn:hover .gm-social-text,
.gm-social-btn:focus .gm-social-text,
.gm-social-btn:active .gm-social-text {
  color: #0f172a !important;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
}

.gm-social-btn:active {
  transform: scale(0.99);
}

.gm-social-btn:focus-visible {
  outline: none;
  border-color: var(--gm-auth-primary);
  box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.18);
}

.gm-social-google:hover {
  border-color: #4285F4;
  background: rgba(66, 133, 244, 0.02);
}

.gm-social-facebook:hover {
  border-color: #1877F2;
  background: rgba(24, 119, 242, 0.02);
}

.gm-social-github:hover {
  border-color: #0f172a;
  background: rgba(15, 23, 42, 0.02);
}

.gm-social-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gm-social-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.gm-social-btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

/* OR Divider */
.gm-auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0 16px 0;
  color: var(--gm-auth-text-light);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gm-auth-divider::before,
.gm-auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--gm-auth-border);
}

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

/* ==========================================================================
   FORM CONTROLS & INPUTS
   ========================================================================== */
.gm-form-group {
  margin-bottom: 16px;
  text-align: left;
}

.gm-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gm-auth-text-body);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.gm-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.gm-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gm-auth-text-light);
  pointer-events: none;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  z-index: 2;
}

.gm-input-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
}

.gm-input-control {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 42px;
  background: #f8fafc;
  border: 1.5px solid var(--gm-auth-border);
  border-radius: var(--gm-auth-radius-sm);
  font-size: 14px;
  color: var(--gm-auth-text-dark);
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.gm-input-control::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.gm-input-control:focus {
  background: #ffffff;
  border-color: var(--gm-auth-primary);
  box-shadow: 0 0 0 3.5px rgba(106, 17, 203, 0.12);
  outline: none;
}

.gm-input-wrapper:focus-within .gm-input-icon {
  color: var(--gm-auth-primary);
}

/* Password Toggle */
.gm-pwd-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  color: var(--gm-auth-text-light);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease;
  z-index: 2;
}

.gm-pwd-toggle:hover {
  color: var(--gm-auth-text-body);
  background-color: rgba(15, 23, 42, 0.05);
}

.gm-pwd-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--gm-auth-primary);
}

.gm-pwd-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Validation Feedback */
.gm-field-error {
  color: #dc2626;
  font-size: 12px;
  font-weight: 500;
  margin-top: 5px;
  display: none;
  line-height: 1.4;
}

.gm-form-group.has-error .gm-input-control {
  border-color: #ef4444 !important;
  background: #fff8f8;
}

.gm-form-group.has-error .gm-input-icon {
  color: #ef4444;
}

.gm-form-group.has-error .gm-field-error {
  display: block;
}

/* Form Options Row */
.gm-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  margin-bottom: 20px;
  font-size: 13px;
}

.gm-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--gm-auth-text-body);
  font-weight: 500;
  margin: 0;
}

.gm-checkbox-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.gm-checkbox-custom {
  width: 17px;
  height: 17px;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.gm-checkbox-custom svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}

.gm-checkbox-input:checked + .gm-checkbox-custom {
  background: var(--gm-auth-primary);
  border-color: var(--gm-auth-primary);
}

.gm-checkbox-input:checked + .gm-checkbox-custom svg {
  display: block;
}

.gm-checkbox-input:focus-visible + .gm-checkbox-custom {
  box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.2);
}

/* Interactive Switch Links */
.gm-auth-switch-link {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--gm-auth-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

.gm-auth-switch-link:hover {
  color: var(--gm-auth-primary-hover);
  text-decoration: underline;
}

.gm-auth-link-action {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--gm-auth-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s ease;
  margin-left: 4px;
}

.gm-auth-link-action:hover {
  color: var(--gm-auth-primary-hover);
  text-decoration: underline;
}

/* Submit Button */
.gm-btn-submit {
  width: 100%;
  height: 48px;
  background: var(--gm-auth-gradient);
  border: none;
  border-radius: var(--gm-auth-radius-sm);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(106, 17, 203, 0.28);
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.gm-btn-submit:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 8px 24px rgba(106, 17, 203, 0.38);
  filter: brightness(1.03);
}

.gm-btn-submit:active {
  transform: scale(0.99);
}

.gm-btn-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.35);
}

.gm-btn-submit:disabled,
.gm-btn-submit.is-submitting {
  opacity: 0.82;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 15px rgba(106, 17, 203, 0.2);
}

/* Inline Spinner */
.gm-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: gmSpin 0.7s linear infinite;
}

.gm-spinner-dark {
  border-color: rgba(15, 23, 42, 0.15);
  border-top-color: var(--gm-auth-text-dark);
}

@keyframes gmSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes gmFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Alert Notification Boxes */
.gm-alert {
  border-radius: var(--gm-auth-radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: gmFadeIn 0.25s ease;
  box-sizing: border-box;
}

.gm-alert-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.gm-alert-content {
  flex: 1;
}

.gm-alert-danger {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.gm-alert-success {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* Modal Footer & Trust Badge */
.gm-auth-modal-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 14px;
  color: var(--gm-auth-text-muted);
}

.gm-auth-trust-badge {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gm-auth-text-light);
  font-weight: 500;
  text-align: center;
}

.gm-auth-trust-badge svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Responsive Modal Breakpoints */
@media (max-width: 576px) {
  .gm-auth-modal-overlay {
    padding: 14px 10px;
    align-items: flex-end;
  }

  .gm-auth-modal-dialog {
    padding: 28px 18px 22px 18px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
  }

  .gm-auth-modal-title {
    font-size: 21px;
  }

  .gm-auth-modal-subtitle {
    font-size: 13px;
  }

  .gm-social-btn {
    height: 44px;
    font-size: 13.5px;
  }

  .gm-input-control {
    height: 44px;
    font-size: 14px;
  }

  .gm-btn-submit {
    height: 46px;
    font-size: 14.5px;
  }

  .gm-form-options {
    font-size: 12.5px;
  }
}
