:root{
  --red:#D71920;       /* FPT logo red */
  --blue:#012169;      /* FPT navy */
  --bg:#f4f6f8;
  --card:#ffffff;
  --text:#0b1b33;
  --muted:#6b7280;
}

.topbarLogoLink{
  display:flex;
  align-items:center;
  text-decoration:none;
}

/* Reset */
*{
  box-sizing:border-box;
  min-width:0;          /* FIX 1: prevents grid/flex overflow */
}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

/* =========================
   Thin Airmail Border
   ========================= */
body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  padding:10px;

  background:
    repeating-linear-gradient(
      135deg,
      var(--red) 0px,
      var(--red) 12px,
      white 12px,
      white 24px,
      var(--blue) 24px,
      var(--blue) 36px,
      white 36px,
      white 48px
    );

  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite:xor;
  mask-composite:exclude;
}

/* =========================
   App Shell
   ========================= */
.appMain{
  max-width:1200px;
  margin:0 auto;
  padding:28px 26px 60px;
  overflow:hidden;        /* FIX 2: prevents cards escaping layout */
}

/* =========================
   Top bar
   ========================= */
.topbar{
  width:100%;
  height:90px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 36px;
  border-bottom:2px solid rgba(1,33,105,0.18);
  box-shadow:0 2px 10px rgba(0,0,0,0.04);
  position:sticky;
  top:0;
  z-index:50;
}

.topbarLogo{
  height:52px;
  width:auto;
  display:block;
  object-fit:contain;
  transform:translateY(2px);
}

.topbarLogout{
  height:46px;
  padding:0 24px;
  border:none;
  cursor:pointer;
  background:var(--blue);
  color:#fff;
  font-weight:700;
  font-size:16px;
  border-radius:999px;
  display:flex;
  align-items:center;
  line-height:1;
}

/* =========================
   Cards
   ========================= */
.card{
  max-width:620px;
  margin:44px auto 0;
  padding:48px 40px;
  background:var(--card);
  border-radius:26px;
  box-shadow:0 25px 60px rgba(0,0,0,0.08);
  text-align:center;
}

.card.wide{
  max-width:980px;
  padding:54px 64px;
  text-align:left;
  position:relative;
  overflow:hidden;        /* FIX 3: keeps lesson lists inside card */
}

.card.wide::before{
  content:"";
  position:absolute;
  left:18px;
  top:22px;
  bottom:22px;
  width:4px;
  border-radius:999px;
  background:rgba(215,25,32,0.18);
}

/* =========================
   Index page logo
   ========================= */
.header{
  text-align:center;
  margin-bottom:10px;
}

.logo{
  height:72px;
  width:auto;
  max-width:100%;
  display:block;
  margin:0 auto 18px;
  object-fit:contain;
}

/* =========================
   Typography
   ========================= */
h1{
  margin:10px 0 10px;
  font-size:34px;
}

.sub{
  color:var(--muted);
  margin-bottom:28px;
}

.yearHeading{
  margin:0;
  font-size:44px;
  font-weight:800;
  letter-spacing:-0.02em;
}

.centerBlock{
  text-align:center;
  margin-top:18px;
}

.pageHeading{
  margin:10px 0 18px;
  font-size:30px;
  font-weight:800;
  letter-spacing:-0.01em;
  text-align:center;
  position:relative;
  display:inline-block;
}

.pageHeading::after{
  content:"";
  display:block;
  height:3px;
  width:46%;
  margin:10px auto 0;
  border-radius:999px;
  background:rgba(215,25,32,0.22);
}

/* =========================
   Forms
   ========================= */
.form{
  text-align:left;
  margin-top:20px;
}

label{
  display:block;
  font-weight:600;
  margin:16px 0 6px;
}

input{
  width:100%;
  padding:14px;
  border-radius:14px;
  border:1px solid #e5e7eb;
  background:#eef2f7;
  font-size:16px;
  color:var(--text);
}

/* =========================
   Password field
   ========================= */
.passwordField{
  position:relative;
}

.passwordField input{
  width:100%;
  padding-right:52px;
}

.passwordField .passwordToggle{
  position:absolute;
  top:50%;
  right:12px;
  transform:translateY(-50%);
  width:30px;
  height:30px;
  border:none;
  background:transparent;
  color:#6b7280;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.eyeIcon{
  width:18px;
  height:18px;
  display:block;
}

.hidden{
  display:none;
}

.form > .loginBtn{
  width:100%;
  margin-top:22px;
  padding:14px;
  border-radius:14px;
  border:none;
  background:var(--blue);
  color:white;
  font-size:17px;
  font-weight:700;
  cursor:pointer;
}

/* =========================
   Error + footer
   ========================= */
.error{
  margin-top:16px;
  padding:14px;
  background:#ffe3e3;
  color:#7a0000;
  border-radius:12px;
  text-align:center;
}

.footer{
  margin-top:28px;
  font-size:14px;
  color:var(--muted);
  line-height:1.5;
}

/* =========================
   Buttons
   ========================= */
.year,
.subject{
  display:block;
  padding:16px;
  margin:12px 0;
  border-radius:14px;
  background:var(--blue);
  color:white;
  text-align:center;
  text-decoration:none;
  font-size:16px;
  font-weight:800;
}

.choices{
  display:flex;
  flex-direction:column;
  align-items:center;
}

.choices .subject,
.choices .year{
  width:min(720px, 90%);
  padding:18px 16px;
}

/* =========================
   Footer
   ========================= */
#siteFooter{
  margin-top:28px;
  padding:16px 16px 22px;
  text-align:center;
  color:var(--muted);
  font-size:13px;
}

.footerSep{
  opacity:0.7;
}

/* =========================
   Floating Back Button
   ========================= */
.btnBackFloating{
  position:fixed;
  bottom:28px;
  right:28px;
  z-index:999;
  background:var(--red);
  color:#fff;
  text-decoration:none;
  font-weight:800;
  padding:14px 28px;
  border-radius:999px;
  box-shadow:0 14px 30px rgba(0,0,0,0.18);
}
