*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: #f4f4f4;
  color: #222;
}

/* --------- PAGE WRAPPERS --------- */

.main-wrapper,
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-wrapper {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.page-wrapper {
  padding: 20px 40px 40px;
}

/* When sidebar is present */
.page-wrapper.with-sidebar {
  flex-direction: row;
  align-items: stretch;
  padding: 0;
}

.page-content {
  flex: 1;
  padding: 20px 40px 40px;
}

/* --------- SIDEBAR --------- */

.sidebar {
  width: 52px;
  background: #f8f1ff;
  border-right: 1px solid #e0d1ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 40px;
  padding-bottom: 20px;
  position: relative;
}

.sidebar-item {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #c2a1ff;
  margin-bottom: 14px;
  display: block;
  background: linear-gradient(135deg, #fefeff, #e6d7ff);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.sidebar-item.bottom {
  margin-top: auto;
}

.sidebar-item.active {
  background: linear-gradient(135deg, #c88bff, #8c5cff);
  border-color: #7a4cf5;
}

.sidebar-item:hover {
  transform: translateY(-1px);
}

.sidebar-item:active {
  transform: translateY(0);
}

/* --------- DASHBOARD (index) --------- */

.dashboard-card {
  background: #ffffff;
  max-width: 1200px;
  width: 100%;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  padding: 30px 40px 25px;
  position: relative;
  overflow: hidden;
}

/* Bandeau haut */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.logo-box {
  display: inline-flex;
  flex-direction: column;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.logo-main {
  font-weight: 700;
}

.logo-sub {
  font-size: 11px;
  opacity: 0.8;
}

.top-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.burger {
  width: 18px;
  height: 2px;
  background: #000;
}

/* Layout principal */

.dashboard-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr;
  gap: 20px;
}

/* Colonne gauche */

.left-column {
  display: grid;
  grid-template-rows: 220px auto 160px;
  gap: 12px;
}

/* Bloc photo */

.photo-block {
  background: #c8dce8;
  position: relative;
  overflow: hidden;
}

.photo-overlay {
  position: absolute;
  inset: 25% 8% 15% 45%;
  border: 2px solid rgba(0, 0, 0, 0.7);
}

.photo-logo {
  position: absolute;
  top: 50%;
  left: 35%;
  transform: translate(-50%, -50%);
  width: 180px;
  opacity: 0.95;
  object-fit: contain;
}

/* Profil */

.profile-block {
  background: #ffffff;
  border: 1px solid #ddd;
  display: grid;
  grid-template-columns: 90px 1fr;
  padding: 16px;
  align-items: center;
  position: relative;
}

.avatar-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, #dcdcdc);
  border: 2px solid #bbb;
}

.profile-text {
  font-size: 11px;
  line-height: 1.4;
}

.student-name {
  font-size: 16px;
  margin: 0 0 4px;
  letter-spacing: 1px;
  color: #16345d;
}

/* Notes bloc */

.notes-block {
  position: relative;
  overflow: hidden;
}

/* Colonne de droite (grille) */

.grid-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tile-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tile-row:first-child .tile {
  height: 150px;
}

.tile-row:nth-child(2) .tile {
  height: 150px;
}

.tile-row:nth-child(3) .tile {
  height: 130px;
}

/* Tiles */

.tile {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.tile-label {
  text-transform: uppercase;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: left;
  line-height: 1.2;
}

/* Couleurs */

.tile-blue-dark {
  background: #143a64;
  color: #ffffff;
}

.tile-blue-light {
  background: #2fa0e8;
  color: #ffffff;
}

.tile-yellow {
  background: #f2c94c;
  color: #1b1b1b;
}

.tile-white {
  background: #f4f4f4;
  color: #111111;
}

.tile-pink {
  background: #f7a9c4;
  color: #ffffff;
}

.tile-email {
  background: #f5f5f5;
  position: relative;
}

.tile-email::before {
  content: "";
  position: absolute;
  width: 48px;
  height: 30px;
  border-radius: 4px;
  border: 2px solid #c9d34b;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Déconnexion */

.logout-row {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.logout-link {
  color: #b3b3b3;
  font-size: 13px;
  text-decoration: none;
}

.logout-link:hover {
  text-decoration: underline;
}

/* Footer dashboard */

.footer-bar {
  margin-top: 15px;
  font-size: 11px;
  text-align: right;
}

.footer-link {
  color: #777;
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* --------- PAGES INTERNES --------- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0 12px;
  border-bottom: 1px solid #dddddd;
}

.portal-name {
  font-size: 18px;
  letter-spacing: 1px;
}

.user-name {
  font-size: 14px;
  text-decoration: none;
  color: #333;
}

.content-area {
  max-width: 1200px;
  width: 100%;
  margin: 20px auto 0;
}

.page-main-title {
  font-size: 26px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 10px 0 25px;
}

.assiduite-card {
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
  padding: 18px 22px 25px;
}

.assiduite-header {
  border-bottom: 1px solid #e3e3e3;
  padding-bottom: 12px;
  margin-bottom: 16px;
  font-size: 13px;
}

.assiduite-body {
  font-size: 12px;
}

.assiduite-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.assiduite-subtitle {
  font-size: 14px;
  margin: 0 0 4px;
}

.assiduite-info-red {
  color: #cc0000;
  font-weight: 600;
  margin: 0 0 8px;
}

.assiduite-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Consolas", "Courier New", monospace;
}

.assiduite-table td {
  padding: 2px 4px;
}

.retards-block {
  margin-top: 25px;
}

.retards-title {
  font-size: 14px;
  margin-bottom: 8px;
}

.retards-info {
  background: #e4f3ff;
  border-left: 4px solid #4a90e2;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.icon-info {
  font-size: 14px;
}

/* Blank card */

.blank-card {
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.6;
}

/* Footer interne */

.page-footer {
  margin-top: auto;
  padding-top: 20px;
  font-size: 11px;
  color: #777;
}

.page-footer a {
  color: #777;
  text-decoration: none;
}

.page-footer a:hover {
  text-decoration: underline;
}

/* --------- LOGIN --------- */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f4f4;
}

.login-card {
  background: #ffffff;
  padding: 32px 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  text-align: left;
}

.login-logo {
  width: 180px;
  display: block;
  margin: 0 auto 20px auto;
}

.login-title {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.login-subtitle {
  margin: 0 0 18px;
  font-size: 13px;
  color: #666;
}

.login-label {
  font-size: 12px;
  margin-top: 10px;
  margin-bottom: 4px;
  display: block;
}

.login-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.login-input:focus {
  outline: none;
  border-color: #143a64;
  box-shadow: 0 0 0 1px rgba(20, 58, 100, 0.15);
}

.login-button {
  margin-top: 16px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 4px;
  background: #143a64;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.login-button:hover {
  background: #102b48;
}

.login-error {
  margin-top: 10px;
  font-size: 12px;
  color: #c0392b;
}

.login-footer-text {
  margin-top: 16px;
  font-size: 11px;
  color: #888;
  text-align: center;
}

/* --------- RESPONSIVE --------- */

/* Tablette paysage */
@media (max-width: 1024px) {
  .dashboard-card {
    max-width: 100%;
    padding: 20px;
  }

  .dashboard-layout {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .left-column {
    grid-template-rows: 200px auto 140px;
  }

  .content-area {
    padding: 0;
  }
}

/* Téléphone (mode vertical) */
@media (max-width: 768px) {

  body {
    background: #ffffff;
  }

  .main-wrapper {
    padding: 10px;
  }

  .dashboard-card {
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .left-column {
    grid-template-rows: auto auto auto;
  }

  .photo-block {
    height: 160px;
  }

  .photo-logo {
    width: 140px;
    left: 50%;
  }

  .profile-block {
    grid-template-columns: 70px 1fr;
    padding: 12px;
  }

  .student-name {
    font-size: 14px;
  }

  .tile-row {
    grid-template-columns: 1fr 1fr;
  }

  .tile-row:nth-child(2) .tile:nth-child(3) {
    grid-column: span 2;
  }

  .tile {
    min-height: 90px;
  }

  .tile-label {
    font-size: 12px;
    text-align: center;
  }

  .logout-row {
    margin-top: 4px;
  }

  /* Pages internes : sidebar en haut */
  .page-wrapper.with-sidebar {
    flex-direction: column;
  }

  .sidebar {
    flex-direction: row;
    width: 100%;
    height: 52px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid #e0d1ff;
  }

  .sidebar-item {
    margin: 0 10px 0 0;
  }

  .sidebar-item.bottom {
    margin-left: auto;
    margin-top: 0;
  }

  .page-content {
    padding: 16px;
  }

  .page-main-title {
    font-size: 20px;
    margin-top: 12px;
  }

  .assiduite-columns {
    grid-template-columns: 1fr;
  }
}

/* Très petit écran (< 480px) */
@media (max-width: 480px) {
  .dashboard-card {
    padding: 12px;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .tile-row {
    grid-template-columns: 1fr;
  }

  .notes-block {
    min-height: 120px;
  }

  .login-card {
    margin: 0 10px;
    padding: 20px 18px;
  }

  .login-logo {
    width: 150px;
  }

  .login-title {
    font-size: 20px;
  }

  .login-input {
    font-size: 13px;
  }

  .portal-name {
    font-size: 16px;
  }
}
