/* ==========================================================================
   Hospital AI — Hospital Administration Portal Login Styles
   Matches Executive SaaS Design Language (clean white/light theme, blue accent)
   ========================================================================== */

.login-body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
}

html[dir="rtl"] .login-body {
  font-family: 'Cairo', sans-serif;
}

/* Header Bar */
.login-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.login-brand-mini {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-brand-mini .brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.login-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Centered Main Wrapper */
.login-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

/* Login Card Surface */
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  padding: 2.5rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Card Header */
.login-card-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.login-icon-badge {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
  border: 1px solid var(--border-light);
}

.login-icon-badge .material-symbols-outlined {
  font-size: 32px;
}

.login-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

/* Feedback Alert Banner */
.login-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  line-height: 1.4;
  animation: fadeIn 0.25s ease-out;
}

.login-alert.alert-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.login-alert.alert-success {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.login-alert .alert-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* Form Groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.15rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.forgot-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.forgot-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 20px;
  pointer-events: none;
  transition: color 0.2s ease;
}

html[dir="rtl"] .input-icon-wrap .input-icon {
  left: auto;
  right: 14px;
}

.login-input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  padding: 0 1rem 0 2.75rem;
  font-size: 0.92rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-sizing: border-box;
}

html[dir="rtl"] .login-input {
  padding: 0 2.75rem 0 1rem;
}

.login-input:focus {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-icon-wrap:focus-within .input-icon {
  color: var(--primary);
}

.toggle-password-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

html[dir="rtl"] .toggle-password-btn {
  right: auto;
  left: 12px;
}

.toggle-password-btn:hover {
  color: var(--text-primary);
}

.field-error {
  font-size: 0.78rem;
  color: #dc2626;
  min-height: 16px;
  line-height: 1.3;
}

/* Remember Me */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
}

.remember-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Submit Button */
.login-submit-btn {
  width: 100%;
  height: 48px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.login-submit-btn:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.login-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* Demo Credentials Box */
.demo-credentials-box {
  background: var(--color-surface-soft);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.82rem;
  box-sizing: border-box;
}

.demo-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 0.82rem;
}

.demo-badge .material-symbols-outlined {
  font-size: 16px;
  color: var(--primary);
}

.demo-rows-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.demo-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(217, 229, 238, 0.6);
}

.demo-account-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.demo-account-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.demo-role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  line-height: 1.3;
}

.demo-role-badge.badge-admin {
  background: rgba(11, 109, 255, 0.12);
  color: #0b6dff;
  border: 1px solid rgba(11, 109, 255, 0.25);
}

.demo-role-badge.badge-doctor {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.demo-creds-info {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.demo-chip {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
}

.demo-chip code {
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--color-primary-dark);
  transition: all 0.15s ease;
  user-select: all;
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
}

.demo-chip:hover code {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.demo-chip:active code {
  transform: scale(0.97);
}

.chip-sep {
  color: var(--text-muted);
  font-size: 0.8rem;
  user-select: none;
}

.copy-tooltip {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
  animation: tooltipFade 0.15s ease-out;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  display: none;
}

.demo-chip.copied .copy-tooltip {
  display: block;
}

.copy-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
}

@keyframes tooltipFade {
  from { opacity: 0; transform: translate(-50%, 3px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.btn-fill-demo {
  align-self: center;
  background: var(--bg-card);
  border: 1px solid var(--color-border);
  color: var(--primary);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 145px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-fill-demo:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-fill-demo .material-symbols-outlined {
  font-size: 14px;
}

@media (max-width: 480px) {
  .demo-account-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.45rem 0;
  }
  .demo-account-left {
    justify-content: space-between;
    gap: 0.4rem;
  }
  .btn-fill-demo {
    width: 100%;
    min-width: unset;
  }
}

/* Footer Note */
.login-footer {
  text-align: center;
  padding-top: 0.25rem;
}

.footer-security-note {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.footer-security-note .material-symbols-outlined {
  font-size: 15px;
  color: var(--color-success);
}

/* Android app download link */
.app-download-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.app-download-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.app-download-link .material-symbols-outlined {
  font-size: 18px;
}

.login-footer .app-download-link + .brand-tagline {
  margin-top: 0;
}

/* Recovery Modal Icon */
.reset-info-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff7ed;
  color: #ea580c;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.reset-info-icon-wrap .material-symbols-outlined {
  font-size: 30px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .login-card {
    padding: 2rem 1.25rem;
  }
  .login-header {
    padding: 0 1rem;
  }
}
