/* Login Page Styles - shadcn UI Theme */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Monochrome Theme - Light Mode (White, Grey, Black) */
  --background: 0 0% 100%; /* White */
  --foreground: 0 0% 0%; /* Black */
  --card: 0 0% 100%; /* White */
  --card-foreground: 0 0% 0%; /* Black */
  --popover: 0 0% 100%; /* White */
  --popover-foreground: 0 0% 0%; /* Black */
  --primary: 0 0% 0%; /* Black */
  --primary-foreground: 0 0% 100%; /* White */
  --secondary: 0 0% 96%; /* Light Grey */
  --secondary-foreground: 0 0% 0%; /* Black */
  --muted: 0 0% 94%; /* Light Grey */
  --muted-foreground: 0 0% 45%; /* Medium Grey */
  --accent: 0 0% 94%; /* Light Grey */
  --accent-foreground: 0 0% 0%; /* Black */
  --destructive: 0 0% 20%; /* Dark Grey */
  --destructive-foreground: 0 0% 100%; /* White */
  --border: 0 0% 90%; /* Light Grey */
  --input: 0 0% 90%; /* Light Grey */
  --ring: 0 0% 0%; /* Black */
  --radius: 0.5rem;
}

[data-theme="dark"] {
  /* Monochrome Theme - Dark Mode (White, Grey, Black) */
  --background: 0 0% 0%; /* Black */
  --foreground: 0 0% 100%; /* White */
  --card: 0 0% 9%; /* Dark Grey */
  --card-foreground: 0 0% 100%; /* White */
  --popover: 0 0% 9%; /* Dark Grey */
  --popover-foreground: 0 0% 100%; /* White */
  --primary: 0 0% 100%; /* White */
  --primary-foreground: 0 0% 0%; /* Black */
  --secondary: 0 0% 15%; /* Dark Grey */
  --secondary-foreground: 0 0% 100%; /* White */
  --muted: 0 0% 15%; /* Dark Grey */
  --muted-foreground: 0 0% 64%; /* Medium Grey */
  --accent: 0 0% 15%; /* Dark Grey */
  --accent-foreground: 0 0% 100%; /* White */
  --destructive: 0 0% 80%; /* Light Grey */
  --destructive-foreground: 0 0% 0%; /* Black */
  --border: 0 0% 25%; /* Medium Grey */
  --input: 0 0% 25%; /* Medium Grey */
  --ring: 0 0% 100%; /* White */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: #000000;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  color: hsl(var(--foreground));
  transition: color 0.2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(
    ellipse 80% 60% at 50% 0%,
    rgba(226, 232, 240, 0.15),
    transparent 70%
  ),
  #000000;
  pointer-events: none;
}

[data-theme="light"] body {
  background: #ffffff;
}

[data-theme="light"] body::before {
  background: radial-gradient(
    ellipse 80% 60% at 50% 0%,
    rgba(0, 0, 0, 0.05),
    transparent 70%
  ),
  #ffffff;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-container {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 10px 15px -3px hsl(0 0% 0% / 0.1),
    0 4px 6px -4px hsl(0 0% 0% / 0.1);
  padding: 40px;
  animation: slideUp 0.4s ease-out;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .login-container {
  box-shadow: 0 10px 15px -3px hsl(0 0% 0% / 0.5),
    0 4px 6px -4px hsl(0 0% 0% / 0.4);
}

.login-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    hsl(var(--border) / 0.5) 50%,
    transparent
  );
  pointer-events: none;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--foreground));
  box-shadow: 0 1px 3px 0 hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .logo-icon {
  box-shadow: 0 1px 3px 0 hsl(0 0% 0% / 0.3), 0 1px 2px -1px hsl(0 0% 0% / 0.3);
}

.logo-icon::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    hsl(var(--border) / 0.5) 50%,
    transparent
  );
  pointer-events: none;
}

.logo-icon svg {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 8px;
  letter-spacing: -0.025em;
}

.login-header p {
  color: hsl(var(--muted-foreground));
  font-size: 15px;
}

.login-form {
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.2s;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* Ensure password field is never disabled */
.form-group input[type="password"],
.form-group input[type="text"] {
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
}

.form-group input:disabled {
  opacity: 1 !important;
  cursor: text !important;
  background: hsl(var(--background)) !important;
}

.form-group input::placeholder {
  color: hsl(var(--muted-foreground) / 0.6);
}

.form-group input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.password-input-wrapper {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  border-radius: calc(var(--radius) - 4px);
}

.toggle-password:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
}

.toggle-password svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.eye-off-icon {
  display: none;
}

.toggle-password.active .eye-icon {
  display: none;
}

.toggle-password.active .eye-off-icon {
  display: block;
}

.error-message {
  background: hsl(var(--destructive) / 0.1);
  color: #ff0000; /* Red text color for errors */
  border: 1px solid hsl(var(--destructive) / 0.3);
  padding: 12px 16px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
  animation: shake 0.3s;
  font-weight: 500;
}

.error-message.show {
  display: block;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

.btn-login {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 500;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 hsl(0 0% 0% / 0.05);
}

.btn-login:hover:not(:disabled) {
  background: hsl(var(--primary) / 0.9);
  box-shadow: 0 1px 3px 0 hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  transform: translateY(-1px);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 3px solid hsl(var(--primary-foreground) / 0.3);
  border-top-color: hsl(var(--primary-foreground));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

.btn-login.loading .btn-text {
  display: none;
}

.btn-login.loading .btn-loader {
  display: block;
}

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

.login-footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid hsl(var(--border));
}

.login-footer p {
  color: hsl(var(--muted-foreground));
  font-size: 14px;
}

.login-footer a {
  color: hsl(var(--foreground));
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.login-footer a:hover {
  color: hsl(var(--muted-foreground));
  text-decoration: underline;
}

/* Dark Mode Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 2px 8px hsl(0 0% 0% / 0.1);
  padding: 0;
}

.theme-toggle:hover {
  background: hsl(var(--accent));
  transform: scale(1.05);
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.15);
}

.theme-toggle:active {
  transform: scale(0.95);
}

[data-theme="dark"] .theme-toggle {
  box-shadow: 0 2px 8px hsl(0 0% 0% / 0.3);
}

.theme-icon {
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s ease;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.sun-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.moon-icon {
  opacity: 0;
  transform: rotate(90deg);
}

[data-theme="dark"] .sun-icon {
  opacity: 0;
  transform: rotate(90deg);
}

[data-theme="dark"] .moon-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Responsive */
@media (max-width: 480px) {
  .login-container {
    padding: 32px 24px;
  }

  .login-header h1 {
    font-size: 24px;
  }

  .theme-toggle {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}
