/* ───────────────────  THEME COLORS  ─────────────────── */
:root {
    /* backgrounds */
    --bg-light:     #f5f5f5d7;
    --bg-dark:      #111827;

    /* text */
    --text-light:   #111827;
    --text-dark:    #f5f5f5;

    /* cards */
    --card-light:   #ffffff;
    --card-dark:    #1f2937;

    /* borders */
    --border-light: #e5e7eb;
    --border-dark:  #374151;

    /* accent */
    --accent:       #3b82f6;

    /* chart */
    --chart-text:   #111827;
    --chart-grid:   #aaaaaaaa;
}



/* ───────────────────  GLOBAL  ─────────────────── */
html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background: var(--bg-light);
    color: var(--text-light);
    transition: background 0.3s, color 0.3s;
}
body.dark {
    background: var(--bg-dark);
    color: var(--text-dark);
}
.bold{
    color: var(--accent);
}




/* ───────── HEADER ───────── */
header {
    background: var(--card-light);
    border-bottom: 1px solid var(--border-light);
    padding: .5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .03);
    position: relative;
    height: 32px;
}
body.dark header {
    background: var(--card-dark);
    border-color: var(--border-dark);
}
#header {
    width: 100%;
    position: relative;
    margin: 0 auto;
    font-size: 1rem;
    color: var(--text-light);
    border-collapse: collapse;
}
#header, #header tr{
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
body.dark #header { 
    color: var(--text-dark); 
}
.headerLinks {
    padding: .5rem 1rem;
    text-align: center;
    white-space: nowrap;      
    transition: color .2s;
}
.headerLinks:first-child {  
    text-align: left;
    width: 48px;           
}
.headerLinks img {
    height: 32px;
    vertical-align: middle;
}
#header .headerLinks:nth-child(2) {    
    font-size: 1.12rem;
    color: var(--accent);
}
.headerLinks:not(:first-child):hover {
    cursor: pointer;
    color: var(--accent);
}
.logoCell{
    position: absolute;
    left: 10%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
}
.logoCell .brand{
    font-size: 1.2rem;
    color:var(--accent);
}
.actions {
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 2rem;
    align-items: center;
}
.actions > *{
    display:flex; 
    align-items:center;
    line-height:24px;/
}
.actions a, #themeToggle svg{
  display: inline-block;
  vertical-align: middle;
}
.actions a {
    color: var(--text-light);
    text-decoration: none;
    transition: color .2s;
}
body.dark .actions a { 
    color: var(--text-dark); 
}
.actions a:hover, body.dark .actions a:hover{ 
    color: var(--accent); 
}
#themeToggle{
    background:none;
    border:none;
    padding:0;
    cursor:pointer;
    display:flex;    
    align-items:center;
    justify-content:center;
    line-height: 0;
    font-size:0; 
}
.underlined{
    text-decoration: underline;
}
#themeToggle svg{
    width:24px;
    height:24px;
    stroke:var(--text-light);
    transition:stroke .3s;
    display: block;
    position: relative;
    top: -4px;
}
body.dark #themeToggle svg{ 
    stroke:var(--text-dark); 
}
.actions a.active {
    position: relative;
    color: var(--accent);
    font-weight: 600;
}
.actions a.active::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    bottom: -4px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}
body.dark .actions a.active {
    color: var(--accent);
}



/* ───────────────────  CARD  ─────────────────── */
.card {
    position: relative;
    width: 60%;
    max-width: 420px;
    margin: 4rem auto 0.5rem;
    padding: 2rem;
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    background: var(--card-light);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .05);
    transition: background .3s, border .3s;
    overflow: hidden;
}
body.dark .card {
    background: var(--card-dark);
    border-color: var(--border-dark);
}



/* ───────────────────  PROGRESS BAR  ─────────────────── */
#progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    width: 0;
    background: var(--accent);
    transition: width .4s;
    border-top-left-radius:1rem;
}



