/**
 * VehiScan Login Page Styles
 * Modern Shadcn-inspired design
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #f8f9fa;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  position: relative;
  overflow: hidden;
}

/* Wavy background decorations */
.bg-decoration {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.bg-decoration-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #3b82f6 0%, #60a5fa 70%);
  top: -200px;
  left: -150px;
  animation: float 20s infinite alternate;
}

.bg-decoration-2 {
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, #8b5cf6 0%, #d8b4fe 70%);
  bottom: -400px;
  right: -200px;
  opacity: 0.1;
  animation: float 25s infinite alternate-reverse;
}

.bg-decoration-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #10b981 0%, #34d399 70%);
  bottom: -100px;
  left: 20%;
  opacity: 0.08;
  animation: float 15s infinite alternate;
}

@keyframes float {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(30px, 40px) rotate(10deg); }
}

.login-container {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 10;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
}

.logo-image {
  height: 64px;
  width: auto;
  max-width: 250px;
  object-fit: contain;
}

.community-logo {
  max-width: 120px;
  height: auto;
  margin: 0 auto 0.5rem;
  display: block;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #000;
}

.subtitle {
  color: #666;
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.role-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.role-btn {
  padding: 0.625rem;
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #000;
  position: relative;
  overflow: hidden;
}

.role-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #000;
  transform: scaleX(0);
  transition: transform 0.2s ease;
  z-index: 0;
}

.role-btn span {
  position: relative;
  z-index: 1;
}

.role-btn:hover:not(.active) {
  background: #f9fafb;
  border-color: #9ca3af;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.role-btn.active {
  background: #000;
  color: white;
  border-color: #000;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.role-btn.active::before {
  transform: scaleX(1);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #000;
}

.form-label .required {
  color: #ef4444;
}

.form-group input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.2s;
  background: white;
  color: #000;
}

.form-group input:focus {
  outline: none;
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.form-group input::placeholder {
  color: #9ca3af;
}

.form-group input:invalid:not(:placeholder-shown) {
  border-color: #fca5a5;
}

.form-group input:valid:not(:placeholder-shown) {
  border-color: #86efac;
}

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper input {
  padding-left: 2.5rem;
}

.input-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 1.125rem;
  pointer-events: none;
  transition: color 0.2s;
}

.form-group input:focus~.input-icon {
  color: #000;
}

.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper .input-icon-wrapper {
  width: 100%;
}

.password-wrapper .input-icon-wrapper input {
  padding-right: 3rem;
}

.password-wrapper button {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6b7280;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.375rem;
  line-height: 1;
  transition: all 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-wrapper button:hover {
  color: #000;
  background: #f3f4f6;
  transform: translateY(-50%) scale(1.1);
}

.password-wrapper button:active {
  transform: translateY(-50%) scale(0.95);
}

.remember-forgot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  margin-top: -0.25rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: #000;
}

.remember-me input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #000;
}

.forgot-link {
  color: #000;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}

.forgot-link:hover {
  opacity: 0.7;
}

.btn-primary {
  width: 100%;
  padding: 0.625rem;
  background: #000;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
  background: #1f1f1f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-primary .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: #9ca3af;
  font-size: 0.875rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}

.divider span {
  padding: 0 0.75rem;
}

.signup-link {
  text-align: center;
  font-size: 0.875rem;
  color: #666;
}

.signup-link a {
  color: #000;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid #000;
  transition: opacity 0.2s;
}

.signup-link a:hover {
  opacity: 0.7;
}

.error {
  display: none;
}

.keyboard-hint {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  animation: fadeIn 0.3s ease-out 1s forwards;
  z-index: 1000;
}

.keyboard-hint kbd {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.7rem;
}

@keyframes fadeIn {
  to {
    opacity: 0.7;
  }
}

.strength-indicator {
  height: 3px;
  background: #e5e7eb;
  border-radius: 3px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.strength-bar {
  height: 100%;
  width: 0;
  transition: all 0.3s;
  border-radius: 3px;
}

.strength-weak {
  width: 33%;
  background: #ef4444;
}

.strength-medium {
  width: 66%;
  background: #f59e0b;
}

.strength-strong {
  width: 100%;
  background: #10b981;
}

/* SweetAlert2 Custom Styling */
.swal2-popup {
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.swal2-confirm {
  background: var(--swal2-confirm-button-background-color, #3b82f6) !important;
  color: #fff !important;
  border-radius: 6px;
  padding: 0.625rem 1.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}

.swal2-cancel {
  background: var(--ta-swal-cancel, #6b7280) !important;
  color: #fff !important;
}

/* Responsive design */
@media (max-width: 480px) {
  .login-container {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }

  .bg-decoration-1,
  .bg-decoration-2,
  .bg-decoration-3 {
    display: none;
  }

  .role-buttons {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .logo-image {
    height: 48px;
  }
}

/* ───── Dark Mode (system preference) ───── */
@media (prefers-color-scheme: dark) {
  body {
    background: #0f172a;
  }

  .bg-decoration-1 {
    background: radial-gradient(circle, #60a5fa 0%, transparent 70%);
  }

  .bg-decoration-2 {
    border-color: #60a5fa;
  }

  .bg-decoration-3 {
    background: radial-gradient(circle, #60a5fa 0%, transparent 70%);
  }

  .login-container {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  }

  .login-container:hover {
    border-color: rgba(255, 255, 255, 0.2);
  }

  h1 {
    color: #f1f5f9;
  }

  .subtitle {
    color: #94a3b8;
  }

  .role-btn {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
  }

  .role-btn:hover:not(.active) {
    background: #334155;
    border-color: #475569;
  }

  .role-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  }

  .role-btn.active::before {
    background: #3b82f6;
  }

  .form-label {
    color: #cbd5e1;
  }

  .form-group input {
    background: #0f172a;
    color: #f1f5f9;
    border-color: #334155;
  }

  .form-group input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
  }

  .form-group input::placeholder {
    color: #64748b;
  }

  .form-group input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
  }

  .form-group input:valid:not(:placeholder-shown) {
    border-color: #22c55e;
  }

  .input-icon {
    color: #64748b;
  }

  .form-group input:focus ~ .input-icon {
    color: #60a5fa;
  }

  .password-wrapper button {
    color: #94a3b8;
  }

  .password-wrapper button:hover {
    color: #f1f5f9;
    background: #334155;
  }

  .remember-me {
    color: #cbd5e1;
  }

  .remember-me input[type="checkbox"] {
    accent-color: #3b82f6;
  }

  .forgot-link {
    color: #93c5fd;
  }

  .btn-primary {
    background: #3b82f6;
    color: white;
  }

  .btn-primary:hover:not(:disabled) {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  }

  .divider {
    color: #64748b;
  }

  .divider::before,
  .divider::after {
    border-color: #334155;
  }

  .signup-link {
    color: #94a3b8;
  }

  .signup-link a {
    color: #93c5fd;
    border-bottom-color: #60a5fa;
  }

  .keyboard-hint {
    background: rgba(30, 41, 59, 0.9);
  }

  .strength-indicator {
    background: #334155;
  }

  /* SweetAlert2 dark overrides */
  .swal2-popup {
    background: #1e293b;
    color: #f1f5f9;
  }
}