/* ═══════════════════════════════════════════
   Login Modal — Modern Glass Design
   ═══════════════════════════════════════════ */

:root {
  --lm-bg: #0a0a0a;
  --lm-surface: #111111;
  --lm-surface2: #1a1a1a;
  --lm-text: #ffffff;
  --lm-muted: #a0a0a0;
  --lm-border: #2a2a2a;
  --lm-primary: #22c55e;
  --lm-primary-glow: rgba(34, 197, 94, 0.25);
  --lm-success: #22c55e;
  --lm-danger: #ef4444;
  --lm-google-bg: #ffffff;
  --lm-google-text: #1f2937;
  --lm-radius: 16px;
}

/* ── Overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2500;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: flex-end;
  align-items: stretch;
}

.modal-overlay.show {
  display: flex;
}

body.modal-open {
  overflow: hidden;
}

/* ── Modal Card — Right Side Panel ── */
.login-modal {
  width: min(400px, 90vw);
  height: 100vh;
  background: var(--lm-surface);
  border-radius: 0;
  border-left: 1px solid var(--lm-border);
  padding: 0;
  box-shadow:
    -4px 0 30px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow-y: auto;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Close Button ── */
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: rgba(255,255,255,0.06);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  color: var(--lm-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--lm-danger);
}

/* ── Header ── */
.login-header {
  text-align: center;
  padding: 28px 24px 0;
}

.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--lm-primary), #16a34a);
  border-radius: 14px;
  color: #fff;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px var(--lm-primary-glow);
}

.login-modal h2 {
  margin: 0 0 4px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--lm-text);
}

.modal-subtitle {
  margin: 0;
  color: var(--lm-muted);
  font-size: 0.92rem;
}

/* ── Form Container ── */
#loginForm {
  padding: 20px 24px 24px;
}

/* ── Divider ── */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--lm-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--lm-border);
}

/* ── Name Input ── */
.name-input-group {
  margin-bottom: 4px;
}

.name-input-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--lm-border);
  border-radius: 10px;
  background: var(--lm-bg);
  color: var(--lm-text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.name-input-group input:focus {
  border-color: var(--lm-primary);
  box-shadow: 0 0 0 3px var(--lm-primary-glow);
}

.name-input-group input::placeholder {
  color: #4b5563;
}

/* ── Field Label ── */
.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--lm-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

/* ── Login Methods ── */
.login-methods {
  display: grid;
  gap: 0;
}

/* ── Google Button ── */
.google-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid #dadce0;
  border-radius: 10px;
  background: var(--lm-google-bg);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.google-card:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.google-card:active {
  transform: translateY(0);
}

.google-icon {
  flex-shrink: 0;
}

.google-card .method-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lm-google-text);
  margin: 0;
}

/* ── OTP Card ── */
.method-card.otp-card {
  border: 1px solid var(--lm-border);
  border-radius: 12px;
  padding: 16px;
  background: var(--lm-bg);
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.otp-card input[type="email"] {
  width: 100%;
  border: 1px solid var(--lm-border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.95rem;
  margin-top: 4px;
  margin-bottom: 8px;
  background: var(--lm-surface);
  color: var(--lm-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.otp-card input[type="email"]:focus {
  border-color: var(--lm-primary);
  box-shadow: 0 0 0 3px var(--lm-primary-glow);
}

.otp-card input[type="email"]::placeholder {
  color: #4b5563;
}

/* ── Send OTP Button ── */
.send-otp-btn {
  width: 100%;
  margin-bottom: 12px;
  border: 1px solid var(--lm-primary);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--lm-primary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.send-otp-btn:hover {
  background: var(--lm-primary);
  color: #fff;
  box-shadow: 0 2px 12px var(--lm-primary-glow);
}

.send-otp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── OTP Digits ── */
.otp-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.otp-row .otp-digit {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 12px 0;
  border: 1px solid var(--lm-border);
  border-radius: 10px;
  background: var(--lm-surface);
  color: var(--lm-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.otp-row .otp-digit:focus {
  border-color: var(--lm-primary);
  box-shadow: 0 0 0 3px var(--lm-primary-glow);
}

/* ── Hints & Messages ── */
.mode-hint {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--lm-muted);
  min-height: 1.2rem;
}

.form-error,
.form-success {
  margin: 4px 0 0;
  min-height: 1.2rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.form-error {
  color: var(--lm-danger);
}

.form-success {
  color: var(--lm-success);
}

/* ── Submit Button ── */
.submit-btn {
  width: 100%;
  margin-top: 10px;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 0.96rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--lm-primary), #16a34a);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px var(--lm-primary-glow);
}

.submit-btn:hover {
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(0);
}

/* ── Active / Inactive States ── */
.mode-google .google-card,
.mode-otp .otp-card {
  border-color: var(--lm-primary);
  box-shadow: 0 0 0 3px var(--lm-primary-glow);
}

.mode-google .otp-card {
  opacity: 0.4;
  pointer-events: none;
}

.mode-google .otp-card input {
  background: var(--lm-surface2);
  cursor: not-allowed;
}

.mode-otp .google-card {
  opacity: 0.4;
  pointer-events: none;
}

/* When Google mode — hide name input (name comes from Google) */
.mode-google .name-input-group {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .login-modal {
    border-radius: 12px;
  }

  .login-header {
    padding: 22px 18px 0;
  }

  #loginForm {
    padding: 16px 18px 20px;
  }

  .login-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .login-modal h2 {
    font-size: 1.2rem;
  }

  .otp-row {
    gap: 8px;
  }

  .otp-row .otp-digit {
    padding: 10px 0;
    font-size: 1.05rem;
  }
}
