/* ============================================
   Patient Login Page — Module 33
   Uses variables from public.css
   ============================================ */

/* --- Page Layout --- */
.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: calc(var(--nav-height) + 24px) 16px 48px;
}
.login-container {
  width: 100%;
  max-width: 420px;
}

/* --- Loading State --- */
.login-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 24px;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Login Card --- */
.login-card {
  padding: 36px 28px;
  text-align: center;
}

/* --- Steps --- */
.login-step {
  display: none;
  animation: loginFadeIn 0.3s ease;
}
.login-step.active { display: block; }

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

/* --- Icon --- */
.login-icon {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: var(--color-accent-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.login-icon-warning {
  background: rgba(255,149,0,0.08);
}

/* --- Typography --- */
.login-title {
  font-family: var(--font);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.login-desc {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* --- Phone Input --- */
.phone-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.phone-input-wrap:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}
.phone-prefix {
  padding: 0 12px;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  height: 48px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
}
.phone-input-wrap input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  height: 48px;
  flex: 1;
  min-width: 0;
}
.phone-input-wrap input:focus {
  border: none !important;
  box-shadow: none !important;
}

/* --- Full-width button --- */
.login-btn-full {
  width: 100%;
  margin-top: 8px;
}

/* --- Divider --- */
.login-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: var(--color-text-tertiary);
  font-size: 0.8125rem;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* --- Google Button --- */
.btn-google {
  background: #fff;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  font-weight: 500;
  margin-top: 8px;
}
.btn-google:hover {
  background: var(--color-surface);
  border-color: #dadce0;
}
.btn-google svg {
  flex-shrink: 0;
}

/* --- New Patient Link --- */
.login-new-patient {
  margin-top: 24px;
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
}
.login-new-patient a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}
.login-new-patient a:hover { text-decoration: underline; }

/* --- OTP Boxes --- */
.otp-boxes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.otp-box {
  width: 48px !important;
  height: 56px;
  padding: 0 !important;
  text-align: center;
  font-size: 1.5rem !important;
  font-weight: 700;
  font-family: var(--font);
  border: 2px solid var(--color-border) !important;
  border-radius: 12px !important;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  caret-color: var(--color-accent);
}
.otp-box:focus {
  border-color: var(--color-accent) !important;
  box-shadow: 0 0 0 3px rgba(0,113,227,0.12) !important;
  outline: none;
}
.otp-box.filled {
  border-color: var(--color-accent) !important;
  background: var(--color-accent-light);
}
.otp-box.error {
  border-color: var(--color-error) !important;
  animation: shake 0.4s ease;
}
.otp-dash {
  font-size: 1.25rem;
  color: var(--color-text-tertiary);
  margin: 0 2px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* --- Resend --- */
.otp-resend {
  margin-top: 16px;
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
}

/* --- Email Sent Confirmation --- */
.login-email-sent {
  padding: 20px;
  background: rgba(52,199,89,0.06);
  border: 1.5px solid var(--color-success);
  border-radius: var(--radius-card);
  margin: 16px 0;
}
.email-sent-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-success);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
  margin: 0 auto 12px;
}
.login-email-sent p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* --- btn-text (if not in public.css) --- */
.btn-text {
  background: none;
  border: none;
  color: var(--color-accent);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
}
.btn-text:hover { text-decoration: underline; }

/* --- Form Label in Login Context --- */
.login-card .form-group {
  text-align: left;
  margin-bottom: 16px;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
  .login-title { font-size: 1.25rem; }
  .otp-box {
    width: 42px !important;
    height: 50px;
    font-size: 1.25rem !important;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .login-step { animation: none; }
  .otp-box.error { animation: none; }
}
