/**
 * LevelUp Google Login Styles
 */

/* Google Login Container */
.google-login-container {
  margin: 20px 0;
  text-align: center;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e1e1e1;
}

/* When email/password is disabled, center the Google button */
.login .google-login-container {
  margin: 20px auto;
  max-width: 400px;
  background: transparent;
  border: none;
  padding: 0;
}

/* When email/password is enabled, style the Google button to match the form */
.login .google-login-container {
  margin: 20px 0;
  background: transparent;
  border: none;
  padding: 0;
}

/* Google Sign-In Button Styling */
.g_id_signin {
  margin: 0 auto;
  display: block;
}

/* Ensure the Google button is properly sized */
.g_id_signin > div {
  margin: 0 auto;
}

/* Error and Success Messages */
.google-login-error,
.google-login-success {
  margin: 10px 0;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid;
}

.google-login-error {
  color: #dc3232;
  background: #fff;
  border-left-color: #dc3232;
  box-shadow: 0 2px 4px rgba(220, 50, 50, 0.1);
}

.google-login-success {
  color: #46b450;
  background: #fff;
  border-left-color: #46b450;
  box-shadow: 0 2px 4px rgba(70, 180, 80, 0.1);
}

/* Login Form Modifications */
.login .google-login-container {
  margin: 20px 0;
  background: transparent;
  border: none;
  padding: 0;
}

.login .google-login-btn {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  display: block;
}

/* These styles are now applied conditionally via PHP */
/* The CSS hiding is handled in the Plugin class based on settings */

/* OR separator styling */
.login .or-separator {
  margin: 20px 0 20px 0;
  border-top: 1px solid #ddd;
  position: relative;
  text-align: center;
}

.login .or-separator span {
  background: #fff;
  padding: 0 10px;
  color: #666;
  font-size: 14px;
  position: relative;
  top: -10px;
}

/* Google login container when both methods are enabled */
.login .google-login-container {
  margin: 20px auto;
  max-width: 400px;
  text-align: center;
}

/* Settings Page Styles */
.wrap .google-login-container {
  background: #fff;
  border: 1px solid #ccd0d4;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

/* Redirect URI Container Styles */
.redirect-uri-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.redirect-uri-container input {
  flex: 1;
  font-family: monospace;
  font-size: 12px;
}

.redirect-uri-container button {
  white-space: nowrap;
  min-width: 120px;
}

/* Image Selection Styles */
.image-selection {
  margin: 10px 0;
}

.button-option {
  margin: 20px 0;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f9f9f9;
}

.button-option label {
  display: block;
  margin: 8px 0;
  font-weight: 600;
  font-size: 14px;
}

.button-option input[type="radio"] {
  margin-right: 8px;
}

.button-preview {
  margin-top: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 4px;
  text-align: center;
}

#select-custom-image {
  margin: 10px 0;
}

#selected-image-preview {
  margin-top: 10px;
}

#selected-image-preview img {
  border: 2px solid #ddd;
  border-radius: 4px;
  padding: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .google-login-btn {
    width: 100%;
    max-width: none;
  }

  .google-login-container {
    margin: 15px 0;
    padding: 15px;
  }
}

/* Loading State */
.google-login-btn.loading {
  position: relative;
  color: transparent !important;
}

.google-login-btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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

/* Custom Image Button Styles */
#google-login-button {
  max-width: 280px !important;
  width: 100% !important;
  height: auto !important;
  border: 2px solid #ccc !important;
  border-radius: 4px !important;
  padding: 8px !important;
  background: #fff !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  display: block !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

#google-login-button:hover {
  border-color: #999 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

#google-login-button:active {
  border-color: #666 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
}

/* Ensure the container also respects the sizing */
.google-login-container #google-login-button {
  max-width: 280px !important;
  width: 100% !important;
}

/* One Tap Login Styles */
#g_id_onload {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
}

/* Admin Notice Styles */
.notice.levelup-google-login-notice {
  border-left-color: #4285f4;
}

.notice.levelup-google-login-notice .notice-dismiss {
  color: #4285f4;
}

/* Security Logs Table */
.levelup-security-logs {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.levelup-security-logs th,
.levelup-security-logs td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.levelup-security-logs th {
  background-color: #f5f5f5;
  font-weight: 600;
}

.levelup-security-logs tr:hover {
  background-color: #f9f9f9;
}

.levelup-security-logs .event-type {
  font-weight: 500;
}

.levelup-security-logs .event-type.failed_login_attempt {
  color: #dc3232;
}

.levelup-security-logs .event-type.successful_login {
  color: #46b450;
}

.levelup-security-logs .event-type.ip_banned {
  color: #ff6b35;
}

/* Form Field Styles */
.levelup-settings-field {
  margin-bottom: 20px;
}

.levelup-settings-field label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.levelup-settings-field input[type="text"],
.levelup-settings-field input[type="password"],
.levelup-settings-field input[type="number"],
.levelup-settings-field select,
.levelup-settings-field textarea {
  width: 100%;
  max-width: 400px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.levelup-settings-field input[type="checkbox"] {
  margin-right: 8px;
}

.levelup-settings-field .description {
  color: #666;
  font-style: italic;
  margin-top: 5px;
  font-size: 13px;
}
