/**
 * TIHSA Protect - Modern Gatekeeper Landing Styles
 * Aesthetic: Clean Modern (shadcn/ui + Tailwind CSS)
 * White Card Theme with Dynamic Animated Dot Matrix Background
 */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --page-bg: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --primary-gradient: linear-gradient(135deg, #0172ef 0%, #2563eb 100%);
  --primary-glow: rgba(1, 114, 239, 0.2);
  --mouse-x: 50%;
  --mouse-y: 50%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--page-bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Background Atmosphere */
.bg-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Animated Floating Glow Orbs */
.mesh-glow-1 {
  position: absolute;
  top: -10%;
  left: 15%;
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, rgba(1, 114, 239, 0.12) 0%, rgba(1, 114, 239, 0) 70%);
  filter: blur(60px);
  border-radius: 50%;
  animation: floatOrb1 18s ease-in-out infinite alternate;
}

.mesh-glow-2 {
  position: absolute;
  bottom: -15%;
  right: 10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0) 70%);
  filter: blur(65px);
  border-radius: 50%;
  animation: floatOrb2 22s ease-in-out infinite alternate;
}

.mesh-glow-3 {
  position: absolute;
  top: 40%;
  left: 60%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.08) 0%, rgba(14, 165, 233, 0) 70%);
  filter: blur(55px);
  border-radius: 50%;
  animation: floatOrb3 15s ease-in-out infinite alternate;
}

/* Dynamic Animated Dot Grid */
.bg-grid {
  position: absolute;
  inset: -56px;
  background-image: radial-gradient(#94a3b8 1.25px, transparent 1.25px);
  background-size: 28px 28px;
  opacity: 0.55;
  animation: gridDrift 24s linear infinite, gridBreathe 7s ease-in-out infinite alternate;
}

/* Interactive Cursor Spotlight over the Dots */
.bg-spotlight {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle 520px at var(--mouse-x) var(--mouse-y), rgba(1, 114, 239, 0.12), transparent 70%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Main Container */
.gate-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
}

/* Card (Clean White Form Background + Smooth Entrance) */
.gate-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  padding: 2.5rem 2.25rem;
  box-shadow: 
    0 20px 40px -15px rgba(0, 0, 0, 0.07),
    0 1px 3px 0 rgba(0, 0, 0, 0.05);
  animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Header & Logo */
.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.logo-container img {
  max-width: 100%;
  height: auto;
  max-height: 52px;
  display: block;
  object-fit: contain;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  margin-bottom: 1rem;
}

.status-dot {
  position: relative;
  display: flex;
  width: 0.5rem;
  height: 0.5rem;
}

.status-dot-ping {
  position: absolute;
  display: inline-flex;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #3b82f6;
  opacity: 0.75;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.status-dot-core {
  position: relative;
  display: inline-flex;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: #2563eb;
}

/* Typography */
.gate-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.gate-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 1.75rem;
}

/* Form Controls (shadcn style) */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  margin-bottom: 0.5rem;
}

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

.input-icon-left {
  position: absolute;
  left: 0.875rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.2s;
}

.gate-input {
  width: 100%;
  padding: 0.75rem 2.75rem 0.75rem 2.6rem;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.625rem;
  color: #0f172a;
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.gate-input:focus {
  outline: none;
  border-color: #0172ef;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(1, 114, 239, 0.18);
}

.gate-input::placeholder {
  color: #94a3b8;
}

.input-btn-toggle {
  position: absolute;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: color 0.15s, background-color 0.15s;
}

.input-btn-toggle:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

/* Remember me (shadcn checkbox) */
.remember-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  background-color: #f8fafc;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.custom-checkbox:checked {
  background-color: #0172ef;
  border-color: #0172ef;
}

.custom-checkbox:checked::before {
  content: "";
  width: 0.5rem;
  height: 0.3rem;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.custom-checkbox:focus-visible {
  outline: 2px solid #0172ef;
  outline-offset: 2px;
}

.remember-label {
  font-size: 0.8125rem;
  color: #64748b;
  cursor: pointer;
}

/* Submit Button (shadcn style) */
.btn-submit {
  width: 100%;
  padding: 0.8rem 1.25rem;
  background: var(--primary-gradient);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 0.625rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(1, 114, 239, 0.25);
  position: relative;
  overflow: hidden;
}

.btn-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(1, 114, 239, 0.35);
  transform: translateY(-1px);
}

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

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

.btn-submit svg.arrow-icon {
  transition: transform 0.2s ease;
}

.btn-submit:hover svg.arrow-icon {
  transform: translateX(3px);
}

/* Error message */
.error-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.625rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  color: #b91c1c;
  font-size: 0.8125rem;
  animation: shake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

.error-alert svg {
  flex-shrink: 0;
  color: #ef4444;
}

/* Divider & Footer */
.card-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 1.5rem 0 1.25rem;
}

.card-security-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

.card-security-footer svg {
  color: #10b981;
}

/* ================= Animations ================= */

/* Infinite Smooth Drift of the Dots */
@keyframes gridDrift {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 56px 56px;
  }
}

/* Breathing Wave across the Dots */
@keyframes gridBreathe {
  0% {
    opacity: 0.4;
  }
  100% {
    opacity: 0.68;
  }
}

/* Smooth Floating Orbs behind the Dots */
@keyframes floatOrb1 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(40px, 35px) scale(1.12);
  }
  100% {
    transform: translate(-30px, 20px) scale(0.95);
  }
}

@keyframes floatOrb2 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-45px, -30px) scale(1.15);
  }
  100% {
    transform: translate(25px, -15px) scale(0.92);
  }
}

@keyframes floatOrb3 {
  0% {
    transform: translate(0, 0) scale(0.9);
  }
  50% {
    transform: translate(-35px, 40px) scale(1.18);
  }
  100% {
    transform: translate(20px, -25px) scale(1);
  }
}

/* Card Entrance Slide-up */
@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Shake Animation */
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Ping Dot */
@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

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

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

/* Responsive */
@media (max-width: 480px) {
  .gate-card {
    padding: 2rem 1.5rem;
  }
  .gate-title {
    font-size: 1.25rem;
  }
}
