/* ============================================================
   CADITECH ADMIN DASHBOARD - AUTHENTICATION & SECURITY CSS
   Enterprise Modern Dark Mode Login & Animated Security Gateway
   ============================================================ */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(15, 23, 42, 0.94) 0%, rgba(2, 6, 23, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
  padding: 24px;
  overflow: hidden;
}

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

/* ─────────────────────────────────────────────────────────────
   AMBIENT FLOATING GLOW ORBS
   ───────────────────────────────────────────────────────────── */
.auth-ambient-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.6;
}

.auth-glow-1 {
  width: 480px;
  height: 480px;
  top: -100px;
  left: calc(50% - 380px);
  background: radial-gradient(circle, rgba(14, 165, 233, 0.3) 0%, rgba(14, 165, 233, 0) 70%);
  animation: float-glow-1 12s ease-in-out infinite alternate;
}

.auth-glow-2 {
  width: 520px;
  height: 520px;
  bottom: -120px;
  right: calc(50% - 400px);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, rgba(99, 102, 241, 0) 70%);
  animation: float-glow-2 14s ease-in-out infinite alternate;
}

.auth-glow-3 {
  width: 360px;
  height: 360px;
  top: calc(50% - 180px);
  left: calc(50% - 180px);
  background: radial-gradient(circle, rgba(236, 72, 153, 0.16) 0%, rgba(236, 72, 153, 0) 70%);
  animation: float-glow-3 10s ease-in-out infinite alternate;
}

@keyframes float-glow-1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.1); }
  100% { transform: translate(-20px, 50px) scale(0.95); }
}

@keyframes float-glow-2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -30px) scale(1.12); }
  100% { transform: translate(30px, -40px) scale(0.92); }
}

@keyframes float-glow-3 {
  0% { transform: scale(0.9) opacity(0.4); }
  50% { transform: scale(1.2) opacity(0.7); }
  100% { transform: scale(1) opacity(0.5); }
}

/* ─────────────────────────────────────────────────────────────
   LOGIN MODAL CARD
   ───────────────────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.85),
              0 0 50px -10px rgba(14, 165, 233, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 46px 40px 42px;
  position: relative;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}

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

/* Animated top glowing line */
.auth-card-border-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8 0%, #6366f1 45%, #ec4899 85%, #38bdf8 100%);
  background-size: 200% 100%;
  animation: border-shimmer 6s linear infinite;
}

@keyframes border-shimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* Card shake animation on error */
.auth-card.auth-shake {
  animation: auth-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

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

/* ─────────────────────────────────────────────────────────────
   HEADER & LOGO PULSE
   ───────────────────────────────────────────────────────────── */
.auth-header {
  text-align: center;
  margin-bottom: 28px;
  position: relative;
}

.auth-logo-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.2), inset 0 0 15px rgba(56, 189, 248, 0.1);
}

.auth-logo-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 24px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  opacity: 0;
  animation: logo-pulse 3s ease-out infinite;
  pointer-events: none;
}

@keyframes logo-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

.auth-logo-img {
  width: 52px;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.5));
  transition: transform 0.3s ease;
}

.auth-logo-wrapper:hover .auth-logo-img {
  transform: scale(1.06);
}

.auth-title {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #ffffff;
  margin: 0 0 6px 0;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  font-size: 13px;
  color: #94a3b8;
  letter-spacing: 0.02em;
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────
   ALERT BANNER
   ───────────────────────────────────────────────────────────── */
.auth-alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.12);
  animation: auth-alert-fade 0.25s ease;
}

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

.auth-alert.hidden {
  display: none !important;
}

.auth-alert-icon {
  flex-shrink: 0;
  color: #ef4444;
}

/* ─────────────────────────────────────────────────────────────
   FORM & MODERN INPUTS WITH ICONS
   ───────────────────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.auth-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: color 0.2s ease;
}

.auth-input-wrapper:focus-within .auth-input-icon {
  color: #38bdf8;
}

.auth-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 13px 16px;
  color: #f8fafc;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  outline: none;
}

.auth-input.with-icon {
  padding-left: 44px;
}

.auth-input.with-toggle {
  padding-right: 46px;
}

.auth-input::placeholder {
  color: #475569;
}

.auth-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px #38bdf8, 0 0 20px rgba(56, 189, 248, 0.2);
  background: rgba(15, 23, 42, 0.95);
}

/* Modern Eye Toggle Button */
.auth-toggle-pwd {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 7px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

.auth-toggle-pwd:hover {
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.1);
}

.auth-toggle-pwd:active {
  transform: scale(0.92);
}

.auth-toggle-pwd svg {
  pointer-events: none;
}

/* Remember me option */
.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #94a3b8;
  margin-top: -4px;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.auth-remember input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.auth-remember input[type="checkbox"]:checked {
  background: #0284c7;
  border-color: #38bdf8;
}

.auth-remember input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ─────────────────────────────────────────────────────────────
   ANIMATED SUBMIT BUTTON
   ───────────────────────────────────────────────────────────── */
.auth-btn-submit {
  position: relative;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #4f46e5 100%);
  background-size: 200% auto;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  overflow: hidden;
}

.auth-btn-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transition: transform 0.65s ease;
}

.auth-btn-submit:hover .auth-btn-shimmer {
  transform: translateX(200%);
}

.auth-btn-submit:hover {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.5), 0 0 30px rgba(14, 165, 233, 0.3);
}

.auth-btn-submit:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.auth-btn-submit.loading {
  opacity: 0.85;
  pointer-events: none;
}

.auth-spinner {
  width: 18px;
  height: 18px;
  animation: auth-spin 0.8s linear infinite;
}

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

/* ─────────────────────────────────────────────────────────────
   USER PROFILE IN HEADER & SIDEBAR
   ───────────────────────────────────────────────────────────── */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 12.5px;
  color: #e2e8f0;
}

.user-profile-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.4);
}
