/* davis ai — Auth Mockup Styles (Monochrome / Grayscale)
   Typeface: Inter
   Notes: Accents intentionally unused to preserve grayscale aesthetic. */

:root {
  /* MCP Project Color Palette */
  --bg-primary: #F3F6FB;
  --bg-secondary: #f7f8fa;
  --bg-tertiary: #eef1f5;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent-primary: #5d72de;
  --accent-secondary: #3d52ba;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --loading-color: #fbbf24;
  --user-bg: #667df2;
  --user-text: #ffffff;
  --ai-bg: #f3f4f6;
  --ai-text: #374151;
  
  /* Button variables */
  --btn-primary-bg: var(--accent-primary);
  --btn-primary-hover: var(--accent-secondary);
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: #f3f4f6;
  --hover-bg: #e5e7eb;
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Dark theme support */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --accent-primary: #3d52ba;
  --accent-secondary: #5d72de;
  --border-color: #475569;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --user-bg: #112276;
  --ai-bg: #334155;
  --ai-text: #e2e8f0;
  --btn-primary-bg: var(--accent-primary);
  --btn-primary-hover: #5d72de;
  --btn-secondary-bg: var(--bg-tertiary);
  --hover-bg: var(--border-color);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text-primary);
  background: var(--bg-primary) !important;
  background-image: none !important;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-shell {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}

.auth-header { text-align: center; margin-bottom: 24px; }
.logo { display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }

.login-pf-page{
  padding-top: 0px !important;
}

.login-pf-page .btn-primary {
  margin-top: 12px !important;
}

#kc-logo {
  width: 200px;
  height: 100px;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  object-fit: contain;
}

.logo {
  display: flex !important;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.logo img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.kc-form-options {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.signup-text {
  color: var(--text-secondary);
  font-size: 14px;
}

.signup-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.signup-link:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

/* Hide PatternFly validation indicators */
.pf-c-form-control::before,
.pf-c-form-control::after,
.pf-m-error::before,
.pf-m-error::after {
  display: none !important;
}

.pf-c-form-control.pf-m-error {
  background: transparent !important;
}

/* Error state overrides - ONLY when aria-invalid is explicitly set to true */
/* Do NOT use :invalid pseudo-class as it triggers on empty required fields */
.auth-form input[aria-invalid="true"],
.auth-form input[aria-invalid="true"]:hover,
.auth-form input[aria-invalid="true"]:focus,
input.pf-c-form-control.pf-m-error,
input.pf-c-form-control.pf-m-error:hover,
input.pf-c-form-control.pf-m-error:focus,
.pf-c-form-control.pf-m-error,
.pf-c-form-control.pf-m-error:hover,
.pf-c-form-control.pf-m-error:focus,
input.pf-m-error,
input.pf-m-error:hover,
input.pf-m-error:focus {
  background: var(--bg-secondary) none !important;
  background-image: none !important;
  background-repeat: no-repeat !important;
  background-position: 0 0 !important;
  background-size: 0 0 !important;
  border-color: var(--error-color) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08) !important;
}

/* Prevent red borders on empty required fields */
input:invalid:placeholder-shown,
input:required:placeholder-shown {
  border-color: var(--border-color) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* Ultra-specific nukes for username/password fields to beat any cascade */
.auth-card #username[aria-invalid="true"],
.auth-card #username.pf-m-error,
.auth-card #password[aria-invalid="true"],
.auth-card #password.pf-m-error,
.login-pf-page #username[aria-invalid="true"],
.login-pf-page #password[aria-invalid="true"] {
  background: var(--bg-secondary) none !important;
  background-image: none !important;
  background-position: 0 0 !important;
  background-size: 0 0 !important;
}

/* Bootstrap/PatternFly legacy: remove tiled exclamation from .has-error .form-control */
.has-error .form-control,
.has-error .form-control:hover,
.has-error .form-control:focus {
  background: var(--bg-secondary) none !important;
  background-image: none !important;
  background-repeat: no-repeat !important;
  background-position: 0 0 !important;
  background-size: 0 0 !important;
  border-color: var(--error-color) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08) !important;
}

/* Error message styling - only for actual errors */
#input-error,
.pf-c-form__helper-text.pf-m-error,
.error-text,
.alert-error .kc-feedback-text {
  color: var(--error-color) !important;
  font-size: 12px;
  margin-top: 4px;
}

/* Success message text - inherit from parent alert */
.alert-success .kc-feedback-text {
  color: inherit !important;
}

/* Warning message text - inherit from parent alert */
.alert-warning .kc-feedback-text {
  color: inherit !important;
}

/* Info message text - inherit from parent alert */
.alert-info .kc-feedback-text {
  color: inherit !important;
}

.auth-title {
  margin: 8px 0 4px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text-primary);
}

#signin-title,
#signup-title,
#update-password-title,
#reset-password-title {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.auth-subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Form actions */
.form-actions {
  margin-top: 8px;
}

