/*
  Phone auth modal styles (based on provided test.php UI).
  Kept scoped to .auth-* to avoid colliding with Bootstrap.
*/

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1055; /* above bootstrap navbar, below toast-like */
  background: rgba(30, 30, 46, 0.48);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.45s ease;
}

.auth-overlay.active {
  opacity: 1;
  visibility: visible;
}

.auth-modal {
  width: 100%;
  max-width: 460px;
  border-radius: 28px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  transform: scale(0.88) translateY(40px);
  transition: all 0.62s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-overlay.active .auth-modal {
  transform: scale(1) translateY(0);
}

.auth-modal__header {
  padding: 2.1rem 2.3rem 1.1rem;
  text-align: center;
  position: relative;
}

.auth-modal__header h2 {
  font-size: 1.95rem;
  font-weight: 800;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 0.35rem;
}

.auth-modal__header p {
  margin: 0;
  color: #64748b;
  font-size: 0.98rem;
}

.auth-close {
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.25s;
  line-height: 1;
}

.auth-close:hover {
  color: #6366f1;
  transform: rotate(90deg) scale(1.12);
}

.auth-modal__body {
  padding: 0 2.6rem 2.5rem;
  position: relative;
  min-height: 380px;
}

.auth-step {
  position: absolute;
  inset: 0;
  padding-bottom: 1.25rem;
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.45s ease;
  pointer-events: none;
}

.auth-step.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
  position: relative;
}

.auth-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 1.35rem;
  text-align: center;
}

.auth-subtitle {
  text-align: center;
  color: #475569;
  margin: -0.75rem 0 1.25rem;
}

.auth-input {
  display: flex;
  align-items: center;
  background: rgba(240, 240, 255, 0.72);
  border-radius: 16px;
  height: 56px;
  padding: 0 1.3rem 0 1.4rem;
  margin-bottom: 0.65rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(10px);
  position: relative;
  transition: all 0.25s ease;
  isolation: isolate;
}

.auth-input:focus-within {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
  transform: translateY(-1px);
}

.auth-input i {
  color: #8b5cf6;
  font-size: 1.15rem;
  margin-right: 0.85rem;
  flex-shrink: 0;
}

.auth-prefix {
  color: #64748b;
  font-size: 1.05rem;
  font-weight: 600;
  margin-right: 0.85rem;
  flex-shrink: 0;
}

.auth-input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  outline: none;
  padding: 0;
  font-size: 1.05rem;
  color: #0f172a;
}

.auth-input--code {
  height: 64px;
  background: rgba(245, 245, 255, 0.58);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
  padding: 0 1.5rem;
}

.auth-input--code i {
  font-size: 1.25rem;
  color: #7c3aed;
  margin-right: 1rem;
}

.auth-input--code input {
  font-size: 1.45rem;
  letter-spacing: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.auth-error {
  min-height: 22px;
  font-size: 0.92rem;
  color: #ef4444;
  margin: 0 0 0.95rem;
  text-align: left;
}

.auth-consent {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.88rem;
  user-select: none;
  margin: 1.25rem 0 0;
}

.auth-consent input {
  width: 18px;
  height: 18px;
  accent-color: #6366f1;
  flex-shrink: 0;
}

.auth-consent a {
  color: #6366f1;
  text-decoration: none;
}

.auth-consent a:hover {
  text-decoration: underline;
}

.auth-btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 0.95rem 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease;
}

.auth-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-btn--primary {
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  color: #fff;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.25);
}

.auth-btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(99, 102, 241, 0.33);
}

.auth-row {
  display: flex;
  gap: 0.85rem;
  margin-top: 0.25rem;
}

.auth-row .auth-btn {
  width: 50%;
}

.auth-btn--ghost {
  background: rgba(226, 232, 240, 0.9);
  color: #0f172a;
}

.auth-btn--ghost:hover:not(:disabled) {
  transform: translateY(-2px);
}

.auth-btn--success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.2);
}

.auth-btn--success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(34, 197, 94, 0.28);
}

.auth-btn--link {
  margin-top: 0.9rem;
  background: transparent;
  color: #6366f1;
  text-decoration: underline;
  font-weight: 700;
  padding: 0.2rem 0;
}

.auth-timer {
  margin-top: 1rem;
  text-align: center;
  color: #475569;
  font-size: 0.95rem;
}

.auth-alert {
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  font-size: 0.95rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

.auth-alert.success {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.auth-alert.error {
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
}

/* Snake / shake error feedback */
.auth-input.error {
  animation: auth-shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.auth-input.error::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 18px;
  background: linear-gradient(90deg,
    transparent 0%,
    transparent 20%,
    #ff4757 50%,
    transparent 80%,
    transparent 100%
  );
  filter: blur(0.2px);
  z-index: -1;
  animation: auth-snake 1.8s linear infinite;
}

@keyframes auth-snake {
  0% { transform: translateX(-35%); }
  100% { transform: translateX(35%); }
}

@keyframes auth-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
