/*!
 * @file login.css
 * @brief Estilos Login/Registro con paleta olive/blue-gray/off-white/stone/text.
 */

:root {
  --olive: #9CB28A;
  --blue-gray: #6E889B;
  --off-white: #F5F6F2;
  --stone: #E6E7E8;
  --text: #29323A;

  --primary-gradient: linear-gradient(135deg, var(--olive) 0%, var(--blue-gray) 100%);
  --secondary-gradient: linear-gradient(135deg, var(--off-white) 0%, var(--stone) 100%);
  --accent-blue: var(--blue-gray);
  --accent-pink: var(--olive);
  --text-dark: var(--text);
  --text-light: #5B6772;

  --white: #ffffff;
  --glass: rgba(255, 255, 255, 0.25);
  --shadow: rgba(0, 0, 0, 0.1);
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --error-color: #ef4444;
  --success-color: #10b981;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  background: var(--off-white); 
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: float 20s linear infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes float { 0% { transform: translate(0, 0) rotate(0deg); } 100% { transform: translate(-50px, -50px) rotate(360deg); } }

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-container {
  display: flex;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  width: 100%;
  max-width: 900px;
  min-height: 600px;
  position: relative;
  animation: slideIn 0.8s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.visual-panel {
  flex: 1;
  background: var(--primary-gradient);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-align: center;
  padding: 3rem 2rem;
  position: relative;
  overflow: hidden;
}

.visual-panel::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.10) 2px, transparent 2px);
  background-size: 40px 40px;
  animation: floatReverse 15s linear infinite;
}

@keyframes floatReverse { 0% { transform: translate(0, 0) rotate(0deg); } 100% { transform: translate(30px, 30px) rotate(-360deg); } }

.panel-content { position: relative; z-index: 2; }

.panel-content h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeInUp 1s ease 0.3s forwards;
}

.panel-content p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  opacity: 0;
  line-height: 1.6;
  animation: fadeInUp 1s ease 0.5s forwards;
}

.panel-logo {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0;
  animation: fadeInUp 1s ease 0.1s forwards;
}

@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.form-section {
  flex: 1;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.login-title {
  text-align: center;
  font-size: 2rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.login-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 2rem;
}

.login-form { width: 100%; }

.form-group { position: relative; margin-bottom: 1.5rem; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 18px 20px 12px 20px;
  border: 2px solid var(--stone);
  border-radius: 15px;
  font-size: 1rem;
  color: var(--text-dark);
  background: var(--off-white);
  outline: none;
  transition: var(--transition);
  min-height: 56px;
}

.form-group input:focus {
  border-color: var(--accent-blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(110, 136, 155, 0.15);
  transform: translateY(-2px);
}

.form-group input:hover {
  background: #ffffff;
  border-color: #cfd4d8;
}

.form-group label {
  position: absolute;
  top: 18px;
  left: 20px;
  color: var(--text-light);
  font-size: 1rem;
  pointer-events: none;
  transition: var(--transition);
  background: transparent;
  z-index: 1;
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group input.has-value + label {
  top: -12px;
  left: 16px;
  font-size: 0.85rem;
  color: var(--accent-blue);
  background: #ffffff;
  padding: 0 8px;
  font-weight: 600;
}

.form-group input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 40px var(--off-white) inset !important;
  -webkit-text-fill-color: var(--text-dark) !important;
  caret-color: var(--text-dark);
  border-radius: 15px;
}

.form-group input:-webkit-autofill + label {
  top: -12px;
  left: 16px;
  font-size: 0.85rem;
  color: var(--accent-blue);
  background: #ffffff;
  padding: 0 8px;
  font-weight: 600;
}

.form-group input:valid { border-color: var(--success-color); }
.form-group input:invalid:not(:placeholder-shown):not(:focus) { border-color: var(--error-color); }

.btn-principal {
  width: 100%;
  padding: 16px;
  background: var(--primary-gradient);
  border: none;
  border-radius: 15px;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin: 1.5rem 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-principal::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0; height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transition: width 0.6s, height 0.6s;
  transform: translate(-50%, -50%);
}

.btn-principal:hover::before { width: 300px; height: 300px; }
.btn-principal:hover { transform: translateY(-2px); box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2); }
.btn-principal:active { transform: translateY(0); }

.btn-principal.loading { color: transparent !important; pointer-events: none; }
.btn-principal.loading::after {
  content: "";
  width: 20px; height: 20px;
  border: 3px solid #fff; border-top-color: transparent;
  border-radius: 50%;
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.btn-secundario {
  width: 100%;
  height: 54px;
  border-radius: 15px;
  border: 2px solid var(--accent-blue);
  background: transparent;
  color: var(--accent-blue);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 5px 15px rgba(110, 136, 155, 0.10);
  margin: 1rem 0;
}

.btn-secundario:hover {
  background: var(--accent-blue);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(110, 136, 155, 0.30);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  border: 2px solid var(--stone);
  border-radius: 15px;
  background: #ffffff;
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  margin: 1rem 0;
  min-height: 54px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-google:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 8px 25px rgba(110, 136, 155, 0.20);
  transform: translateY(-2px);
  background: var(--off-white);
}

.btn-google i,
.btn-google .fab {
  margin-right: 10px;
  color: var(--accent-blue);
  font-size: 1.2rem;
}

.hr-text {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 15px;
  margin: 1.5rem 0;
  color: var(--text-light);
  font-size: 0.9rem;
}

.hr-text::before,
.hr-text::after {
  content: "";
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--stone), transparent);
  display: block;
}

