* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
}

.logo-container {
  margin-bottom: 20px;
  text-align: center;
}

.logo {
  width: 100px;
  height: auto;
  max-width: 150px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  object-fit: contain;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px 30px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  text-align: center;
  width: 100%;
  max-width: 400px;
  position: relative;     /* Critical for overlay */
  overflow: hidden;       /* Prevent overflow */
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  color: #333;
}

p {
  color: #666;
  margin-bottom: 30px;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
}

input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
  width: 100%;
  padding: 14px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s;
  position: relative;
}

button:hover {
  background: #5a6fd8;
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  display: none; /* JS will toggle to flex */
}

.loading-overlay p {
  margin-top: 20px;
  color: #667eea;
  font-weight: 500;
  font-size: 16px;
}

/* Spinners */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff50;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  color: #e74c3c;
  margin-top: 15px;
  font-size: 14px;
  min-height: 20px;
}

.signup-link a, #showLogin a {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

.signup-link a:hover, #showLogin a:hover {
  text-decoration: underline;
}