/**
 * Intellepedia WordPress Login - Clean Professional Design
 * Simple, accessible, properly tested
 */

/* Variables */
:root {
  --bg: #f8f6f3;
  --text: #2c2620;
  --text-muted: #6b6560;
  --primary: #c8944a;
  --primary-hover: #b5843f;
  --border: #e0dbd5;
  --white: #ffffff;
  --error-bg: #fef2f2;
  --error-border: #ef4444;
  --error-text: #991b1b;
  --radius: 6px;
}

/* Base */
body.login {
  background: var(--bg) !important;
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 100vh;
  margin: 0 !important;
  padding: 20px !important;
  overflow-y: auto !important;
}

/* Login Container - Override WordPress default width: 320px */
#login,
.login #login {
  width: 100% !important;
  max-width: 420px !important;
  min-width: 320px;
  padding: 40px !important;
  background: var(--white) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
  box-sizing: border-box !important;
  margin: 0 auto !important;
}

/* Logo Area */
#login h1 {
  margin: 0 0 30px 0;
  text-align: center;
}

#login h1 a {
  background: none !important;
  width: auto !important;
  height: auto !important;
  text-indent: 0 !important;
  display: block;
  text-decoration: none;
  outline-offset: 4px;
  font-size: 0; /* Hide original link text */
  color: transparent;
}

#login h1 a:focus {
  outline: 2px solid var(--primary);
}

/* Logo Icon */
#login h1 a::before {
  content: 'i';
  display: block;
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  background: var(--primary);
  border-radius: 50%;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-style: italic;
  font-weight: 600;
  color: var(--white);
  line-height: 60px;
  text-align: center;
}

/* Brand Name */
#login h1 a::after {
  content: 'INTELLEPEDIA';
  display: block;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text);
  text-align: center;
}

/* Tagline */
#login h1::after {
  content: "India's Leading IP Knowledge Base";
  display: block;
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* Form - Override WordPress default .login form styles */
#loginform,
.login form,
.login #loginform {
  width: 100% !important;
  max-width: none !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Labels */
#loginform label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

/* Input Groups - Ensure full width */
#loginform p,
.login form p,
#loginform > p {
  width: 100% !important;
  max-width: none !important;
  margin: 0 0 20px 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Inputs - Override all WordPress input width constraints */
#loginform input[type="text"],
#loginform input[type="password"],
#loginform .input,
.login form .input,
.login input[type="text"],
.login input[type="password"],
#user_login,
#user_pass {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  padding: 12px 14px !important;
  font-family: inherit;
  font-size: 1rem !important;
  color: var(--text);
  background: var(--white) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#loginform input[type="text"]:focus,
#loginform input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 148, 74, 0.15);
}

/* Password Toggle - Ensure full width */
.user-pass-wrap,
.login .user-pass-wrap {
  width: 100% !important;
  max-width: none !important;
  margin: 0 0 20px 0 !important;
  box-sizing: border-box !important;
}

.wp-pwd,
.login .wp-pwd {
  position: relative;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

.wp-hide-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
}

.wp-hide-pw:hover {
  color: var(--primary);
}

.wp-hide-pw:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Remember Me */
.forgetmenot {
  margin: 0 0 20px 0 !important;
}

.forgetmenot label {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
  margin: 0 !important;
}

#rememberme {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

#rememberme:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Submit Button */
.submit,
.login .submit,
#loginform .submit {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

#wp-submit {
  width: 100%;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s;
}

#wp-submit:hover {
  background: var(--primary-hover);
}

#wp-submit:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(200, 148, 74, 0.3);
}

/* Navigation Links */
#nav,
#backtoblog {
  text-align: center;
  margin: 0;
  padding: 0;
}

#nav {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

#backtoblog {
  margin-top: 12px;
}

#nav a,
#backtoblog a {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
}

#nav a:hover,
#backtoblog a:hover {
  color: var(--primary);
}

#nav a:focus,
#backtoblog a:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Error Messages */
#login_error,
.message,
.success {
  padding: 14px 16px;
  margin: 0 0 20px 0;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border-left: 4px solid;
}

#login_error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error-text);
}

.message {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
}

.success {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #166534;
}

#login_error a,
.message a {
  color: inherit;
  font-weight: 600;
}

/* Footer Credit */
#backtoblog::after {
  content: 'A BananaIP Counsels Initiative';
  display: block;
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Screen Reader */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
}

.screen-reader-text:focus {
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  clip: auto !important;
  clip-path: none;
  color: var(--text);
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  height: auto;
  left: 10px;
  padding: 12px 16px;
  top: 10px;
  width: auto;
  z-index: 100000;
}

/* Focus Visible */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* High Contrast */
@media (prefers-contrast: high) {
  #loginform input[type="text"],
  #loginform input[type="password"] {
    border-width: 2px;
  }

  #wp-submit {
    border: 2px solid var(--text);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Mobile */
@media screen and (max-width: 480px) {
  body.login {
    padding: 16px;
  }

  #login {
    padding: 30px 24px;
  }

  #login h1 a::before {
    width: 50px;
    height: 50px;
    font-size: 1.75rem;
    line-height: 50px;
  }

  #login h1 a::after {
    font-size: 1.25rem;
  }

  #loginform input[type="text"],
  #loginform input[type="password"] {
    font-size: 16px;
  }
}

/* Hide WordPress branding */
.login a[href*="wordpress.org"] {
  font-size: 0;
}

/* Privacy link */
.privacy-policy-page-link {
  text-align: center;
  margin-top: 16px;
}

.privacy-policy-page-link a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
}

.privacy-policy-page-link a:hover {
  color: var(--primary);
}
