/* ==========================================================================
   Assert Digital Office - Premium Login Style
   Design System, Glassmorphism, glows & high-tech atmosphere
   ========================================================================== */

/* 1. Global Reset & Variables */
:root {
  /* Fonts */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Colors */
  --color-black: #000000;
  --color-bg-base: #050B16;
  --color-card-bg: rgba(8, 8, 12, 0.65);
  
  /* Brand Identity Colors */
  --color-brand-red: #fe0705;
  --color-brand-blue: #0d2eec;
  --color-brand-purple: #810ff4; /* Harmonic midpoint */

  /* Glow / Shadows */
  --glow-blue: rgba(13, 46, 236, 0.35);
  --glow-red: rgba(254, 7, 5, 0.25);
  
  /* UI Colors */
  --color-white: #ffffff;
  --color-gray-100: #f5f5f7;
  --color-gray-300: #d2d2d7;
  --color-gray-400: #8e8e93;
  --color-gray-600: #3a3a3c;
  --color-gray-800: #1c1c1e;
  
  /* Borders */
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(13, 46, 236, 0.5);
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: all 0.15s ease;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--color-bg-base);
  color: var(--color-white);
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 2. Interactive Technological Backgrounds */

/* Canvas for digital dust/particles */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* Faint technical grid background */
.tech-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.007) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.007) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: center center;
  pointer-events: none;
  z-index: 1;
}

/* Cursor ambient glow that follows mouse pointer */
.cursor-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle, 
    rgba(37, 99, 235, 0.04) 0%, 
    rgba(124, 58, 237, 0.02) 40%, 
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
  transition: width 0.3s, height 0.3s;
  mix-blend-mode: screen;
}

/* 3. Centered Layout & Container */
.login-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 600px; /* Aumentado para 600px conforme referência visual de largura do PixelClinic */
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* 4. The Premium Floating Card (Glassmorphism + Subtle Border Glow) */
.login-card {
  position: relative;
  width: 100%;
  background: rgba(8, 14, 28, 0.88) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border-radius: 28px;
  border: 1px solid rgba(93, 119, 255, 0.16) !important;
  padding: 40px 56px; /* Ajustado para 40px vertical e 56px horizontal para respiro proporcional à nova largura */
  box-shadow: 
    0 18px 50px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset !important;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Corner lights (simulated laser edge reflection) */
.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 28px;
  padding: 1px;
  background: linear-gradient(135deg, 
    rgba(37, 99, 235, 0.18) 0%, 
    rgba(6, 182, 212, 0.1) 50%, 
    rgba(124, 58, 237, 0.18) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Card transitioning state */
.login-card.authenticating {
  opacity: 0.65 !important;
  transform: scale(0.985) !important;
  filter: blur(0.5px) !important;
  pointer-events: none !important;
}

/* 5. Header & Branding Styling */
.card-header {
  text-align: center;
  margin-bottom: 30px;
}

/* Logo Box matching the reference dot-matrix styling */
.logo-box {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 20px auto; /* Aumentada margem para mais respiro */
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  overflow: visible !important;
  aspect-ratio: 1 / 1;
}

.logo-box::after {
  content: '';
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.16) 0%, rgba(124, 58, 237, 0.16) 50%, rgba(6, 182, 212, 0.0) 70%);
  filter: blur(8px);
  z-index: 1;
  pointer-events: none;
}

.logo-grid-dots {
  display: none !important; /* Removed square dots container */
}

.logo-wrapper {
  width: 64px !important; /* Aumentado para dar destaque */
  height: 64px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  aspect-ratio: 1 / 1;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 4px 10px rgba(124, 58, 237, 0.25)) !important;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.logo-box:hover .brand-logo {
  transform: scale(1.08) !important;
}

/* Title and typography */
.brand-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.7rem !important; /* Aumentado levemente */
  letter-spacing: -0.5px;
  color: var(--color-white);
  margin-bottom: 8px;
}

.brand-tagline {
  font-size: 0.8rem !important; /* Mais legível */
  line-height: 1.5;
  color: #94A3B8 !important; /* Cor recomendada */
  max-width: 320px; /* Largura controlada */
  margin: 0 auto;
  font-weight: 400;
  padding: 0;
}

/* Faded divider with bright center */
.divider-glow {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.08) 20%, 
    rgba(255, 255, 255, 0.25) 50%, 
    rgba(255, 255, 255, 0.08) 80%, 
    transparent 100%
  );
  margin: 16px 0; /* Reduzido margem do divisor para aproximar os elementos */
  position: relative;
}

