/* IELTS study web v2 — vanilla CSS, no framework, no external assets. */
:root {
  --bg: #edf1f7;
  --card: #ffffff;
  --ink: #16202e;
  --muted: #5d6b7f;
  --line: #e2e8f2;
  --brand: #0aa872;
  --brand-dark: #077a54;
  --brand-soft: #e2f5ec;
  --ok: #1e8e3e;
  --danger: #b00020;
  --warn-bg: #fff8e1;
  --warn-line: #ecd27a;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 2px rgba(16, 32, 54, 0.06), 0 4px 14px rgba(16, 32, 54, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
}

body > header,
body > nav.tabs,
body > main {
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ---------- app shell: sticky header + brand ---------- */

#app-header[hidden], #app-tabs[hidden] { display: none; }

#app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
  background: rgba(237, 241, 247, 0.92);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: block;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.02rem; letter-spacing: 0.1px; }
.brand-text span { font-size: 0.8rem; color: var(--muted); }

.badge {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.92rem;
}

/* ---------- segmented tab bar ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin: 2px auto 18px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.tabs button {
  flex: 1;
  min-height: 44px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 8px;
}

.tabs button[aria-selected="true"] {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 168, 114, 0.35);
}

/* ---------- cards, tasks ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 14px 0;
}

.card.warn { background: var(--warn-bg); border-color: var(--warn-line); box-shadow: none; }

.task-card h3, .card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.meta { color: var(--muted); font-size: 0.9rem; margin: 3px 0; }
.content { margin: 10px 0; font-size: 1.02rem; line-height: 1.65; }
.links { margin-top: 8px; }
.links a {
  display: inline-block;
  margin: 2px 12px 2px 0;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}
.links a:hover { text-decoration: underline; }

h2 { font-size: 1.2rem; margin: 24px 0 6px; }
h2 .count { margin-left: 4px; }

/* ---------- buttons, inputs ---------- */

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

button {
  min-height: 42px;
  min-width: 42px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius-s);
  border: 1px solid #c9d2e0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover { border-color: var(--brand); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }

#login-form { display: grid; gap: 12px; }
#login-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
#login-form button { width: 100%; }

input, select {
  min-height: 42px;
  padding: 9px 12px;
  font-size: 1rem;
  font-family: var(--font);
  border-radius: var(--radius-s);
  border: 1px solid #c9d2e0;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.error { color: var(--danger); font-weight: 600; }
.hint { color: var(--muted); font-size: 0.9rem; }
.count { color: var(--muted); font-weight: 400; font-size: 0.95rem; }

/* ---------- login (standalone card) ---------- */

#login-view {
  min-height: 70vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
}
#login-view[hidden] { display: none; }

.login-card { width: 100%; max-width: 420px; padding: 26px 26px 22px; }
.login-brand { text-align: center; margin-bottom: 10px; }
.login-logo {
  width: 100%;
  max-width: 150px;
  height: auto;
  border-radius: 16px;
  display: block;
  margin: 0 auto 10px;
}
.login-brand h2 { margin: 0 0 4px; font-size: 1.3rem; }
.login-brand .meta { margin: 0; }
.login-card h3 { margin: 16px 0 4px; font-size: 1.05rem; }

/* ---------- progress, calendar, user bar ---------- */

#progress-bar {
  height: 14px;
  background: #e4e9f2;
  border-radius: 999px;
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), #34c99a);
  border-radius: 999px;
  transition: width 0.25s ease;
}
#progress-text { font-weight: 700; }

.cal-nav, .filters {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
.cal-nav > *, .filters > * { flex: 1 1 140px; }
.filters label, .cal-nav label { display: grid; gap: 4px; font-size: 0.92rem; }

#user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 4px;
}
#user-bar button { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }

main { padding-bottom: 56px; }

@media (max-width: 520px) {
  .brand-text strong { font-size: 0.95rem; }
  .brand-text span { font-size: 0.75rem; }
  .badge { padding: 6px 10px; font-size: 0.82rem; }
  .tabs button { font-size: 0.92rem; min-height: 46px; }
  #login-view { padding-top: 4vh; }
}
