/* SimpleAuth WP Login Styles */
#sawp-social-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5em;
  text-align: center;
  margin-bottom: 2em;
  min-height: 320px; /* Match typical login form height */
}
#sawp-social-login > * {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
#sawp-social-login img {
  max-width: 96px;
  max-height: 96px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  background: #fff;
}
#sawp-social-login .or-separator {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-weight: 500;
  margin: 0.5em 0 0.5em 0;
  font-size: 15px;
  gap: 0.75em;
}
#sawp-social-login .or-separator .or-line {
  flex: 1 1 0;
  border-bottom: 1px solid #ccc;
  height: 0;
  min-width: 30px;
}
#sawp-social-login .or-separator .or-label {
  flex: 0;
  margin: 0 0.5em;
  font-size: 15px;
  color: #888;
  letter-spacing: 1px;
}
#sawp-tologinform {
  margin: 1.5em 0 0.5em 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
#sawp-tologinform a {
  padding-left: 13px;
  color: #50575e;
  font-weight: 500;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 180px;
  min-height: 40px;
  box-sizing: border-box;
}
#sawp-tologinform a:hover,
#sawp-tologinform a:active {
  color: #135e96;
}

/* Back to Social Login Buttons */
.login #sawp-back-social {
  margin: 0 0 16px 0;
  width: 100%;
  padding: 0;
  font-size: 12px;
  z-index: 2;
  background: transparent;
  text-align: left;
  transition: visibility 0.2s, opacity 0.2s;
  position: relative;
}
.login #sawp-back-social a {
  text-decoration: none;
  color: #50575e;
  font-weight: 500;
  padding-left: 2px;
}

#loginform {
  position: relative;
  display: none;
}
.login #nav {
  transition: visibility 0.2s, opacity 0.2s;
}
.login #nav.sawp-hide-nav {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Hide social login and toggle if linking prompt is active */
body.login.sawp-linking #sawp-social-login,
body.login.sawp-linking #sawp-tologinform {
  display: none !important;
}

/* Linking flow: visually distinguish disabled email field */
body.login.sawp-linking #loginform input#user_login[disabled],
body.login.sawp-linking #loginform input#user_login[readonly] {
  background: #f5f5f5;
  color: #888;
  border-color: #e0e0e0;
  cursor: not-allowed;
}
body.login.sawp-linking #loginform label[for="user_login"] {
  display: none !important;
}

/* Success message styling */
.sawp-link-success-message {
  background: #eaf6ea !important;
  border: 1px solid #46b450 !important;
  color: #217a00 !important;
  padding: 18px 24px !important;
  margin-bottom: 22px !important;
  border-radius: 5px !important;
  text-align: center !important;
  font-weight: 600 !important;
  font-size: 18px !important;
  box-shadow: 0 2px 8px rgba(70, 180, 80, 0.07);
}
.sawp-link-success-message + div a.button.button-primary {
  margin-top: 10px;
  font-size: 16px;
  padding: 10px 32px;
  border-radius: 4px;
  background: #46b450;
  border: none;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(70, 180, 80, 0.07);
  transition: background 0.2s;
}
.sawp-link-success-message + div a.button.button-primary:hover {
  background: #217a00;
}
.sawp-link-success-flexbox {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}
.sawp-link-success-spacer {
  flex: 1 1 auto;
}
.sawp-link-success-actions {
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.sawp-link-success-btn {
  width: 100%;
  font-size: 15px;
  padding: 7px 0;
  min-width: 120px;
}
.sawp-link-success-btn-alt {
  width: 100%;
  font-size: 14px;
  padding: 6px 0;
  min-width: 120px;
  background: #f8fafc;
  border: 1px solid #c7e0d8;
  color: #217a00;
}
.sawp-link-success-btn-alt:hover {
  background: #eaf6ea;
  color: #135e96;
}
/* DRY: Use only .sawp-social-btn for all provider buttons, but keep important provider-specific and separator styles */
.sawp-social-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 7px;
  padding: 12px 22px;
  font-size: 1.08em;
  font-weight: 600;
  color: #222;
  text-decoration: none;
  /* margin-bottom: 16px; */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  cursor: pointer;
  min-width: 180px;
  min-height: 40px;
  justify-content: center;
}
.sawp-social-btn img {
  height: 24px;
  width: 24px;
  border-radius: 4px;
  background: #fff;
  margin: 0;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}
.sawp-social-btn span {
  vertical-align: middle;
  display: inline-block;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  padding-right: 13px;
}
.sawp-social-btn:focus {
  outline: 2px solid #21759b;
  outline-offset: 2px;
}
.sawp-social-btn:hover {
  border-color: #b3b3b3;
  background: #f7f7f7;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.13);
}