.divider-glow::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 4px;
  background: radial-gradient(circle, rgba(13, 46, 236, 0.3) 0%, transparent 80%);
}

.form-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--color-white);
  margin-bottom: 4px;
}

.form-subtitle {
  font-size: 0.8rem;
  color: var(--color-gray-400);
}

/* 6. Form Groups & Inputs */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.input-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-gray-300);
  margin-bottom: 7px;
  font-family: var(--font-title);
  letter-spacing: 0.2px;
}

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

/* Input Fields */
.input-wrapper input {
  width: 100%;
  height: 48px !important; /* Suavizada a altura de 52px para 48px */
  background: #E5EAF3 !important;
  border: 1px solid rgba(93, 119, 255, 0.16) !important;
  border-radius: 10px !important;
  padding: 0 16px 0 42px !important;
  color: #0F172A !important;
  font-family: var(--font-body);
  font-size: 0.88rem !important;
  outline: none;
  box-shadow: none !important;
  transition: var(--transition-smooth);
}

.input-wrapper input::placeholder {
  color: #64748B !important;
}

/* Input Icon positioning */
.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: #64748B !important;
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: var(--transition-smooth);
  z-index: 3;
}

.input-icon svg {
  width: 100%;
  height: 100%;
}

.input-border-glow {
  display: none !important;
}

/* Input Focus States */
.input-wrapper input:focus {
  background: #FFFFFF !important;
  border-color: rgba(124, 58, 237, 0.45) !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12) !important;
}

.input-wrapper input:focus ~ .input-icon {
  color: #7C3AED !important;
  transform: scale(1.02);
}

/* Password eye toggle */
.password-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: #64748B !important;
  cursor: pointer;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  z-index: 3;
}

.password-toggle:hover {
  color: #0F172A !important;
}

.password-toggle svg {
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* Error Messages styling */
.error-message {
  display: block;
  font-size: 0.72rem;
  color: var(--color-brand-red);
  margin-top: 5px;
  padding-left: 4px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-5px);
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.error-message.visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 20px;
  margin-top: 6px;
}

/* Input error state */
.input-wrapper.error input {
  background: #FDF2F2 !important;
  border-color: rgba(254, 7, 5, 0.4) !important;
  color: #9C0006 !important;
  box-shadow: 0 0 0 3px rgba(254, 7, 5, 0.1) !important;
}
.input-wrapper.error .input-icon {
  color: #FE0705 !important;
}

/* 7. Extra Form Actions Layout */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 24px 0; /* Reduzido espaçamento do checkbox e link de recuperar senha */
}

/* Custom Checkbox Design */
.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-checkmark {
  position: relative;
  height: 15px !important;
  width: 15px !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 4px;
  margin-right: 8px;
  transition: var(--transition-smooth);
}

.checkbox-container:hover input ~ .checkbox-checkmark {
  border-color: rgba(255, 255, 255, 0.3) !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.checkbox-container input:checked ~ .checkbox-checkmark {
  background: #7C3AED !important;
  border-color: transparent !important;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.4) !important;
}

/* The checkmark indicator */
.checkbox-checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 4.2px !important;
  top: 1.2px !important;
  width: 3.5px !important;
  height: 7px !important;
  border: solid var(--color-white);
  border-width: 0 1.6px 1.6px 0 !important;
  transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkbox-checkmark::after {
  display: block;
}

.checkbox-label-text {
  font-size: 0.78rem;
  color: var(--color-gray-300);
  transition: var(--transition-fast);
}

.checkbox-container:hover .checkbox-label-text {
  color: var(--color-white);
}

/* Forgot Password Link styling */
.forgot-link {
  font-size: 0.78rem;
  color: var(--color-gray-400);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-fast);
}

