/* ==========================================================================
   Base
   ========================================================================== */

body {
  font-family: Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   Icon buttons (navbar)
   ========================================================================== */

/*
  .theme-toggle-btn and .logout-button were byte-identical. One rule now, with
  both names kept so existing markup doesn't need to change.
*/
.icon-button,
.theme-toggle-btn,
.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-color);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 0;
  cursor: pointer;
  transition: border 0.2s ease;
}

.icon-button:hover,
.theme-toggle-btn:hover,
.logout-button:hover {
  border: 1px solid var(--hover-color);
  color: white;
}

.icon-button:focus-visible,
.theme-toggle-btn:focus-visible,
.logout-button:focus-visible {
  outline: 2px solid var(--button-background-color);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Icons

   These are <img src="*.svg">, which renders the SVG as a separate document.
   Page CSS does not cross that boundary, so `fill` has no effect — only
   `filter` applies, because it acts on the <img> element itself.

   The rule therefore depends on the icon alone: no parent class, no id. Any
   .icon inside a dark page inverts, whether it's the theme icon, the logout
   icon, or one added next week.
   -------------------------------------------------------------------------- */

.icon {
  width: 20px;
  height: 20px;
  margin: 12px;
  vertical-align: middle;
  transition: filter 0.2s ease;
}

[data-theme="dark"] .icon {
  filter: invert(1);
}

/* ==========================================================================
   Login page
   ========================================================================== */

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background-color: var(--card-background-color);
  color: var(--text-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.login-card h2 {
  margin: 0 0 1.5rem;
  text-align: center;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --------------------------------------------------------------------------
   Form fields
   -------------------------------------------------------------------------- */

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 0.625rem;
  box-sizing: border-box;   /* without this, width:100% + padding overflows */
  border: 1px solid var(--input-border-color);
  border-radius: 4px;
  background-color: var(--card-background-color);
  color: var(--text-color);
  font: inherit;            /* inputs don't inherit font-family by default */
}

.form-group input::placeholder {
  color: var(--text-color);
  opacity: 0.6;
}

.form-group input:focus-visible {
  outline: 2px solid var(--button-background-color);
  outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   Submit
   -------------------------------------------------------------------------- */

.submit-btn {
  width: 100%;
  background-color: var(--button-background-color);
  color: var(--button-text-color);
  padding: 0.75rem;
  border: none;
  border-radius: 4px;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Errors
   -------------------------------------------------------------------------- */

.alert-error {
  margin-top: 1rem;
  padding: 0.75rem;
  background-color: var(--error-bg, #b3261e);
  color: #fff;
  border-radius: 4px;
  text-align: center;
}

/* ==========================================================================
   Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