#sawp-social-btn-col {
  display: flex;
  flex-direction: column;
  gap: 1em;
  align-items: center;
  width: 100%;
}
#sawp-social-btn-row {
  display: flex;
  flex-direction: row;
  gap: 1em;
  justify-content: center;
  width: 100%;
}
@media (max-width: 600px) {
  #sawp-social-btn-row {
    flex-direction: column;
    gap: 1em;
    align-items: stretch;
  }
}
@media (min-width: 480px) {
  #sawp-social-login {
    flex-direction: column;
    gap: 1.5em;
  }
  #sawp-social-login > * {
    width: 100%;
  }
}

/* Loader for linking flow */
.sawp-link-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  margin: 18px 0 22px 0;
  text-align: center;
}
.sawp-link-loader .sawp-spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #e0e0e0;
  border-top: 4px solid #46b450;
  border-radius: 50%;
  animation: sawp-spin 1s linear infinite;
  margin: 0 auto;
}
@keyframes sawp-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.sawp-link-loader .sawp-loader-text {
  margin-left: 14px;
  font-size: 16px;
  color: #217a00;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Visually distinct and accessible skip-linking warning */
.sawp-skip-link-warning {
  background: #fffbe7;
  border: 2px solid #ffe08a;
  color: #b36a00;
  font-weight: 600;
  padding: 16px 20px;
  border-radius: 7px;
  margin-bottom: 18px;
  text-align: center;
  font-size: 15px;
}
/* Permanent skip prompt highlight */
.sawp-skip-link-permanent {
  background: #fff3cd;
  border: 2px solid #ffe08a;
  color: #b36a00;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 7px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 15px;
}
/* Error state for failed linking or login */
.sawp-link-error-message {
  background: #fff0f1;
  border: 2px solid #dc3232;
  color: #dc3232;
  font-weight: 600;
  padding: 14px 18px;
  border-radius: 7px;
  margin-bottom: 14px;
  text-align: center;
  font-size: 15px;
}

/* Onboarding/skip-linking prompt improvements */
.sawp-skip-linking-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
#sawp-skip-linking-box {
  background: #f0f6ff !important;
  border: 1.5px solid #b3d4fc !important;
  border-radius: 7px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  max-width: 420px;
  margin: 0 auto 22px auto;
  padding: 22px 28px 18px 28px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  text-align: initial;
}
.sawp-skip-linking-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  text-align: initial;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0;
  padding: 0;
}
.sawp-skip-linking-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  font-size: 22px;
  margin-top: 2px;
}
.sawp-skip-linking-title {
  font-size: 15px;
  font-weight: 500;
  color: #1a2936;
  line-height: 1.5;
  word-break: break-word;
}
.sawp-skip-linking-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  margin-top: 0;
}
@media (min-width: 400px) {
  .sawp-skip-linking-actions {
    flex-direction: row;
    align-items: center;
    gap: 18px;
  }
}
.sawp-skip-linking-inner button {
  min-width: 0;
  min-height: 40px;
  font-size: 15px;
  border-radius: 5px;
}
.sawp-skip-linking-inner label {
  margin-bottom: 0;
  margin-left: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  color: #444;
}
.sawp-skip-linking-inner #sawp-skip-linking-info {
  margin-top: 10px;
  font-size: 13px;
  color: #b36a00;
  display: none;
}

/* Google Account Linking Prompt Styles */
#sawp-skip-linking-box,
.sawp-skip-linking-box {
  background: #f8fafc;
  border: 1.5px solid #dbeafe;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.07);
  padding: 24px 28px 20px 28px;
  margin: 0 auto 24px auto;
  max-width: 420px;
  min-width: 260px;
  color: #1e293b;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sawp-skip-linking-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.sawp-skip-linking-icon {
  color: #2563eb;
  font-size: 22px;
  margin-top: 2px;
}
.sawp-skip-linking-title {
  font-size: 17px;
  font-weight: 600;
  color: #1e293b;
}
.sawp-skip-linking-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.sawp-skip-linking-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #334155;
}

