/* Base styles */
:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 0%;
  --primary: 207 100% 42%;
  --primary-hover: 207 100% 38%;
  --primary-foreground: 0 0% 100%;
  --border: 0 0% 86%;
  --input: 0 0% 86%;
  --input-background: 0 0% 100%;
  --error: 0 84% 60%;
  --radius: 0.5rem;      /* 8px - default shadcn radius */
  --radius-sm: 0.3rem;   /* 4.8px - small radius */
  --radius-lg: 0.75rem;  /* 12px - large radius */
  --radius-full: 9999px; /* Full radius for circular elements */
  --button-radius: 0;
  --card-background: 0 0% 100%;
  --footer-background: 0 0% 98%;
  --theme-toggle-background: 0 0% 90%;
  --theme-toggle-foreground: 0 0% 40%;
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, 
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 220 20% 13%;
    --foreground: 210 17% 98%;
    --primary: 210 100% 50%;
    --primary-hover: 210 100% 55%;
    --primary-foreground: 0 0% 100%;
    --border: 220 13% 23%;
    --input: 220 13% 23%;
    --input-background: 220 20% 16%;
    --card-background: 220 20% 16%;
    --footer-background: 220 20% 11%;
    --theme-toggle-background: 220 20% 16%;
    --theme-toggle-foreground: 210 17% 98%;
    --error: 0 84% 60%;
    --link: 210 100% 70%;  /* Lighter blue for links in dark mode */
    --link-hover: 210 100% 80%;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: var(--font-sans);
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: var(--line-height-normal);
  font-size: var(--font-size-base);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Login container */
.login-container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Logo container */
.logo-container {
  margin-bottom: 1rem;
  padding: 0 32px;
}

.logo-container img {
  max-width: 145px;
  height: auto;
  display: block;
}

/* Remove institution name styles */
.institution-name {
  display: none;
}

/* Update card title margin */
.card-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  margin-bottom: 1.5rem;
  color: hsl(var(--foreground));
  text-align: left;
}

/* Remove old subtitle styles */
.subtitle {
  display: none;
}

/* Card styles */
.card {
  background-color: hsl(var(--card-background));
  padding: 32px;
  border: 1px solid hsl(var(--border));
  transition: all 0.3s ease;
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1),
              0 5px 10px rgba(0, 0, 0, 0.2);
  max-width: 100%;
  width: 100%;
  border-radius: var(--radius);
}

/* Form elements */
.input-group {
  margin-bottom: 24px;
  position: relative;
}

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

.input {
  width: 100%;
  padding: 0.75rem;
  height: 44px;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--input-background));
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 16px;
  transition: all 0.1s ease;
  border-radius: var(--radius-sm);
  min-height: 44px;
}

.input:hover {
  border-color: hsl(var(--foreground) / 0.8);
}

.input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.2);
}

/* Password input container */
.password-container {
  position: relative;
}

.password-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: hsl(var(--foreground) / 0.6);
  padding: 4px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Button */
.button {
  width: 108px;
  height: 40px;
  padding: 0 1rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  float: right;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  position: relative;
}

.button:hover {
  background-color: hsl(var(--primary-hover));
  transform: none;
  box-shadow: none;
}

.button:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Loading indicator */
#loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  z-index: 99999;
}

#loading.show {
  display: block;
}

.loading-spinner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url(loading.gif);
  background-position: center center;
  background-repeat: no-repeat;
}

/* Error message */
.error-message {
  color: hsl(var(--error));
  font-size: var(--font-size-sm);
  margin-bottom: 24px;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: none;
  background-color: hsl(var(--error) / 0.1);
}

/* Only show and style when has content */
.error-message:not(:empty):not([style*="display: none"]) {
  display: block;
}

/* Base link styles for interactive elements */
.forgot-password,
.footer a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-size: var(--font-size-sm);
  transition: color 0.2s ease;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  min-height: 44px;
  line-height: 1.5;
}

.forgot-password:hover,
.footer a:hover {
  color: hsl(var(--foreground));
}

