:root {
  --primary-bg: #f7f7fb;
  --primary-color: #101010;
  --secondary-bg: #fff;
  --input-bg: #f9f9fc;
  --input-border: #ddd;
  --button-bg: #101010;
  --button-hover: #24243e;
  --link: #101010;
  --link-hover: #ff6161;
  --logo-bg: #101010;
  --logo-stroke: #ff6161;
  --text-color: #222;
  --shadow: 0 6px 24px rgba(40,40,70,0.1);
}

[data-theme="dark"] {
  --primary-bg: #181828;
  --primary-color: #ff6161;
  --secondary-bg: #22223b;
  --input-bg: #24243e;
  --input-border: #444;
  --button-bg: #ff6161;
  --button-hover: #e04a4a;
  --link: #ff6161;
  --link-hover: #fff;
  --logo-bg: #ff6161;
  --logo-stroke: #fff;
  --text-color: #f7f7fb;
  --shadow: 0 6px 24px rgba(40,40,70,0.3);
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--primary-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  transition: background 0.3s, color 0.3s;
}

.theme-toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
}

#theme-switch {
  background: var(--button-bg);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.2s, color 0.2s;
}

#theme-switch:hover {
  background: var(--button-hover);
}

.auth-container {
  background: var(--secondary-bg);
  padding: 2.5rem 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 350px;
  text-align: center;
  transition: background 0.3s;
}

.auth-logo {
  margin-bottom: 1.5rem;
}

.auth-logo svg {
  background: var(--logo-bg);
  border-radius: 50%;
  display: block;
  margin: 0 auto 0.5rem auto;
  box-shadow: 0 3px 12px rgba(48,43,99,0.09);
}

.auth-logo h1 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--primary-color);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: bold;
  letter-spacing: 1px;
}

.auth-container h2 {
  margin-top: 0;
  margin-bottom: 1.2rem;
  color: var(--primary-color);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form input {
  box-sizing: border-box;
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  line-height: normal;
  outline: none;
  color: var(--text-color);
  transition: border-color 0.2s, background 0.3s, color 0.3s;
}

.auth-form input:focus {
  border-color: var(--primary-color);
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-field input {
  width: 100%;
  padding-right: 3rem;
}

/* Hide native password-reveal affordances (Edge legacy, some mobile browsers) so
   they don't overlap/shrink the field next to our own eye toggle button. */
.password-field input::-ms-reveal,
.password-field input::-ms-clear {
  display: none;
}

.password-toggle {
  position: absolute;
  right: 0.55rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: #555 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.password-toggle:hover,
.password-toggle:focus {
  background: rgba(16, 16, 16, 0.08) !important;
  color: var(--primary-color) !important;
  outline: none;
}

.password-eye {
  position: relative;
  width: 20px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 50% / 58%;
  display: inline-block;
}

.password-eye::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.password-eye::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(-42deg);
}

.password-toggle.is-visible .password-eye::after {
  display: none;
}

.auth-form button {
  padding: 0.8rem 1rem;
  background: var(--button-bg);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-form button:hover {
  background: var(--button-hover);
}

.auth-links {
  margin-top: 1rem;
  font-size: 0.95rem;
}

.auth-links a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s;
}

.auth-links a:hover {
  color: var(--link-hover);
}

.auth-logo img {
  display: block;
  margin: 0 auto 0.5rem auto;
  border-radius: 50%;
  box-shadow: 0 3px 12px rgba(48,43,99,0.09);
  background: var(--logo-bg);
  object-fit: cover;
  width: 60px;
  height: 60px;
}

/* Responsive */
@media (max-width: 500px) {
  .auth-container {
    padding: 2rem 0.7rem;
    max-width: 98vw;
  }
  .theme-toggle {
    right: 0.7rem;
    top: 0.7rem;
  }
}
