/**
 * The public-facing stylesheet for the plugin.
 *
 * @package PasswordRestrictWebsite
 */

/* CSS Custom Properties for dynamic values */
:root {
  --wp-password-restrict-page-bg-color: #212327;
  --wp-password-restrict-form-bg-color: #ffffff;
  --wp-password-restrict-heading-color: #1d1e21;
  --wp-password-restrict-label-color: #1d1e21;
  --wp-password-restrict-paragraph-color: #1d1e21;
  --wp-password-restrict-placeholder-color: #1d1e21;
  --wp-password-restrict-remember-color: #1d1e21;
  --wp-password-restrict-button-color: #45b26b;
}

/* High specificity selectors to override theme styles */
html.wp-password-restrict-active,
body.wp-password-restrict-active,
html.wp-password-restrict-active body,
body.wp-password-restrict-active {
  background-color: var(--wp-password-restrict-page-bg-color) !important;
  background-image: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Override any theme background styles */
html.wp-password-restrict-active *,
body.wp-password-restrict-active * {
  background-color: transparent !important;
}

html.wp-password-restrict-active,
body.wp-password-restrict-active {
  background-color: var(--wp-password-restrict-page-bg-color) !important;
  background-image: none !important;
}

/* Ensure form styling is preserved */
#password-restrict-form {
  max-width: 400px;
  margin: 100px auto;
  padding: 20px;
  background: var(--wp-password-restrict-form-bg-color) !important;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1000;
}

.password-restrict-logo {
  text-align: center;
  margin-bottom: 20px;
}

.password-restrict-logo img {
  max-width: 200px;
  max-height: 100px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}

#password-restrict-form h2 {
  margin: 0 0 20px;
  padding: 0;
  font-size: 24px;
  text-align: center;
  color: var(--wp-password-restrict-heading-color) !important;
}

#password-restrict-form p {
  margin: 0 0 20px;
  text-align: center;
  color: var(--wp-password-restrict-paragraph-color) !important;
}

.password-restrict-description {
  margin: 0 0 20px;
  text-align: center;
}

.password-restrict-description p {
  margin: 0 0 10px;
  color: var(--wp-password-restrict-paragraph-color) !important;
}

.password-restrict-description p:last-child {
  margin-bottom: 0;
}

.password-restrict-error {
  margin: 0 0 20px;
  padding: 10px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  color: #721c24;
  text-align: center;
}

.password-restrict-field {
  margin: 0 0 20px;
}

.password-restrict-field label {
  display: block;
  margin: 0 0 5px;
  font-weight: 600;
  color: var(--wp-password-restrict-label-color) !important;
}

.password-restrict-field input[type="password"],
.password-restrict-field input[type="text"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

.password-restrict-field input[type="password"]::placeholder,
.password-restrict-field input[type="text"]::placeholder {
  color: var(--wp-password-restrict-placeholder-color) !important;
}

.password-restrict-field input[type="checkbox"] {
  margin: 0 5px 0 0;
}

.password-restrict-field.remember-me label {
  color: var(--wp-password-restrict-remember-color) !important;
  font-weight: normal;
}

.password-restrict-submit {
  text-align: center;
}

.password-restrict-submit input[type="submit"] {
  padding: 10px 20px;
  background: var(--wp-password-restrict-button-color) !important;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.password-restrict-submit input[type="submit"]:hover {
  opacity: 0.8 !important;
}

/* Additional specificity for theme overrides */
body #password-restrict-form,
html body #password-restrict-form {
  background-color: var(--wp-password-restrict-form-bg-color) !important;
}

body #password-restrict-form h2,
html body #password-restrict-form h2 {
  color: var(--wp-password-restrict-heading-color) !important;
}

body #password-restrict-form label,
html body #password-restrict-form label {
  color: var(--wp-password-restrict-label-color) !important;
}

body #password-restrict-form p,
html body #password-restrict-form p {
  color: var(--wp-password-restrict-paragraph-color) !important;
}

/* Maximum specificity overrides */
html.wp-password-restrict-active
  body.wp-password-restrict-active
  #password-restrict-form {
  background-color: var(--wp-password-restrict-form-bg-color) !important;
}

html.wp-password-restrict-active
  body.wp-password-restrict-active
  #password-restrict-form
  h2 {
  color: var(--wp-password-restrict-heading-color) !important;
}

html.wp-password-restrict-active
  body.wp-password-restrict-active
  #password-restrict-form
  label {
  color: var(--wp-password-restrict-label-color) !important;
}

html.wp-password-restrict-active
  body.wp-password-restrict-active
  #password-restrict-form
  p {
  color: var(--wp-password-restrict-paragraph-color) !important;
}
