/**
 * MCP auth-web — matches webapp `apps/web/src/core/index.css` tokens + `auth/Login.css` layout
 * (Pulivarthi Group / PG login: split view, top bar, card, primary gradient, OTP styles).
 * Background: `images/login-background.png` (copied from webapp public)
 */
:root {
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color-scheme: light;
  --color-primary: #2187bd;
  --color-primary-dark: #6e6f71;
  --color-primary-light: #3b82f6;
  --gradient-primary: linear-gradient(135deg, #2187bd 0%, #6e6f71 100%);
  --color-success: #10b981;
  --color-error: #dc2626;
  --color-text-primary: #1f2937;
  --color-text-secondary: #6b7280;
  --color-border: #e5e7eb;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
}

/* Main page layout */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-primary);
  background-image: url("images/login-background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  position: relative;
}

.login-page::before {
  display: none;
}

.login-split-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 80px);
  width: 100%;
  position: relative;
  z-index: 2;
}

@media (max-width: 768px) {
  .login-split-container {
    grid-template-columns: 1fr;
  }

  .login-left-side {
    display: none;
  }

  .login-right-side {
    padding: 20px;
  }

  .login-container {
    padding: 0 20px;
    max-width: 100%;
  }

  .top-bar {
    height: 60px;
    padding: 0 16px;
  }

  .top-logo {
    height: 50%;
    margin-left: 16px;
  }
}

.login-left-side {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  width: 100%;
  height: 100%;
}

.login-background-overlay {
  display: none;
}

.login-right-side {
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.top-bar {
  width: 100%;
  height: 80px;
  background: white;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  position: relative;
}

.top-bar-link {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 16px;
  background: transparent;
  border: 1px solid #667eea;
  color: #667eea;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: auto;
  min-width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  box-sizing: border-box;
}

.top-bar-link:hover {
  background: #667eea;
  color: white;
}

.top-logo {
  height: 70%;
  width: auto;
  margin-left: 30px;
  object-fit: contain;
}

.login-container {
  width: 100%;
  max-width: 500px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h2 {
  margin-bottom: 8px !important;
  font-size: 24px !important;
  font-weight: 700 !important;
  color: #1a202c;
}

.login-header p {
  color: #64748b;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}

.form-group:last-of-type {
  margin-bottom: 28px;
}

.form-group label {
  color: #374151;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 16px;
  background: white;
  color: #111 !important;
  caret-color: #111 !important;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  -webkit-text-fill-color: #111 !important;
  line-height: 1.5;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.password-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input {
  width: 100%;
  padding-right: 45px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  color: #6b7280;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
}

.password-toggle:hover {
  background-color: #f3f4f6;
  color: #374151;
}

.password-toggle:active {
  background-color: #e5e7eb;
  transform: translateY(-50%) scale(0.95);
}

.password-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.error-message,
.config-error {
  background: #fff5f5;
  color: #c53030;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid #fecaca;
  margin-bottom: 20px;
  line-height: 1.5;
}

.neutral-hint {
  background: #f0f9ff;
  color: #0c4a6e;
  border: 1px solid #bae6fd;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.login-button {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.5;
  font-family: inherit;
  box-sizing: border-box;
}

.login-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.22);
}

.login-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

input:-webkit-autofill {
  -webkit-text-fill-color: #111 !important;
  box-shadow: 0 0 0px 1000px white inset !important;
}

.otp-verification {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 8px 0;
  width: 100%;
}

.otp-header {
  text-align: center;
  margin-bottom: 30px;
}

.otp-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 10px 0;
}

.otp-header p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  word-break: break-word;
}

.otp-header strong {
  color: #1f2937;
}

.otp-input-full {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.35em;
}

.otp-input-full::placeholder {
  letter-spacing: normal;
  font-weight: 400;
  font-size: 15px;
}

.otp-info {
  width: 100%;
  margin-bottom: 20px;
}

.otp-error {
  background-color: #fee2e2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  width: 100%;
  text-align: center;
  font-size: 14px;
}

.otp-success {
  background-color: #d1fae5;
  border: 2px solid #10b981;
  color: #065f46;
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  width: 100%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.otp-success-icon {
  background-color: #10b981;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  flex-shrink: 0;
}

.otp-success-message {
  text-align: left;
}

.otp-success-message strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
  color: #065f46;
}

.otp-success-message p {
  margin: 0;
  font-size: 14px;
  color: #047857;
}

.otp-verify-button {
  width: 100%;
  padding: 12px 24px;
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-bottom: 12px;
  font-family: inherit;
  box-sizing: border-box;
}

.otp-verify-button:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
}

.otp-verify-button:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.otp-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.otp-resend-button,
.otp-cancel-button {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
}

.otp-resend-button {
  background-color: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.otp-resend-button:hover:not(:disabled) {
  background-color: #eff6ff;
}

.otp-resend-button:disabled {
  color: #9ca3af;
  border-color: #d1d5db;
  cursor: not-allowed;
}

.otp-cancel-button {
  background-color: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

.otp-cancel-button:hover:not(:disabled) {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.social-login-section {
  margin: 24px 0 0 0;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0 12px;
  color: #6b7280;
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}

.divider span {
  padding: 0 16px;
}

.google-signin-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  box-sizing: border-box;
}

.google-signin-btn:hover:not(:disabled) {
  background: #f9fafb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.google-signin-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mcp-token-box {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-all;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 12px 14px;
  border-radius: 8px;
  max-height: 140px;
  overflow: auto;
  width: 100%;
  text-align: left;
  color: #111;
  box-sizing: border-box;
  margin: 0 0 12px 0;
}

.mcp-page-footer {
  text-align: center;
  color: #64748b;
  font-size: 12px;
  max-width: 500px;
  margin: 24px auto 0;
  padding: 0 20px 32px;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

/* Responsive (match webapp) */
@media (max-width: 968px) {
  .login-split-container {
    grid-template-columns: 1fr;
  }

  .login-left-side {
    display: none;
  }
}

@media (max-width: 768px) {
  .login-container {
    padding: 0 20px;
  }

  .login-card {
    padding: 36px 28px;
    max-width: 100%;
  }

  .login-header {
    margin-bottom: 28px;
  }
}