.forgot-password:focus,
.footer a:focus {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

/* Footer */
.footer {
  margin-top: 1rem;
  padding: 24px 32px;
  text-align: left;
  color: hsl(var(--muted-foreground));
  font-size: var(--font-size-sm);
  background-color: hsl(var(--card-background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px hsl(240 6% 10% / 0.05),
              0 1px 8px hsl(240 6% 10% / 0.08);
}

.footer strong {
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground));
}

/* Base mobile breakpoints */
@media (max-width: 640px) {
  .login-container {
    padding: 1rem;
    gap: 0.75rem;
  }

  .logo-container {
    padding: 0 32px;  /* Match card padding */
  }

  .logo-container img {
    max-width: 96px;
  }
}

/* Small phones (iPhone SE, etc) */
@media (max-width: 375px) {
  .login-container {
    padding: 0.75rem;
  }

  .logo-container {
    padding: 0 16px;  /* Match reduced card padding */
  }

  .card {
    padding: 1rem;
  }

  .logo-container img {
    max-width: 88px;
  }

  .card-title {
    font-size: var(--font-size-lg);
    margin-bottom: 1rem;
  }

  .input {
    height: 2.5rem;
    font-size: var(--font-size-sm);
  }
}

/* Landscape mode */
@media (max-height: 480px) and (orientation: landscape) {
  .login-container {
    padding: 0.5rem;
    min-height: auto;
  }

  .logo-container {
    margin-bottom: 0.5rem;
  }

  .logo-container img {
    max-width: 80px;
  }

  .card {
    padding: 1rem;
  }

  .footer {
    margin-top: 0.5rem;
  }
}

/* Tablets */
@media (min-width: 641px) and (max-width: 1024px) {
  .login-container {
    padding: 2rem;
    max-width: 480px;
  }
}

/* Add touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  .button,
  .input,
  .password-icon,
  .forgot-password,
  .theme-toggle {
    cursor: default;
  }

  .user-info {
    padding: 0.5rem 0;
  }
}

/* Update theme toggle styles */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card-background));
  color: hsl(var(--foreground));
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1),
              0 2px 8px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: hsl(var(--foreground) / 0.2);
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle i {
  font-size: 1.2rem;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover i {
  transform: rotate(15deg);
}

/* Add smooth transitions for theme changes */
.card,
.input,
.button,
.footer {
  transition: all 0.3s ease;
}

/* Update dark mode colors to match VSCode dark theme */
:root[data-theme="dark"] {
  --background: 220 13% 18%;      /* #1e1e1e - VSCode main bg */
  --foreground: 0 0% 86%;         /* #dbdbdb - VSCode text */
  --primary: 207 100% 50%;        /* #0078d4 - VSCode blue */
  --primary-hover: 207 100% 55%;  /* Lighter blue on hover */
  --primary-foreground: 0 0% 100%; /* White text on primary */
  --muted-foreground: 0 0% 66%;   /* #a8a8a8 - VSCode secondary text */
  --border: 220 13% 23%;          /* #303030 - VSCode borders */
  --input: 220 13% 23%;           /* Same as border */
  --input-background: 220 13% 20%; /* #252526 - VSCode input bg */
  --card-background: 220 13% 20%;  /* Same as input bg */
  --footer-background: 220 13% 20%; /* Same as card */
  --link: 207 100% 70%;           /* Lighter blue for links */
  --link-hover: 207 100% 75%;     /* Even lighter on hover */
  --theme-toggle-background: 220 13% 20%;
  --theme-toggle-foreground: 0 0% 86%;
  --error: 0 90% 60%;             /* VSCode-style error red */
  --error-foreground: 0 0% 100%;  /* White text on error */
}

/* Update dark mode shadows for VSCode style */
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .footer {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Update dark mode input focus for VSCode style */
:root[data-theme="dark"] .input:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 1px hsl(var(--primary));
}

/* Update dark mode button hover for VSCode style */
:root[data-theme="dark"] .button:hover {
  background-color: hsl(var(--primary-hover));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Update light mode colors for better contrast */
:root[data-theme="light"] {
  --background: 220 14% 96%;      /* Slightly darker background #f3f4f6 */
  --foreground: 240 5.9% 10%;     /* Zinc-950 */
  --primary: 240 5.9% 10%;        /* Zinc-950 */
  --primary-hover: 240 4.8% 20%;  /* Zinc-800 */
  --primary-foreground: 0 0% 98%; /* Zinc-50 */
  --muted-foreground: 240 3.8% 46.1%; /* Zinc-500 */
  --border: 240 5.9% 90%;         /* Zinc-200 */
  --input: 240 5.9% 90%;          /* Zinc-200 */
  --input-background: 0 0% 100%;   /* White */
  --card-background: 0 0% 100%;    /* White */
  --footer-background: 0 0% 100%;  /* White */
  --link: 240 5.9% 10%;           /* Zinc-950 */
  --link-hover: 240 4.8% 20%;     /* Zinc-800 */
  --theme-toggle-background: 0 0% 100%;
  --theme-toggle-foreground: 240 5.9% 10%;
}

/* Add macOS-style blur effects */
.card {
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
}

.theme-toggle {
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
}

/* Update shadows for macOS style */
.card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1),
              0 5px 10px rgba(0, 0, 0, 0.2);
}

.theme-toggle {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1),
              0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Add subtle border glow for focused elements */
.input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.2);
}

/* Update button hover effect */
.button:hover {
  background-color: hsl(var(--primary-hover));
  transform: none;
  box-shadow: none;
}

.button:active {
  transform: translateY(1px);
}

/* Step container */
.step-container {
  transition: opacity 0.3s ease;
}

/* User info for password step */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  margin-bottom: 16px;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color 0.2s ease;
  font-size: var(--font-size-sm);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.user-info:hover {
  color: hsl(var(--foreground));
}

.user-info i {
  font-size: 14px;
}

#selected-username {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

/* Button group */
.button-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
}

/* Update button styles */
.button {
  min-width: 108px;
  height: 40px;
  padding: 0 16px;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto;
}

/* Update input styles */
.input {
  height: 40px;
  padding: 8px 12px;
}

/* Update mobile styles */
@media (max-width: 480px) {
  .card {
    padding: 24px;
  }
  
  .button-group {
    flex-direction: column-reverse;
    gap: 16px;
    align-items: stretch;
  }
  
  .button {
    width: 100%;
    margin-left: 0;
  }
  
  .forgot-password {
    text-align: center;
  }

  .footer {
    margin-top: 0.75rem;
    padding: 20px 24px;
  }
}

/* Update error colors */
:root {
  --error: 0 84.2% 60.2%;         /* Red-500 */
  --error-foreground: 0 0% 98%;    /* Zinc-50 */
}

/* Update input focus state */
.input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(240 6% 10% / 0.08);
}

/* Update card and footer shadows for subtlety */
.card,
.footer {
  box-shadow: 0 1px 2px hsl(240 6% 10% / 0.05),
              0 1px 8px hsl(240 6% 10% / 0.08);
}