/* ==========================================================
   TABLE OF CONTENTS
   ==========================================================
   1. GLOBAL BASE RULES
      1.1 HTML & BODY
      1.2 BACKGROUND
      1.3 TEXT BLOCKS

   2. COMPONENT-SPECIFIC RULES
      2.1 CONTAINER
      2.2 FORM BLOCK
      2.3 FORM ELEMENTS

   3. RESPONSIVE OVERRIDES
      3.1 EXTRA SMALL PORTRAIT (<=400px)
      3.2 SMALL SCREENS (<=480px)
      3.3 MEDIUM PORTRAIT (<=768px)
      3.35 TABLET PORTRAIT (768px-1024px)
      3.4 MEDIUM SCREENS (<=1420px)
      3.5 LANDSCAPE COMPACT MODE (<=920px)
   ========================================================== */

/* ==========================================================
   1. GLOBAL BASE RULES
   ========================================================== */

/* 1.1 HTML & BODY */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
  color: #000;
  font-size: 11px;
  background-color: #ffffff;
  min-height: 100%;
}

/* 1.2 BACKGROUND */
.background {
  position: fixed;
  top: 50%;
  left: 50%;
  /* Fallback for older browsers */
  width: 100vw;
  height: 100vh;
  /* Modern browsers */
  width: 100dvw;
  height: 100dvh;
  background-image: url("../images/bg_schnauzerl.png");
  background-size: 60% auto;
  background-position: center;
  background-repeat: no-repeat;
  transform: translate(-50%, -50%);
  opacity: 0.1;
}

/* 1.3 TEXT BLOCKS */
.copyright,
.forgotten {
  position: absolute;
  color: #000;
  font-size: 12px;
  font-family: Arial, sans-serif;
  z-index: 1;
}

.copyright {
  top: 10px;
  left: 10px;
}

.forgotten {
  bottom: 10px;
  right: 10px;
}

/* ==========================================================
   2. COMPONENT-SPECIFIC RULES
   ========================================================== */

/* 2.1 CONTAINER */
.center.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 22px;
}

/* 2.2 FORM BLOCK */
.formlike {
  background-color: #fff;
  padding: 22px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 100%;
  z-index: 1;
  opacity: 0.7;
  border: 1px solid grey;
  margin-top: -35px;
}

form h1 {
  font-size: 22px;
  margin-bottom: 11px;
  text-align: center;
}

.error-message {
  background-color: #fee;
  color: #c33;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
  font-size: 12px;
  text-align: center;
  border: 1px solid #fcc;
}

/* 2.3 FORM ELEMENTS */
.input-group {
  margin-bottom: 16px;
  min-height: 70px;
}

.input-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: bold;
  color: #333;
  height: 18px;
}

input[type="text"],
input[type="password"] {
  display: block;
  width: 100%;
  padding: 10px 2.5em 10px 10px;
  margin-bottom: 6px;
  border: 1px solid grey;
  border-radius: 6px;
  font-size: 16px; /* prevents iOS zoom */
  box-sizing: border-box;
  transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Password eye icon inside input */
.password-wrapper {
  position: relative;
}

.password-wrapper .toggle-visibility {
  position: absolute;
  right: 0.6em;
  top: calc(50% + 8px); /* Adjust for label height */
  transform: translateY(-50%);
  cursor: pointer;
  color: #666;
  font-size: 1.2em;
  z-index: 2;
  line-height: 1;
  padding: 5px;
  transition: color 0.3s;
}

.password-wrapper .toggle-visibility:hover,
.password-wrapper .toggle-visibility:focus {
  color: #333;
}

button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  width: 100%;
  margin-top: 25px;
  background-color: #333;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-weight: bold;
}

button i {
  margin-right: 6px;
}

button:hover {
  background-color: #555;
}

button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

button:active {
  background-color: #222;
}

/* ==========================================================
   3. RESPONSIVE OVERRIDES
   ========================================================== */

/* 3.1 EXTRA SMALL PORTRAIT (<=400px) */
@media (max-width: 400px) and (orientation: portrait) {
  .formlike {
    max-width: 250px;
    width: 100%;
    padding: 16px;
  }
  .password-wrapper .toggle-visibility {
    font-size: 1em;
  }
}

/* 3.2 SMALL SCREENS (<=480px) */
@media (max-width: 480px) {
  .formlike {
    padding: 16px;
    max-width: 90%;
  }

  button {
    font-size: 12px;
    padding: 10px;
  }
}

/* 3.3 MEDIUM PORTRAIT (<=768px) */
@media screen and (orientation: portrait) and (max-width: 768px) {
  .formlike {
    margin-top: -125px;
  }

  .background {
    background-image: url("../images/bg_schnauzerp.png");
    width: 100vw;
    height: 100vh;
    background-position: center;
    background-repeat: no-repeat;
    transform: translate(-50%, -50%);
    /* height-based scaling, width capped by screen */
    background-size: auto min(70%, 100vw / 0.81); /* 0.81 = image width / height */
  }
}

/* 3.35 TABLET PORTRAIT (768px-1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .background {
    background-image: url("../images/bg_schnauzerp.png");
    width: 100vw;
    height: 100vh;
    background-position: center;
    background-repeat: no-repeat;
    transform: translate(-50%, -50%);
    background-size: auto min(70%, 100vw / 0.81);
  }
}

/* 3.4 MEDIUM SCREENS (<=1420px) */
@media (max-width: 1420px) {
  .copyright,
  .forgotten {
    font-size: 10px;
  }
}

/* ==========================================================
   3.5 LANDSCAPE COMPACT MODE (<=920px)
   ========================================================== */
@media screen and (max-width: 920px) and (orientation: landscape) {
  /* Base compact layout adjustments */
  .formlike.compact {
    background: none;
    box-shadow: none;
    border: none;
    padding: 0;
    opacity: 1;
    margin: 0;
    transform: translateY(-20%);
    transition:
      transform 0.4s ease,
      opacity 0.4s ease;
  }

  .formlike.compact h1 {
    font-size: 22px;
    margin-bottom: 6px;
    text-align: center;
  }

  /* Keep input and button spacing tidy */
  .formlike.compact .input-group,
  .formlike.compact button {
    margin-bottom: 10px;
  }

  .copyright,
  .forgotten {
    display: none;
  }
}