/* School portal — shared styles. Mobile first (iPhone 14: 390 x 844). */

:root {
  --bg: #FFF8EC;
  --card: #FFFFFF;
  --text: #1F2933;
  --muted: #5B6670;
  --green: #2E7D5B;
  --green-dark: #24644A;
  --blue: #2F6DB5;
  --blue-dark: #25589A;
  --line: #E4DCC9;
  --soft: #F6F1E4;
  --error: #B42318;
  --error-bg: #FEE4E2;
  --radius: 20px;
  --shadow: 0 6px 18px rgba(31, 41, 51, 0.10);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

main {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 8px;
  text-align: center;
}

.lead {
  color: var(--muted);
  text-align: center;
  margin: 0 0 20px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ---------- Login page ---------- */

.login-main {
  justify-content: center;
}

.login-title {
  font-size: 34px;
  margin-top: 8px;
}

.form label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.form input[type="password"] {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  font-size: 16px; /* 16px stops iOS Safari from zooming in */
  color: var(--text);
  background: #FFFFFF;
  border: 2px solid var(--line);
  border-radius: 14px;
  -webkit-appearance: none;
  appearance: none;
}

.form input[type="password"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 109, 181, 0.18);
}

.error {
  color: var(--error);
  background: var(--error-bg);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0 0 16px;
  text-align: center;
  font-weight: 600;
}

/* ---------- Buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin-top: 16px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  color: #FFFFFF;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--blue);
}

.btn-primary:active {
  background: var(--blue-dark);
}

/* ---------- Top bar (subject pages) ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 20px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
}

.nav-link:active {
  background: var(--soft);
}

/* ---------- Home page ---------- */

.subject-buttons {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 16px;
}

.subject-btn {
  flex-direction: column;
  min-height: 130px;
  margin-top: 0;
  font-size: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.subject-btn .icon {
  font-size: 42px;
  line-height: 1;
}

.btn-latein {
  background: var(--green);
}

.btn-latein:active {
  background: var(--green-dark);
}

.btn-englisch {
  background: var(--blue);
}

.btn-englisch:active {
  background: var(--blue-dark);
}

.footer-link {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
}

/* ---------- Subject pages ---------- */

.subject-title {
  font-size: 30px;
  margin: 0 0 16px;
}

.muted {
  color: var(--muted);
  text-align: center;
  margin: 0 0 16px;
}

.topic-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--soft);
  border-radius: 14px;
  color: var(--muted);
}

/* A topic that is a link: the whole row is tappable */
.topic-list li.link {
  padding: 0;
}

.topic-list li.link a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 14px 16px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  border-radius: 14px;
}

.topic-list li.link a:active {
  background: #ECE4CF;
}

.tag-open {
  background: var(--green);
  color: #FFFFFF;
}

.tag {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: #FFFFFF;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* Bigger screens: buttons side by side */
@media (min-width: 600px) {
  .subject-buttons {
    flex-direction: row;
  }

  .subject-btn {
    flex: 1;
  }
}