/* ───────────────────  FORM INPUT FIELDS  ─────────────────── */
button, input, select {
    box-sizing: border-box;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    font-size: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    transition: background 0.2s, transform 0.2s;
}
button{
    cursor: pointer;
}
body.dark input, body.dark select, body.dark button:not(.role-btn) {
    border-color: var(--border-dark);
    background-color: var(--card-dark);
    color: var(--text-dark);
}
body.dark button:not(.role-btn, .pw-toggle){
    background: var(--border-dark); 
    cursor: pointer;
}
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .1);
}
#step2Btns {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
#step2Btns button {
    width: auto;  
}
.back-btn {
    flex: 1;
}
.signup-btn {
    flex: 3;
}
.error {
    color: red;
    font-size: 0.9em;
    margin-top: 0.25em;
}
.success {
    color: var(--accent);
    font-size: 0.9em;
    margin-top: 0.25em;
}



/* ───────────────────  FADE UTILITY  ─────────────────── */
.fade{ 
    opacity: 0; 
    transform: scale(.98); 
    transition: opacity .3s ease, transform .3s ease; 
}
.fade.show{ 
    opacity: 1; transform: scale(1);
}



/* ───────────────────  LOADER  ─────────────────── */
.loader{
    position: fixed;
    top:0;
    left:0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background:rgba(0,0,0,.65);
    transition: opacity 0.8s, visibility 0.8s;
}
.loader.hidden{
    opacity: 0;
    visibility: hidden;
}
.loader::after{
    content: "";
    width: 64px;
    height: 64px;
    border:6px solid rgba(255,255,255,.25);
    border-top-color:#3b82f6;
    border-radius:50%;
    animation: spin 0.8s ease infinite;
    margin:0 auto 1rem;
}
@keyframes spin{
    from{
        transform: rotate(0turn);
    }
    to{
        transform:rotate(1turn);
    }
}




/* ───────────────────  ROLE SELECTION  ─────────────────── */
.role-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}
.role-select p   { 
    margin: 0; 
    font-size: 1.5rem; 
}
.role-btn{
    background: none;
    color: var(--text-light);
    border: none;
    font-size: 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .3s;
}
body.dark .role-btn{
    color: var(--text-dark);
}
.role-btn:hover  { 
    transform: translateY(-4px); 
}
.role-select.fade { 
    animation: fadeOut .4s forwards; 
}
@keyframes fadeOut {
    to { opacity: 0; transform: scale(.95); }
}



/* ───────────────────  STUDENT/TEACHER HEADER  ─────────────────── */
.form-header { 
    display: none; 
    margin-bottom: 1rem; 
}

.head {
    flex: 1;
    text-align: center;
    padding: .75rem;
    font-weight: 600;
    border: 1px solid var(--border-light);
    transition: background .3s, color .3s;
    cursor: pointer;
    
}
body.dark .head { 
    border-color: var(--border-dark); 
}
.head.active{ 
    background: var(--accent); color: #fff; 
}
@keyframes slideDown {
from { transform: translateY(-2rem); opacity: 0; }
to   { transform: translateY( 0   ); opacity: 1; }
}



/* ───────────────────  SIGN IN PAGE LINK  ─────────────────── */
.alt-auth{
    margin: 0 auto 3rem;
    font-size: 0.9rem;
    text-align: left;
    width: 72%;
    max-width: 480px;
}
.alt-auth a{
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}
.alt-auth a:hover{ 
    text-decoration: underline; 
}



/* ───────────────────  PASSWORD VISIBILITY TOGGLE  ─────────────────── */
.pw-wrapper{
    position:relative;
    display:flex;
    align-items:center;
    gap:0.5rem
}
.pw-wrapper input{
    flex:1
}
.pw-toggle{
    background:none;
    border:none;
    cursor:pointer;
    padding:0;
    width:24px;
    height:24px;
    display:flex;
    align-items:center;
    justify-content:center;
}
.pw-toggle svg{
    width:100%;
    height:100%
}