.forgot-link:hover {
  color: var(--color-white);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* 8. Premium Submit Button (Gradient + Shimmer + Hover Scale) */
.btn-submit {
  position: relative;
  width: 100%;
  height: 48px !important; /* Ajustada altura para harmonizar com inputs */
  background: linear-gradient(90deg, #2563EB 0%, #7C3AED 55%, #06B6D4 100%) !important;
  border: none;
  border-radius: 10px !important;
  color: var(--color-white) !important;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem !important;
  letter-spacing: 0.5px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 10px 24px rgba(37, 99, 235, 0.20),
    0 6px 18px rgba(124, 58, 237, 0.16) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Internal hover lighting overlay */
.btn-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg, 
    transparent, 
    rgba(255, 255, 255, 0.18), 
    transparent
  );
  transition: none;
  pointer-events: none;
}

.btn-submit:hover {
  transform: translateY(-1.5px) !important;
  filter: brightness(1.06) !important;
  box-shadow: 
    0 12px 28px rgba(37, 99, 235, 0.26),
    0 8px 22px rgba(124, 58, 237, 0.22) !important;
}

.btn-submit:hover .btn-glow {
  left: 100%;
  transition: all 0.75s ease;
}

.btn-submit:active {
  transform: translateY(0.5px) !important;
  filter: brightness(0.98) !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15) !important;
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

/* 9. Card Footer */
.card-footer {
  margin-top: 24px; /* Reduzido margem superior do rodapé para equilíbrio de altura */
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 16px;
}

.card-footer p {
  font-size: 0.68rem !important;
  line-height: 1.5;
  color: rgba(148, 163, 184, 0.45) !important;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.1px;
}

/* 10. Feedback and Login Success Area */
.feedback-container {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.feedback-success {
  color: #30d158; /* Apple green */
  text-shadow: 0 0 10px rgba(48, 209, 88, 0.2);
}

.feedback-error {
  color: #ff453a; /* Apple red */
  text-shadow: 0 0 10px rgba(255, 69, 58, 0.2);
}

.suspended-access-card {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
  text-align: left;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.08);
}

.suspended-access-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.14);
}

.suspended-access-icon svg {
  width: 20px;
  height: 20px;
}

.suspended-access-card strong {
  display: block;
  margin-bottom: 7px;
  color: #fde68a;
  font-family: var(--font-title);
  font-size: 0.94rem;
  font-weight: 700;
}

.suspended-access-card p {
  margin: 0 0 8px;
  color: rgba(245, 245, 247, 0.82);
  font-size: 0.78rem;
  line-height: 1.55;
}

.suspended-access-card p:last-child {
  margin-bottom: 0;
}

/* Successful Transition Screen (Executed on success authentication) */
.success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 0;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.success-icon-box {
  width: 72px;
  height: 72px;
  background: radial-gradient(circle at center, rgba(48, 209, 88, 0.15) 0%, transparent 75%);
  border: 1px solid rgba(48, 209, 88, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #30d158;
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(48, 209, 88, 0.15);
  animation: pulseGreen 2s infinite;
}

.success-icon-box svg {
  width: 32px;
  height: 32px;
}

.success-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-white);
}

.success-desc {
  font-size: 0.85rem;
  color: var(--color-gray-400);
  line-height: 1.5;
  margin-bottom: 30px;
}

.progress-bar-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-brand-purple) 0%, var(--color-brand-blue) 100%);
  border-radius: 2px;
  animation: loadProgress 2.5s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.2); }
  70% { box-shadow: 0 0 0 12px rgba(48, 209, 88, 0); }
  100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}

@keyframes loadProgress {
  to { width: 100%; }
}

/* 11. Media Queries for Responsiveness */
@media (max-width: 768px) {
  .login-container {
    max-width: 90%;
    padding: 20px;
  }
  
  .login-card {
    padding: 40px 32px;
  }
}

@media (max-width: 580px) {
  .login-container {
    width: 92%; /* 92% de largura em mobile e telas pequenas */
    max-width: 92%;
    padding: 16px 0;
  }
  
  .login-card {
    padding: 36px 24px;
    border-radius: 24px;
  }
  
  .login-card::before {
    border-radius: 24px;
  }
  
  .brand-title {
    font-size: 1.4rem;
  }
  
  .brand-tagline {
    font-size: 0.74rem;
  }
}

@media (max-width: 375px) {
  .login-card {
    padding: 32px 18px;
  }
  
  .brand-title {
    font-size: 1.25rem;
  }
}

@media (max-height: 720px) {
  .login-container {
    padding: 16px 0;
    min-height: auto;
  }
  
  .login-card {
    padding: 30px 28px;
  }
  
  .logo-box {
    width: 76px;
    height: 76px;
    margin-bottom: 16px;
  }
  
  .logo-wrapper {
    width: 46px;
    height: 46px;
  }
  
  .divider-glow {
    margin: 16px 0;
  }
  
  .card-footer {
    margin-top: 20px;
  }
}

/* Viewport-safe login on phones, including virtual keyboard and landscape. */
@media (max-width: 767px), (max-height: 620px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
    align-items: flex-start;
  }

  .login-container {
    min-height: 100dvh;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}
