@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Animated background pattern */
body::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
  animation: float 15s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-20px) scale(1.05);
  }
}

.login-container {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Modern glassmorphism card with better shadows */
.login-card {
  background: white;
  backdrop-filter: blur(20px);
  border-radius: 28px;
  padding: 48px 44px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 2px 4px
    rgba(255, 255, 255, 0.9);
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.logo-section {
  text-align: center;
  margin-bottom: 40px;
}

.logo-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 28px;
}

/* Enhanced logo with glow effect */
.logo-img {
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: 20px;
  position: relative;
}


/* Modern gradient text */
.login-title {
  font-size: 30px;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #6366f1);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: 200% center;
  }
}

.login-subtitle {
  color: #64748b;
  font-size: 16px;
  font-weight: 500;
}

.form-group {
  margin-bottom: 24px;
}

/* Better label styling */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.input-container {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: #94a3b8;
  transition: color 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

/* Enhanced input with better focus states */
.form-input {
  width: 100%;
  padding: 16px 52px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #f8fafc;
  color: #1e293b;
}

.form-input::placeholder {
  color: #94a3b8;
}

.form-input:focus {
  outline: none;
  border-color: #6366f1;
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.form-input:focus ~ .input-icon,
.input-container:focus-within .input-icon {
  color: #6366f1;
}

/* Visible and styled toggle password */
.toggle-password {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1;
}

.toggle-password:hover {
  color: #6366f1;
  transform: translateY(-50%) scale(1.15);
}

/* Modern button with gradient and animations */
.btn-login {
  width: 100%;
  padding: 16px;
  margin-top: 32px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.btn-login::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-login:hover::before {
  opacity: 1;
}

.btn-login:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.5);
}

.btn-login:active {
  transform: translateY(-1px);
}

.btn-login span {
  position: relative;
  z-index: 1;
}

.btn-login.loading {
  pointer-events: none;
  opacity: 0.8;
}

/* Enhanced loader animation */
.loader {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn-login.loading .loader {
  display: block;
}

.btn-login.loading .btn-text {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Better error message styling */
.error-message {
  margin-top: 20px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 10px;
  border-left: 4px solid #ef4444;
  animation: shake 0.4s ease;
}

.error-message.show {
  display: flex;
}

.error-message::before {
  content: "⚠️";
  font-size: 18px;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Enhanced footer styling */
.login-footer {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 2px solid #e2e8f0;
  text-align: center;
}

.footer-text {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 20px;
}

/* Better company info styling */
.company-info {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  padding: 20px;
  border-radius: 14px;
  margin-top: 16px;
}

.company-address {
  font-size: 14px;
  color: #475569;
  font-weight: 600;
  margin-bottom: 12px;
}

.piva-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.piva-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.piva-value {
  font-size: 15px;
  font-weight: 800;
  color: #6366f1;
  font-family: "Courier New", monospace;
}

/* Responsive */
@media (max-width: 480px) {
  .login-card {
    padding: 40px 32px;
    border-radius: 24px;
  }

  .login-title {
    font-size: 26px;
  }

  .logo-img {
    max-width: 240px;
  }

  .btn-login {
    padding: 14px;
    font-size: 15px;
  }

  .form-input {
    padding: 14px 48px;
  }

  .login-container {
    max-height: calc(100vh - 20px);
    padding-right: 8px;
  }
}

/* Added custom scrollbar styling for better UX */
.login-container::-webkit-scrollbar {
  width: 8px;
}

.login-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.login-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  border: 2px solid transparent;
}

.login-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }

  .login-card {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  }

  .login-subtitle,
  .footer-text {
    color: #94a3b8;
  }

  .form-label {
    color: #e2e8f0;
  }

  .form-input {
    background: rgba(15, 23, 42, 0.5);
    border-color: #334155;
    color: #f1f5f9;
  }

  .form-input::placeholder {
    color: #64748b;
  }

  .form-input:focus {
    background: rgba(15, 23, 42, 0.7);
  }

  .company-info {
    background: linear-gradient(135deg, rgba(51, 65, 85, 0.5) 0%, rgba(30, 41, 59, 0.5) 100%);
  }

  .company-address {
    color: #cbd5e1;
  }

  .piva-container {
    background: rgba(15, 23, 42, 0.5);
  }

  .login-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
  }
}