/* ───────────────────  FORGOT PASSWORD LINK  ─────────────────── */
.forgot-link{
    margin-top: 0.2rem;
    font-size:0.9rem; 
    color: var(--accent); 
    text-decoration: none;
    cursor: pointer;
}
/* POP UP CARDS */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 100;
}
.modal-card {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    background: var(--card-light);
    padding: 2rem;
    border-radius: .5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    width: 70%; 
    max-width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 101;
}
.modal-card h3 {
    margin-top: 0;
    border-bottom: 2px solid var(--accent);
    padding-bottom: .5rem;
}
.modal-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.modal-card label {
    display: flex;
    flex-direction: column;
    font-weight: 500;
}
.modal-card .button-group {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.modal-card .button-group button {
    padding: .5rem 1rem;
    border-radius: .25rem;
    border: 1px solid var(--border-light);
    cursor: pointer;
    background: var(--card-light);
}
.modal-card .button-group .save-btn {
    background: var(--accent);
    color: #fff;
    border: none;
}
body.dark .modal-card {
    background: var(--card-dark);
    color: var(--text-dark);
    border: 1px solid var(--border-dark);
}
body.dark .modal-close, body.dark .modal-skip{
    color: var(--text-light);
}
.bold{
    color: var(--accent);
}
.error {
    color: red;
    font-size: 0.9em;
    margin-top: 0.25em;
}





/* ───────────────────  MOBILE COMPATIBALITY  ─────────────────── */
/* iPhone Pro Max n bigger */
@media (max-width:600px){
    header{
        height: auto;
        padding: 0.5rem 0;
    }
    #header, #header tr{
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        gap: 6.6rem;
    }
    .logoCell{
        position: static;
        transform: none;
        gap: 0.25rem;
        margin-right: auto;
    }
    .logoCell img{
        height:24px;
    }
    .logoCell .brand{
        font-size: 1.2rem;
    }
    .headerLinks:not(.logoCell){
        font-size: 0.64rem;
        padding: 0.25rem 0.5rem;
    }
    .actions{
        position: static;
        transform: none;
        gap: 0.7rem;
    }
    .actions a{
        font-size: 1rem;
    }
    .card{
        width: 70%;
        max-width: none;
        margin: 1.5rem auto .5rem;
        padding: 1.25rem;
    }
    .alt-auth{
        width: 80%;
    }
    .role-select p{
        font-size: 1.25rem;
    }
    .role-btn{
        font-size: 1.5rem;
    }
}



/* iPhone XR */
@media (max-width:414px){
    #header, #header tr{
        gap: 5.8rem;
    }
    .logoCell .brand{
        font-size: 1.2rem;
    }
    .actions a{
        font-size: 1rem;
    }
}



/* Pixel 7, Samsung Galaxy S20 Ultra */
@media (max-width:412px){
    #header, #header tr{
        gap: 5.6rem;
    }
    .logoCell .brand{
        font-size: 1.2rem;
    }
    .actions a{
        font-size: 1rem;
    }
}



/* iPhone Pro */
@media (max-width:400px){
    #header, #header tr{
        gap: 5.6rem;
    }
    .logoCell .brand{
        font-size: 1rem;
    }
    .actions a{
        font-size: 0.9rem;
    }
}
  


/* iPhone SE */
@media (max-width:375px){
    #header, #header tr{
        gap: 4.8rem;
    }
    .logoCell .brand{
        font-size: 1rem;
    }
    .actions a{
        font-size: 0.9rem;
    }
}



/* Samsung Galaxy S8+ */
@media (max-width:360px){
    #header, #header tr{
        gap: 4.8rem;
    }
    .logoCell .brand{
        font-size: 0.9rem;
    }
    .actions a{
        font-size: 0.8rem;
    }
}



/* Galaxy Z Fold 5  n smaller */
@media (max-width:344px){
    #header, #header tr{
        gap: 3.8rem;
    }
    .logoCell .brand{
        font-size: 0.9rem;
    }
    .actions a{
        font-size: 0.8rem;
    }
}