/* Shared immersive login (student / parent / teacher) */
:root{ --pwa-yellow:#F5C518; --pwa-yellow-deep:#E0AE00; --ink:#0B1638; }
html,body{min-height:100%;}
body.auth-immersive{
  --font-heading:'Manrope','Segoe UI',var(--font);
  margin:0;min-height:100vh;min-height:100dvh;height:auto;display:flex;flex-direction:column;
  background:#0B1638;color:#fff;overflow:visible;
}
.auth-stage{position:relative;flex:1;display:flex;align-items:stretch;min-height:0;width:100%;}
.auth-photo{position:absolute;inset:0;z-index:0;overflow:hidden;}
.auth-photo picture,.auth-photo img{
  width:100%;height:100%;object-fit:cover;object-position:center 42%;
  display:block;transform:scale(1.06);
}
.auth-photo-scrim{
  position:absolute;inset:0;
  background:
    linear-gradient(105deg, rgba(8,14,32,.12) 0%, rgba(8,14,32,.35) 48%, rgba(8,14,32,.78) 78%, rgba(11,22,56,.92) 100%),
    radial-gradient(ellipse 55% 45% at 18% 18%, rgba(245,197,24,.18), transparent 55%);
}

.auth-brand{
  position:absolute;z-index:2;top:max(18px, env(safe-area-inset-top));left:28px;
  display:flex;align-items:center;gap:12px;
}
.auth-brand-mark{
  width:46px;height:46px;border-radius:13px;background:var(--pwa-yellow);
  display:grid;place-items:center;box-shadow:0 8px 22px rgba(245,197,24,.35);
}
.auth-brand-mark img{width:100%;height:100%;object-fit:contain;padding:3px;box-sizing:border-box;background:#fff;border-radius:10px;}
.auth-brand h1{margin:0;font-family:var(--font-heading);font-size:22px;font-weight:800;letter-spacing:.08em;}
.auth-brand p{margin:3px 0 0;font-size:10px;letter-spacing:.22em;color:rgba(255,255,255,.65);text-transform:uppercase;}

.auth-copy{
  position:relative;z-index:1;flex:1.2;display:flex;flex-direction:column;justify-content:center;
  padding:48px 40px 48px;max-width:620px;
}
.auth-emblem{
  width:132px;height:132px;border-radius:32px;margin-bottom:28px;
  background:linear-gradient(160deg,#fff 0%,#F7F8FC 100%);
  border:1px solid rgba(245,197,24,.45);
  box-shadow:0 22px 50px rgba(0,0,0,.35), 0 0 0 8px rgba(245,197,24,.12);
  display:grid;place-items:center;overflow:hidden;
}
.auth-emblem img{width:86%;height:86%;object-fit:contain;display:block;}
.auth-copy h2{margin:0 0 12px;font-family:var(--font-heading);font-size:clamp(28px,4.2vw,42px);font-weight:800;line-height:1.15;}
.auth-copy h2 em{font-style:normal;color:var(--pwa-yellow);}
.auth-copy > p{margin:0;color:rgba(255,255,255,.82);font-size:15px;line-height:1.55;max-width:36ch;}
.auth-pills{display:flex;flex-wrap:wrap;gap:8px;margin-top:22px;}
.auth-pills span{
  display:inline-flex;align-items:center;gap:6px;padding:7px 12px;border-radius:999px;
  background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.18);font-size:12px;font-weight:600;
  backdrop-filter:blur(6px);
}

.auth-panel-wrap{
  position:relative;z-index:2;flex:0 0 min(460px,100%);
  display:flex;align-items:center;justify-content:center;
  padding:28px 28px;padding-bottom:max(28px, env(safe-area-inset-bottom));
}
.auth-panel{
  width:100%;max-width:400px;background:rgba(255,255,255,.97);color:var(--ink);
  border-radius:24px;padding:26px 26px 22px;
  box-shadow:0 28px 60px rgba(0,0,0,.4), 0 0 0 1px rgba(245,197,24,.25);
  animation:auth-in .55s ease both;
}
@keyframes auth-in{from{opacity:0;transform:translateY(16px);}to{opacity:1;transform:none;}}
.auth-panel-crest{
  width:72px;height:72px;border-radius:20px;margin:0 auto 16px;
  background:linear-gradient(160deg,#FFF8E1,#FFE56A 40%,#F5C518);
  display:grid;place-items:center;
  box-shadow:0 12px 28px rgba(245,197,24,.35);
  border:1px solid rgba(224,174,0,.35);
}
.auth-panel-crest img{
  width:78%;height:78%;object-fit:contain;background:#fff;border-radius:14px;padding:4px;box-sizing:border-box;
}
.auth-role{
  display:inline-flex;align-items:center;justify-content:center;gap:10px;
  width:100%;box-sizing:border-box;
  padding:11px 16px;border-radius:14px;
  font-size:15px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;
  margin:0 0 14px;line-height:1.2;
  border:2px solid transparent;
}
.auth-role i{font-size:20px;flex-shrink:0;}
.auth-role.is-student{
  background:linear-gradient(135deg,#0F1D45,#1A3A7A);
  color:#fff;border-color:#0F1D45;
  box-shadow:0 8px 20px rgba(15,29,69,.22);
}
.auth-role.is-student i{color:var(--pwa-yellow,#F5C518);}
.auth-role.is-parent{
  background:linear-gradient(135deg,#F5C518,#FFE56A);
  color:#0F1D45;border-color:#E0AE00;
  box-shadow:0 8px 20px rgba(224,174,0,.28);
}
.auth-role.is-parent i{color:#0F1D45;}
.auth-role.is-teacher{
  background:linear-gradient(135deg,#0F1D45,#243B6B);
  color:#fff;border-color:#0F1D45;
  box-shadow:0 8px 20px rgba(15,29,69,.22);
}
.auth-role.is-teacher i{color:var(--pwa-yellow,#F5C518);}
.auth-panel h3{margin:0 0 6px;font-family:var(--font-heading);font-size:24px;font-weight:800;}
.auth-panel .lead{margin:0 0 18px;font-size:13px;color:#667;line-height:1.45;}
.auth-panel .fg{margin-bottom:14px;}
.auth-panel .fg label{display:block;font-size:11px;font-weight:800;color:#667;margin-bottom:6px;letter-spacing:.04em;text-transform:uppercase;}
.auth-panel .fg-wrap{position:relative;}
.auth-panel .fg-wrap i{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:#99A;font-size:17px;}
.auth-panel .fg-wrap input{
  width:100%;min-height:48px;border:1.5px solid #E2E6F0;border-radius:12px;
  padding:12px 14px 12px 40px;font-size:16px;background:#F7F8FC;color:var(--ink);
  outline:none;font-family:inherit;box-sizing:border-box;
}
.auth-panel .fg-wrap input:focus{border-color:var(--pwa-yellow-deep);background:#fff;box-shadow:0 0 0 3px rgba(245,197,24,.25);}
.auth-row{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:4px 0 16px;font-size:13px;}
.auth-row .remember{display:flex;align-items:center;gap:6px;color:#667;cursor:pointer;}
.auth-row a{color:#0F1D45;font-weight:700;text-decoration:none;}
.auth-row a:hover{text-decoration:underline;}
.login-msg{min-height:18px;font-size:13px;margin-bottom:10px;color:#B3261E;}
.auth-submit{
  width:100%;min-height:52px;border:none;border-radius:14px;cursor:pointer;
  background:linear-gradient(135deg, var(--pwa-yellow) 0%, var(--pwa-yellow-deep) 100%);
  color:#1A1400;font-family:var(--font-heading);font-size:15px;font-weight:800;
  box-shadow:0 12px 28px rgba(245,197,24,.4);transition:transform .2s, filter .2s;
}
.auth-submit.teacher{
  background:linear-gradient(135deg,#0F1D45,#1B2E6B);
  color:#fff;box-shadow:0 12px 28px rgba(15,29,69,.4);
}
.auth-submit:hover{filter:brightness(1.05);transform:translateY(-2px);}
.auth-hint{
  margin-top:14px;padding:12px;border-radius:12px;background:#FFF8E1;border:1px solid #FFE082;
  font-size:12px;color:#5D4A00;display:flex;gap:8px;line-height:1.45;
}
.auth-hint i{color:var(--pwa-yellow-deep);font-size:16px;flex-shrink:0;margin-top:1px;}
.auth-back{margin-top:16px;text-align:center;}
.auth-back a{color:#556;font-size:13px;font-weight:600;text-decoration:none;}
.auth-back a:hover{color:#0F1D45;}

/* Arabic / RTL */
html[dir="rtl"] .auth-copy{text-align:right;}
html[dir="rtl"] .auth-panel{text-align:right;}
html[dir="rtl"] .auth-panel .fg-wrap i{left:auto;right:12px;}
html[dir="rtl"] .auth-panel .fg-wrap input{padding:12px 40px 12px 14px;}
html[dir="rtl"] .auth-hint{flex-direction:row-reverse;text-align:right;}
html[dir="rtl"] .auth-pills{justify-content:flex-end;}
html[dir="rtl"] .auth-pills span{flex-direction:row-reverse;}
@media(min-width:821px){
  html[dir="rtl"] .auth-stage{flex-direction:row-reverse;}
  html, body.auth-immersive{
    height:100%;
    overflow:hidden;
  }
  body.auth-immersive{
    height:100dvh;
    min-height:100dvh;
    max-height:100dvh;
    overflow:hidden;
  }
  .auth-stage{height:100%;min-height:0;overflow:hidden;}
}

@media(max-width:820px){
  html,body{height:auto;min-height:100%;}
  body.auth-immersive{
    min-height:100dvh;height:auto;max-height:none;
    overflow:visible !important;
  }
  .auth-stage{flex-direction:column;justify-content:flex-start;min-height:0;height:auto;overflow:visible;}
  .auth-photo{
    position:relative;inset:auto;flex:0 0 auto;
    height:clamp(170px, 30vh, 240px);width:100%;
  }
  .auth-photo picture,.auth-photo img{transform:scale(1.08);object-position:center 42%;}
  .auth-photo-scrim{
    background:
      linear-gradient(180deg, rgba(8,14,32,.2) 0%, rgba(8,14,32,.45) 50%, #0B1638 100%),
      radial-gradient(ellipse 70% 40% at 50% 0%, rgba(245,197,24,.14), transparent 55%);
  }
  .auth-brand{top:max(12px, env(safe-area-inset-top));left:14px;gap:10px;}
  html[dir="rtl"] .auth-brand{left:auto;right:14px;}
  .auth-brand-mark{width:38px;height:38px;border-radius:11px;}
  .auth-brand h1{font-size:17px;letter-spacing:.06em;}
  .auth-brand p{display:none;}
  .auth-copy{display:none;}
  html[dir="rtl"] .auth-stage{flex-direction:column;}
  html[dir="rtl"] .auth-panel .fg-wrap i{left:auto;right:12px;}
  html[dir="rtl"] .auth-panel .fg-wrap input{padding:12px 40px 12px 14px;}
  html[dir="rtl"] body.auth-immersive,
  html[dir="rtl"] .auth-stage{overflow-x:hidden;}
  .auth-panel-wrap{
    flex:1 1 auto;width:100%;align-items:stretch;justify-content:flex-start;
    padding:0;padding-bottom:env(safe-area-inset-bottom, 0);
    background:#0B1638;
  }
  .auth-panel{
    max-width:none;border-radius:22px 22px 0 0;padding:18px 18px 22px;
    min-height:100%;box-shadow:0 -10px 36px rgba(0,0,0,.28);
  }
  .auth-panel-crest{width:64px;height:64px;border-radius:18px;margin-bottom:12px;}
  .auth-role{margin-bottom:12px;padding:12px 14px;font-size:14px;border-radius:12px;}
  .auth-role i{font-size:18px;}
  .auth-panel h3{font-size:20px;}
  .auth-panel .lead{margin-bottom:14px;font-size:12px;}
  .auth-panel .fg{margin-bottom:12px;}
  .auth-panel .fg-wrap input{min-height:46px;font-size:16px;}
  .auth-row{margin:2px 0 12px;flex-wrap:wrap;}
  .auth-submit{min-height:48px;font-size:14px;border-radius:12px;}
  .auth-hint{margin-top:12px;padding:10px;font-size:11px;}
  .auth-back{margin-top:12px;padding-bottom:4px;}
}
@media(max-width:380px){
  .auth-photo{height:clamp(150px, 26vh, 190px);}
  .auth-panel{padding:16px 14px 18px;}
  .auth-hint{display:none;}
}
