@import 'common.css';


/* Common */

body {
  margin: 0;
  min-height: 100vh;
}

main {
  margin: auto;
  max-width: 1400px;
  padding: 0 1em;
}

::before {
  display: inline-block;
  font-family: ForkAwesome;
  padding-right: 0.5em;
}

a {
  color: var(--blue);
  text-decoration: inherit;
  transition: 0.2s;
}

a:hover {
  text-decoration: underline;
}

li {
  list-style: none;
}


/* Tables */

table {
  border-collapse: collapse;
  margin: 1em 0;
}

table form {
  margin: 0;
  width: initial;
}

table input,
table .button {
  display: inline-block;
  float: initial;
  margin: calc(-0.2em - 1px) 0;
  padding: 0.2em;
  width: auto;
}

tr:not(:last-of-type) {
  border-bottom: 1px solid var(--grey);
}

tr > * {
  padding: 0.5em;
  text-align: right;
}

tr > :first-child {
  text-align: left;
}

tbody:has(tr:nth-of-type(3)) tr:nth-child(odd) {
  background: var(--grey-opacity);
}


/* Forms */

form {
  width: 50%
}

form > * {
  display: block;
}

label {
  margin-top: 1em;
}

input,
select,
textarea {
  background: var(--grey-opacity);
  border: 1px solid var(--blue-opacity);
  border-radius: 5px;
  margin: 0.5em 0 1.5em 0;
  padding: 1em;
  transition: 0.2s;
}

input[type="checkbox"][readonly],
input[type="radio"][readonly] {
  filter: grayscale(100);
  opacity: 0.5;
}

select {
  padding: 0.5em 1em;
}

input:focus,
select:focus,
textarea:focus {
  background: var(--grey);
}

input:not(input[type="checkbox"], input[type="radio"], .button),
select,
textarea {
  /* 100% - padding l/r - border l/r */
  width: calc(100% - 2em - 2px);
}

input[type="checkbox"],
input[type="radio"] {
  margin-left: -1.5em;
  margin-top: -1.5em;
  position: absolute;
}
label:has(+ input[type="checkbox"]),
label:has(+ input[type="radio"]) {
  padding-left: 2em;
}
label:has(+ input[type="checkbox"]) + input[type="checkbox"],
label:has(+ input[type="radio"]) + input[type="radio"] {
  margin-left: 0.5em;
}

.button {
  background: var(--red-opacity);
  border: 1px solid var(--red-opacity);
  border-radius: 5px;
  color: var(--white);
  float: right;
  margin-right: 0;
  min-width: min-content;
  padding: 1em;
  text-align: center;
  transition: 0.2s;
  width: 25%;
}

.button:hover {
  background: var(--red);
  cursor: pointer;
}

.danger {
  display: block;
  width: 100%;
}

.link {
  display: flex;
  justify-content: space-between;
  width: 50%;
}

.link input,
.link select {
  width: 70%;
}

.link .button {
  margin-left: 0;
  margin-right: 0;
  width: 25%;
}

.search {
  align-items: center;
  display: flex;
  justify-content: space-evenly;
  margin: 0;
  width: 100%;
}
.search input:first-of-type {
  width: 80%;
}
.search input.button {
  margin-left: 0;
  margin-right: 0;
  width: 15%;
}
.search label[for=archived] {
  font-size: 0.85em;
  margin-top: -1.5rem;
  text-align: center;
  padding: 0.5em;
}
.search #archived {
  appearance: none;
  background: var(--grey);
  border: 1px solid var(--blue-opacity);
  border-radius: 2em;
  color: transparent;
  cursor: pointer;
  display: block;
  font-size: 0.8em;
  height: 3em;
  margin: 0;
  position: relative;
  text-align: center;
  top: 0;
  width: 6em;
}
.search #archived::after {
  background: var(--white);
  border-radius: 1em;
  content: '';
  height: 2em;
  left: 0.5em;
  position: absolute;
  top: 0.5em;
  transition: 0.2s;
  width: 2em;
}
.search #archived:checked {
  background: var(--red-opacity);
  border-color: transparent;
}
.search #archived:checked::after {
  left: calc(100% - 0.5em);
  transform: translateX(-100%);
}
.search #archived:active::after {
  width: 3em;
}

/* Nav */

nav {
  background: var(--grey);
  border-bottom: 1px solid var(--red);
  display: flex;
  padding: 0.5em 5em;
  text-transform: uppercase;
}