/* Back to login link */
.back-to-login {
  display: block;
  text-align: center;
  margin-top: 16px;
}

.back-to-login a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 150ms ease;
}

.back-to-login a:hover {
  color: var(--text-primary);
}

.back-to-login svg {
  flex-shrink: 0;
}

.auth-form { display: grid; gap: 12px; }

.field-group { display: grid; gap: 8px; }
.field-group label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.label-row { display: flex; align-items: center; justify-content: space-between; }
.label-row label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* Input with right icon */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 40px; }
.show-toggle,
.show-toggle-confirm {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
}
.show-toggle:hover,
.show-toggle-confirm:hover { color: var(--text-primary); background: var(--hover-bg); }
.show-toggle:focus,
.show-toggle-confirm:focus { outline: none; box-shadow: 0 0 0 3px rgba(93, 114, 222, 0.1); }

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 10px 12px;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input::placeholder { color: var(--text-muted); }

input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(93, 114, 222, 0.1);
}

.btn-primary {
  height: 44px;
  border: 1px solid var(--btn-primary-bg);
  border-radius: var(--radius-md);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 100ms ease, box-shadow 120ms ease, opacity 120ms ease;
}
.btn-primary:hover { background: var(--btn-primary-hover); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-md); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Ensure active/focus states use the same color as hover (override PF blue) */
.btn-primary.active,
.btn-primary:active,
.btn-primary:focus:active,
.btn-primary:focus,
.btn-primary:hover,
.open .dropdown-toggle.btn-primary {
  background: var(--btn-primary-hover) !important;
  background-color: var(--btn-primary-hover) !important;
  background-image: none !important;
  border-color: var(--btn-primary-hover) !important;
}

/* Explicitly target the Sign In button to avoid upstream blue (#63b5e0) */
#kc-login.btn-primary,
#kc-login.btn-primary:hover,
#kc-login.btn-primary:focus,
#kc-login.btn-primary:active,
#kc-login.btn-primary:focus:active {
  background: #3d52ba !important;
  background-color: #3d52ba !important;
  background-image: none !important;
  border-color: #3d52ba !important;
}

/* Secondary action */
.btn-secondary {
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--btn-secondary-bg);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
}
.btn-secondary:hover { background: var(--hover-bg); border-color: var(--accent-primary); }
.btn-secondary:active { background: var(--hover-bg); }

.supporting { text-align: center; margin-top: -4px; }
.link-muted { color: var(--text-secondary); text-decoration: none; font-size: 13px; }
.link-muted:hover { color: var(--text-primary); text-decoration: underline; }

/* Remember + forgot row */
.meta-row { display: flex; align-items: center; justify-content: space-between; margin-top: -4px; }
.remember { display: inline-flex; align-items: center; gap: 8px; color: var(--text-primary); font-size: 13px; }
.remember input { width: 16px; height: 16px; border-radius: 4px; }

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 0 4px;
}

.social-row { display: block; margin-top: 4px; }
.btn-social {
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center; /* centers the text */
  width: 100%;
  padding: 0 12px 0 44px; /* leave space for left icon */
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn-social:hover { border-color: var(--accent-primary); background: var(--hover-bg); }
.social-ico {
  position: absolute; left: 12px;
  width: 20px; height: 20px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-primary); color: var(--btn-primary-text); font-size: 11px; font-weight: 700;
}
.social-text { font-size: 14px; font-weight: 600; }

.auth-footer { margin-top: 24px; text-align: center; color: var(--text-secondary); font-size: 12px; }
.foot-note { margin: 0; }

/* Password Update Page Styles */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  background: var(--bg-primary);
}

.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.logo-main {
  width: 180px;
  height: auto;
  display: block;
}

#update-password-title {
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 8px;
}

.auth-subtitle {
  text-align: center;
  margin-bottom: 20px;
}

/* Password Requirements */
.password-requirements {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 8px 0 16px;
}

.requirements-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 10px;
}

.requirements-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.requirements-list li {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.requirements-list li .req-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 10px;
  color: var(--text-muted);
}

.requirements-list li.met {
  color: var(--success-color);
}

.requirements-list li.met .req-icon {
  color: var(--success-color);
  font-weight: 600;
}

/* Alert messages for update password */
.alert-warning,
.alert-error,
.alert-success,
.alert-info {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #b45309;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.alert-success {
  background: #10b981;
  border: 1px solid #059669;
  color: #ffffff !important;
}

.alert-success .kc-feedback-text {
  color: #ffffff !important;
}

.alert-success span {
  color: #ffffff !important;
}

.alert-info {
  background: rgba(93, 114, 222, 0.1);
  border: 1px solid rgba(93, 114, 222, 0.3);
  color: var(--accent-primary);
}

/* Responsive polish */
@media (max-width: 420px) {
  .auth-card { padding: 24px; }
  .auth-wrapper { padding: 16px; }
}