.login-alt {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.95rem;
}

.login-alt a {
  color: var(--accent-blue);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.login-alt a:hover {
  color: var(--olive);
  text-decoration: underline;
}

.errorlist {
  list-style: none;
  margin: 8px 0 0 0;
  padding: 0;
  color: var(--error-color);
  font-size: 0.85rem;
  font-weight: 600;
}

.errorlist li {
  margin: 4px 0;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--error-color);
}

.errorlist li::before { content: "⚠ "; margin-right: 4px; }

.helptext {
  display: block;
  margin-top: 8px;
  color: var(--text-light);
  font-size: 0.85rem;
}

.helptext a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.helptext a:hover {
  color: var(--olive);
  text-decoration: underline;
}

.notification {
  position: fixed;
  top: 20px; right: 20px;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: slideInFromRight 0.4s ease;
  font-weight: 600;
  max-width: 300px;
}

.notification.success { background: var(--success-color); color: #ffffff; }
.notification.error { background: var(--error-color); color: #ffffff; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 18px 20px 12px 20px;
    border: 2px solid var(--stone);
    border-radius: 15px;
    font-size: 1rem;
    color: var(--text-dark);
    background: var(--off-white);
    outline: none;
    transition: var(--transition);
    min-height: 56px;
}

.password-wrapper { position: relative; }

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  padding-right: 48px;
}

.password-wrapper .toggle-password {
  position: absolute;
  right: 12px;
  top: 50% !important;
  bottom: auto !important;
  transform: translateY(calc(-50% + 18px));
  width: 36px;
  height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-light); z-index: 2;
}

.password-wrapper .toggle-password:hover { color: var(--accent-blue); }
.password-wrapper .toggle-password:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

.password-wrapper input[type="password"]::-ms-reveal,
.password-wrapper input[type="password"]::-ms-clear { display: none; width: 0; height: 0; }
.password-wrapper input::-webkit-textfield-decoration-container,
.password-wrapper input::-webkit-clear-button,
.password-wrapper input::-webkit-credentials-auto-fill-button,
.password-wrapper input::-webkit-contacts-auto-fill-button {
  display: none !important; visibility: hidden !important; pointer-events: none !important;
}

#loginForm .password-wrapper { position: relative; }

#loginForm .password-wrapper input[type="password"],
#loginForm .password-wrapper input[type="text"] {
  padding-right: 48px;
}

#loginForm .password-wrapper .toggle-password {
  position: absolute;
  right: 12px;
  top: 50% !important;
  bottom: auto !important;
  transform: translateY(calc(-50% + 18px));
  width: 36px;
  height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-light); z-index: 2;
}

#loginForm .password-wrapper .toggle-password:hover { color: var(--accent-blue); }
#loginForm .password-wrapper .toggle-password:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

#loginForm .password-wrapper input[type="password"]::-ms-reveal,
#loginForm .password-wrapper input[type="password"]::-ms-clear {
  display: none; width: 0; height: 0;
}
#loginForm .password-wrapper input::-webkit-textfield-decoration-container,
#loginForm .password-wrapper input::-webkit-clear-button,
#loginForm .password-wrapper input::-webkit-credentials-auto-fill-button,
#loginForm .password-wrapper input::-webkit-contacts-auto-fill-button {
  display: none !important; visibility: hidden !important; pointer-events: none !important;
}

@keyframes slideInFromRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 768px) {
  .auth-wrapper { padding: 1rem 0.5rem; }
  .login-container { flex-direction: column; max-width: 400px; min-height: auto; }
  .visual-panel { padding: 2rem 1.5rem; min-height: 200px; }
  .panel-content h2 { font-size: 1.8rem; }
  .panel-content p { font-size: 1rem; }
  .form-section { padding: 2rem 1.5rem; }
  .login-title { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  .auth-wrapper { padding: 0.5rem; }
  .login-container { border-radius: 16px; }
  .form-section { padding: 1.5rem 1rem; }
  .visual-panel { padding: 1.5rem 1rem; }
}