nav a {
  color: var(--black);
  text-decoration: inherit;
}

nav img {
  display: block;
  height: 3em;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 0 auto;
}

nav li {
  margin: auto 0;
  padding: 0 0 0 2em;
}

nav li.profile a::before {
  content: "\f2c0";
}

nav li.logout a::before {
  content: "\f08b";
}

nav li.login a::before {
  content: "\f090";
}


/* Flash messages */

#messages {
  bottom: 0;
  position: fixed;
  left: 0;
  width: 20em;
}

#messages section {
  backdrop-filter: blur(0.3em);
  background: #fffc;
  border: 1px solid;
  border-radius: 0.2em;
  box-shadow: 0.1em 0.1em 0.3em #0004;
  font-size: 0.8em;
  line-height: 1.2;
  margin: 1em;
  padding: 1em 2em 1em 1em;
  position: relative;
}

#messages section input {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  display: block;
  line-height: 0.5;
  font-size: 1.5em;
  margin: 0;
  padding: 0.2em;
  position: absolute;
  right: 0;
  top: 0;
  width: min-content;
}

#messages section input::after {
  content: '×';
}

#messages section:has(input:checked) {
  display: none;
}


/* Main lists */

.main-list a {
  color: var(--black);
}

.main-list a::before {
  content: "\f061";
}

.main-list a:hover::before {
  color: var(--red);
}


/* Login */

#page-login {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

#page-login nav {
  display: none;
}

#page-login main {
  align-items: center;
  display: flex;
}

#page-login img {
  display: block;
  margin: 1em 2em;
  width: 30em;
}

#page-login form {
  width: 100%;
}

/* Marks */

#page-marks main form {
  width: 100%;
}

#page-marks main section {
  border-bottom: 1px solid var(--grey);
  display: flex;
  justify-content: space-between;
}

#page-marks main section:last-of-type {
  border-bottom: none;
}

#page-marks main section > * {
  margin: 1em 0;
  width: 30%;
}

#page-marks main textarea {
  height: 4em;
  padding: 0.25em 0.5em;
}

#page-marks main .button {
  bottom: 1em;
  margin: 0;
  position: fixed;
  right: 1em;
  width: 10%;
}


/* Report */

#page-report #marks-summary,
#page-report .absences-summary {
  display: inline-block;
  margin-right: 5em;
  vertical-align: top;
  min-width: 25%;
}

.validated {
  background: var(--mark-validated) !important;
}

.acquiring {
  background: var(--mark-acquiring) !important;
}

.non-validated {
  background: var(--mark-non-validated) !important;
}

.semester-marks table,
.semester-comment,
#special-mark {
  width: 100%;
}

.semester-marks table tr > *:nth-child(3),
.semester-comment tr > *:nth-child(2) {
  text-align: left;
  white-space: pre-wrap;
}
.semester-marks table tr > *:nth-child(3) {
  padding-left: 2em;
}

#page-generate_report form {
  width: 50%;
}

#page-generate_report .button {
  float: right;
  margin-right: 0;
}

/* Marks */

#page-marks h4 + textarea {
  width: 60%;
}

/* Teacher */

.labels {
  margin-bottom: 1em;
  padding-left: 1.4em;
}
.labels li {
  border-radius: 5px;
  display: inline-block;
  font-size: 0.8em;
  padding: 0.15em 0.3em 0.08em 0.3em;
}
.labels .label-marks::before {
  content: 'Notes :';
  font-family: inherit;
  padding-right: 0.5em;
}
.labels .full {
  background: var(--mark-validated);
}
.labels .ongoing {
  background: var(--mark-acquiring);
}
.labels .empty,
.label-comments {
  background: var(--mark-non-validated);
}

/* Super Administrator */

#actions {
  margin: 0;
  padding: 0 0 0 0.5em;
}

#actions a::before {
  content: "\f061";
}

#page-teaching_period table,
#page-production_action table {
  width: 80%;
}

#page-teaching_period #students {
  width: 100%;
}

#students tr > *[class] {
  text-align: center;
}

#add-semester {
  display: flex;
  justify-content: space-between;
  width: 80%;
}

#add-semester input {
  margin: 0;
  width: 22%;
}

#page-profile table {
  width: 50%;
}

#page-profile form table,
#page-profile form tbody,
#page-profile form tr {
  width: 100%;
}

#page-absences form {
  width: max-content;
}

#page-absences .button {
  margin: 0 0 0 auto;
}
