/* === LOGIN PAGE - Interactive & User-Friendly === */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: #2d1b4e;
  color: #fff;
  min-height: 100vh;
}

.login-container {
  display: flex;
  min-height: 100vh;
  flex-wrap: wrap;
}

/* --- Left panel (brand) --- */
.left-panel {
  flex: 1 1 45%;
  min-height: 40vh;
  background: linear-gradient(135deg, #4b2e83 0%, #2d1b4e 50%, #1a0f2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.brand-content {
  text-align: center;
  max-width: 360px;
}

.brand-content h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.brand-content p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin: 0;
  font-weight: 500;
}

/* --- Right panel (form) --- */
.right-panel {
  flex: 1 1 55%;
  min-height: 60vh;
  background-color: #fff;
  color: #333;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-wrapper {
  width: 100%;
  max-width: 400px;
}

.form-wrapper h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.3;
}

.form-wrapper h2 span {
  color: #4b2e83;
}

.subtitle {
  color: #666;
  font-size: 0.95rem;
  margin: 0 0 28px;
}

/* --- Form message (success / error) --- */
.form-message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 20px;
  display: none;
  transition: opacity 0.2s ease;
}

.form-message.visible {
  display: block;
}

.form-message.success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.form-message.error {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* --- Form fields --- */
form {
  display: flex;
  flex-direction: column;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: #333;
}

.field input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background-color: #fafafa;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.field input::placeholder {
  color: #999;
}

.field input:hover {
  border-color: #ccc;
  background-color: #fff;
}

.field input:focus {
  border-color: #4b2e83;
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(75, 46, 131, 0.15);
}

.field input.error {
  border-color: #c62828;
  background-color: #fff5f5;
}

.field input.error:focus {
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.15);
}

/* Password wrapper (input + toggle) */
.password-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.password-wrap input {
  padding-right: 48px;
  flex: 1;
}

.toggle-password {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: calc(100% - 8px);
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.toggle-password:hover {
  color: #4b2e83;
  background-color: rgba(75, 46, 131, 0.08);
}

.toggle-password:focus {
  outline: none;
  color: #4b2e83;
}

/* Eye icons (show / hide password) */
.icon-eye,
.icon-eye-off {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.icon-eye {
  width: 22px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50% 50% 0 0;
  margin-top: -4px;
}

.icon-eye::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.icon-eye-off {
  width: 22px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50% 50% 0 0;
  margin-top: -4px;
  display: none;
}

.icon-eye-off::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 2px;
  background: currentColor;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  border-radius: 1px;
}

.toggle-password[aria-pressed="true"] .icon-eye {
  display: none;
}

.toggle-password[aria-pressed="true"] .icon-eye-off {
  display: inline-block;
}

/* Field error text */
.field-error {
  display: block;
  font-size: 0.85rem;
  color: #c62828;
  margin-top: 6px;
  min-height: 1.2em;
}

/* Caps lock warning */
.caps-warning {
  display: none;
  font-size: 0.85rem;
  color: #e65100;
  margin-top: 6px;
}

.caps-warning.visible {
  display: block;
}

/* --- Options row --- */
.options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: #555;
  user-select: none;
}

.remember input {
  width: 18px;
  height: 18px;
  accent-color: #4b2e83;
  cursor: pointer;
}

.remember:hover {
  color: #333;
}

.forgot-link {
  color: #4b2e83;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.forgot-link:hover {
  color: #6a4a9e;
  text-decoration: underline;
}

.forgot-link:focus {
  outline: 2px solid #4b2e83;
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Submit button --- */
.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #4b2e83 0%, #6a4a9e 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-login:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(75, 46, 131, 0.35);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
}

.btn-login:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(75, 46, 131, 0.3);
}

.btn-login:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

/* Loading spinner */
.btn-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-login.loading .btn-text {
  visibility: hidden;
  position: absolute;
}

.btn-login.loading .btn-loader {
  display: inline-block;
}

.btn-secondary {
  margin-top: 10px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111827;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
  background: #f9fafb;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(17, 24, 39, 0.08);
}

.btn-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Sign up prompt --- */
.signup-prompt {
  text-align: center;
  margin: 24px 0 0;
  font-size: 0.95rem;
  color: #666;
}

.signup-prompt a {
  color: #4b2e83;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.signup-prompt a:hover {
  color: #6a4a9e;
  text-decoration: underline;
}

/* --- Google sign-in --- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 14px;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  height: 1px;
  background: #e5e7eb;
  flex: 1;
}

.google-auth {
  display: grid;
  gap: 12px;
}

.gsi-button {
  display: flex;
  justify-content: center;
}

.google-auth.loading {
  opacity: 0.85;
  pointer-events: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2000;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  width: min(520px, 100%);
  background: #fff;
  color: #111827;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  border: none;
  background: transparent;
  color: #111827;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
}

.modal-close:hover {
  background: rgba(17, 24, 39, 0.06);
}

.modal-body {
  padding: 18px;
}

.modal-steps {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  font-weight: 700;
  font-size: 0.9rem;
  flex: 1;
  justify-content: center;
}

.step-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.85rem;
}

.step-item.active {
  border-color: rgba(75, 46, 131, 0.35);
  background: rgba(75, 46, 131, 0.06);
  color: #4b2e83;
}

.step-item.active .step-dot {
  background: #4b2e83;
  color: #fff;
}

.step-label {
  white-space: nowrap;
}

.modal-step {
  margin-top: 6px;
}

.modal-hint {
  margin: 0 0 14px;
  color: #4b5563;
  font-size: 0.95rem;
}

.modal-step .form-message {
  margin-bottom: 14px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .login-container {
    flex-direction: column;
  }

  .left-panel {
    min-height: 28vh;
    padding: 32px 24px;
  }

  .brand-content p {
    display: none;
  }

  .right-panel {
    min-height: auto;
    padding: 32px 24px;
    align-items: flex-start;
  }

  .form-wrapper h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .options {
    flex-direction: column;
    align-items: flex-start;
  }
}