/* Focus and hover states for all buttons */
.sawp-social-btn:focus,
.sawp-social-btn:hover,
#sawp-tologinform a:focus,
#sawp-tologinform a:hover,
.sawp-skip-linking-inner button:focus,
.sawp-skip-linking-inner button:hover {
  outline: 2px solid #2271b1;
  box-shadow: 0 0 0 2px #b6e0fe;
  background: #eaf6fa;
  color: #135e96;
}
/* Loader/spinner centering for all flows */
.sawp-overlay-loader {
  display: flex !important;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* --- Success message inner content (replaces inline styles in JS) --- */
.sawp-link-success-text {
  margin-bottom: 12px;
  font-size: 17px;
  font-weight: 600;
  color: #217a00;
}
.sawp-link-success-countdown {
  margin-bottom: 18px;
  font-size: 15px;
  font-weight: 400;
  color: #226c36;
}
.sawp-link-success-link {
  color: #217a00;
  font-weight: 600;
  font-size: 16px;
  text-decoration: underline;
  margin-right: 18px;
  transition: color 0.2s;
}
.sawp-link-success-link:last-child {
  font-size: 15px;
  font-weight: 500;
  margin-right: 0;
}
.sawp-link-success-link:hover,
.sawp-link-success-link:focus {
  color: #135e96;
  outline: none;
}

/* =====================
   TODO: UI/UX AUDIT & IMPROVEMENTS
   =====================
   - Review all styles for accessibility (contrast, focus, etc.)
   - Ensure skip-linking warning and prompt are visually clear and prominent
   - Polish login toggling transitions (show/hide, fade, etc.)
   - Consider adding animation or highlight for skip-linking actions
   - Make sure all buttons and links are visually distinct and accessible
   - Add ARIA attributes or visually hidden text if needed for screen readers
   - Test on mobile and small screens for responsive issues
   - Add comments to clarify intent of complex or non-obvious rules
   - Mark any legacy or deprecated styles for cleanup
   - Ensure loader/spinner is visible and centered in all flows
   - Add visual feedback for error/success states in linking and login
   ===================== */

/* TODO: Make skip-linking warning visually distinct and accessible. Consider a warning box or highlight. */
/* Example: .sawp-skip-link-warning { ... } */

/* TODO: Add/adjust styles for explicit permanent skip prompt (should be clear, with warning color, and not easily missed) */
/* Example: .sawp-skip-link-permanent { ... } */

/* TODO: Review and polish login toggling transitions (e.g., fade in/out, smooth height changes) */
/* Example: .sawp-login-toggle { transition: ... } */

/* TODO: Add error state styles for failed linking or login attempts */
/* Example: .sawp-link-error-message { ... } */

/* TODO: Ensure all buttons (social, skip, back, etc.) have :focus and :hover states for accessibility */

/* TODO: Test and polish loader/spinner for all linking flows */

/* TODO: Add comments to clarify intent of any complex selectors or overrides below */

/* =====================
   ONBOARDING / SKIP-LINKING BOX STYLES
   ===================== */

/* Main onboarding prompt container */
#sawp-skip-linking-box {
  max-width: 400px;
  margin: 0 auto 24px auto;
  background: #f9f9f9;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.sawp-skip-linking-inner {
  padding: 20px;
}

/* Icon and title row */
.sawp-skip-linking-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.sawp-skip-linking-icon {
  flex-shrink: 0;
  color: #0073aa;
  font-size: 20px;
  margin-top: 2px;
}

.sawp-skip-linking-title {
  flex: 1;
  font-size: 16px;
  line-height: 1.4;
  color: #1d2327;
  font-weight: 400;
}

/* Base button styles for both Link Now and Skip buttons - override WordPress defaults */
.sawp-link-now-btn,
.sawp-skip-link-btn {
  width: 100% !important;
  padding: 12px 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  text-align: center !important;
  border-radius: 4px !important;
  border: 1px solid !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  min-height: 44px !important;
}

/* Link Now button - blue primary */
.sawp-link-now-btn {
  margin-bottom: 16px !important;
  background: #2271b1 !important;
  border-color: #2271b1 !important;
  color: #fff !important;
}

.sawp-link-now-btn:hover,
.sawp-link-now-btn:focus {
  background: #135e96 !important;
  border-color: #135e96 !important;
  color: #fff !important;
}

.sawp-link-now-btn:focus {
  border-color: #043959 !important;
  box-shadow: 0 0 0 1px #043959 !important;
}

/* Skip actions container */
.sawp-skip-linking-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

/* Skip for now button - gentle gray */
.sawp-skip-link-btn {
  background: #f6f7f7 !important;
  border-color: #c3c4c7 !important;
  color: #50575e !important;
}

.sawp-skip-link-btn:hover,
.sawp-skip-link-btn:focus {
  background: #f0f0f1 !important;
  border-color: #8c8f94 !important;
  color: #1d2327 !important;
}

.sawp-skip-link-btn:focus {
  border-color: #2271b1 !important;
  box-shadow: 0 0 0 1px #2271b1 !important;
}

/* Checkbox container */
.sawp-skip-linking-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #646970;
  margin: 0;
  cursor: pointer;
  align-self: flex-start;
}

.sawp-skip-linking-checkbox input[type="checkbox"] {
  margin: 0;
}

.sawp-skip-linking-checkbox span {
  user-select: none;
}

/* Info/status message area */
.sawp-skip-linking-info {
  margin-top: 16px;
  padding: 12px;
  border-radius: 4px;
  display: none;
}

.sawp-skip-linking-info.notice-success {
  background: #d5edda;
  border-left: 4px solid #00a32a;
  color: #155724;
}

.sawp-skip-linking-info.notice-error {
  background: #f8d7da;
  border-left: 4px solid #dc3232;
  color: #721c24;
}

/* Retry Notice Styling */
.sawp-retry-notice {
  max-width: 400px;
  margin: 0 auto 24px auto;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-left: 4px solid #f39c12;
  border-radius: 4px;
  color: #856404;
}

.sawp-retry-notice .dashicons-clock {
  color: #f39c12 !important;
}

.sawp-retry-notice .button {
  white-space: nowrap;
}

.sawp-retry-notice .dashicons-google {
  font-size: 16px;
  width: 16px;
  height: 16px;
}
