* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  background: #f2f4f7;
}

/* HEADER */
/* HEADER AVEC TITRE */
.site-header {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.site-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Overlay sombre pour lisibilité */
.header-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  padding-left: 40px;
}

/* Titre */
.header-overlay h1 {
  color: white;
  font-size: 28px;
  font-weight: bold;
  margin: 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}


/* LOGIN */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
}

.login-box {
  background: white;
  padding: 35px 40px;
  border-radius: 8px;
  width: 360px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 25px;
  font-size: 22px;
  color: #333;
}

input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 14px;
}

input:focus {
  outline: none;
  border-color: #0066cc;
}

/* Bouton du formulaire de login uniquement */
.login-box button {
  width: 100%;
  padding: 12px;
  background: #2f54a3;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
}

.login-box button:hover {
  background: #24428a;
}

.error {
  color: #c0392b;
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
}

/* NAV */
/* NAVIGATION */
.site-nav {
  background: white;
  border-bottom: 1px solid #e5e5e5;
}

.nav-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 16px;

  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.nav-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
}

.nav-left a {
  text-decoration: none;
  color: #333;
  font-size: 15px;
  white-space: nowrap;
}

.nav-left a.active {
  font-weight: bold;
  color: #2f54a3;
}

.logout-btn {
  width: auto;
  padding: 8px 14px;
  font-size: 14px;
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.logout-btn:hover {
  background: #eaeaea;
}



/* PAGE */
.page {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 16px;
}

.card {
  background: white;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.home-content {
  white-space: pre-wrap; /* garde les retours à la ligne */
  color: #333;
  line-height: 1.5;
}

/* POSTS */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.post-card {
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.post-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.post-card .post-body {
  padding: 12px;
}

.post-card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
}

.post-card p {
  margin: 0;
  color: #555;
  font-size: 14px;
  line-height: 1.4;
}

/* Report */
.muted {
  color: #666;
  margin-top: 6px;
}

.report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-top: 1px solid #eee;
}

.report-row:first-child {
  border-top: none;
}

.report-title {
  font-weight: bold;
  margin: 0 0 4px 0;
}

.report-date {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.report-actions {
  display: flex;
  gap: 8px;
}

.report-actions a {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f5f5f5;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.report-actions a:hover {
  background: #eaeaea;
}
 /* Posts */

 .post-link {
  text-decoration: none;
  color: inherit;
}

.post-link:hover .post-card {
  border-color: #ddd;
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.post-meta {
  margin: 0 0 8px 0;
  color: #777;
  font-size: 13px;
}

/* Post */

.back-link {
  display: inline-block;
  margin-bottom: 10px;
  color: #2f54a3;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.post-detail-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 8px;
  margin: 12px 0 14px 0;
}

.post-detail-content {
  white-space: pre-wrap;
  line-height: 1.6;
  color: #333;
}

.pdf-frame {
  width: 100%;
  height: 75vh;
  border: 1px solid #eee;
  border-radius: 8px;
}

.portal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-top: 1px solid #eee;
}
.portal-row:first-child { border-top: none; }

.portal-title { font-weight: bold; }

.preview-btn {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 14px;
}
.preview-btn:hover { background: #eaeaea; }

.pdf-frame {
  width: 100%;
  height: 75vh;
  border: 1px solid #eee;
  border-radius: 8px;
}

/* ==================================================
   NOUVEAU DESIGN — PAGE D'ACCUEIL UNIQUEMENT
================================================== */

.home-page {
  --home-primary: #2f63e9;
  --home-primary-light: #edf3ff;

  --home-secondary: #6f9f54;
  --home-secondary-light: #eef6e9;

  --home-text: #102445;
  --home-text-secondary: #475569;
  --home-background: #f3f6f2;

  --home-white: #ffffff;
  --home-border: #e2e8f0;
}


/* ==================================================
   NAVIGATION DE L'ACCUEIL
================================================== */

.home-page .site-nav {
  position: relative;
  z-index: 30;

  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.home-page .nav-container {
  position: relative;

  width: min(1420px, calc(100% - 48px));
  max-width: none;
  min-height: 125px;

  margin: 0 auto;
  padding-left: 250px;

  display: flex;
  align-items: center;
}


/* Logo de la résidence */

.home-page .site-logo {
  position: absolute;
  top: 18px;
  left: 0;

  width: 220px;
  height: 100%;

  z-index: 50;

  display: block;
  overflow: hidden;

  background: transparent;
  border-radius: 26px;

  text-decoration: none;

}


.home-page .site-logo img {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;
  object-position: center;

  /*
    Zoom dans le fichier pour éliminer les marges blanches
    présentes autour de la vraie pancarte.
  */

  border-radius: 26px;
}



/* Contenu du menu */

.home-page .nav-content {
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-page .nav-left {
  display: flex;
  align-items: center;
  gap: 34px;
}

.home-page .nav-left a {
  position: relative;

  padding: 40px 0 35px;

  color: var(--home-text);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;

  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.home-page .nav-left a:hover,
.home-page .nav-left a.active {
  color: var(--home-primary);
}

.home-page .nav-left a::after {
  content: "";

  position: absolute;
  bottom: 27px;
  left: 50%;

  width: 0;
  height: 3px;

  background: var(--home-primary);
  border-radius: 999px;

  transform: translateX(-50%);
  transition: width 0.2s ease;
}

.home-page .nav-left a:hover::after,
.home-page .nav-left a.active::after {
  width: 100%;
}


/* Bouton de déconnexion */

.home-page .logout-btn {
  width: auto;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 12px 18px;

  color: var(--home-primary);
  font-size: 15px;
  font-weight: 600;

  background: var(--home-primary-light);
  border: 1px solid transparent;
  border-radius: 999px;

  cursor: pointer;

  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.home-page .logout-btn:hover {
  color: white;
  background: var(--home-primary);
  transform: translateY(-1px);
}

.home-page .logout-icon {
  font-size: 18px;
}


/* Bouton du menu mobile */

.home-page .menu-toggle {
  display: none;

  margin-left: auto;
  padding: 8px 12px;

  color: var(--home-text);
  font-size: 25px;

  background: transparent;
  border: none;

  cursor: pointer;
}


/* ==================================================
   GRANDE PHOTO DU PORT
================================================== */

.home-page .site-header {
  position: relative;

  width: 100%;
  height: 180px;

  overflow: hidden;
  background: #dce7f3;
}

.home-page .site-header img {
  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;
}

.home-page .site-header::after {
  content: "";

  position: absolute;
  inset: 0;

  background:
    linear-gradient(
      to bottom,
      rgba(15, 23, 42, 0.01),
      rgba(15, 23, 42, 0.12)
    );

  pointer-events: none;
}

/*
  L'ancien titre sur l'image n'est plus utilisé.
  Cette règle le masque au cas où il resterait dans le HTML.
*/

.home-page .header-overlay {
  display: none;
}


/* ==================================================
   CONTENU PRINCIPAL
================================================== */

.home-page .page {
  width: min(1220px, calc(100% - 40px));
  max-width: none;

  margin: 24px auto 60px;
  padding: 0;
}

.home-page .card {
  padding: 28px;
  margin-bottom: 22px;

  background: var(--home-white);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;

  box-shadow:
    0 8px 30px rgba(15, 23, 42, 0.08);
}


/* ==================================================
   BLOC ACTUALITÉS
================================================== */

.home-page .news-card {
  position: relative;

  min-height: 120px;

  display: flex;
  align-items: center;
  gap: 24px;
    background:
    linear-gradient(
      90deg,
      #ffffff 0%,
      #ffffff 72%,
      #f2f8ee 100%
    );

  overflow: hidden;
}

.home-page .news-card::before {
  content: "";

  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;

  width: 5px;

  background: var(--home-primary);
}

.home-page .news-icon {
  width: 66px;
  height: 66px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--home-primary);
  font-size: 29px;

  background: var(--home-primary-light);
  border-radius: 50%;
}

.home-page .news-content {
  min-width: 0;
}

.home-page .news-content h1 {
  margin: 0 0 10px;

  color: var(--home-text);
  font-size: clamp(25px, 2.2vw, 31px);
}

.home-page .home-content {
  color: var(--home-text-secondary);
  font-size: 17px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.home-page .home-content p {
  margin: 0;
}


/* ==================================================
   TITRE « DERNIERS ARTICLES »
================================================== */

.home-page .latest-posts-card {
  padding: 28px 22px 32px;
    background:
    linear-gradient(
      180deg,
      #ffffff 0%,
      #fbfdf9 100%
    );
}

.home-page .section-title {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 22px;
  padding: 0 4px;
}

.home-page .section-title h2 {
  margin: 0;

  color: var(--home-text);
  font-size: clamp(23px, 2vw, 29px);
}

.home-page .section-title-icon {
  width: 32px;
  height: 32px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--home-primary);
  font-size: 27px;
  font-weight: bold;
}


/* ==================================================
   CARTES DES ARTICLES
================================================== */

.home-page .posts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}


/*
  Ton ancien JavaScript utilise probablement la structure :

  <a class="post-link">
    <article class="post-card">
      <img>
      <div class="post-body">
        ...
      </div>
    </article>
  </a>

  Les styles ci-dessous sont donc compatibles avec
  tes noms de classes actuels.
*/

.home-page .post-link {
  display: block;

  color: inherit;
  text-decoration: none;
}

.home-page .post-card {
  height: 100%;

  overflow: hidden;

  background: var(--home-white);
  border: 1px solid var(--home-border);
  border-radius: 12px;

  box-shadow:
    0 5px 18px rgba(15, 23, 42, 0.07);

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.home-page .post-link:hover .post-card {
  transform: translateY(-5px);

  border-color: #cbd5e1;

  box-shadow:
    0 14px 35px rgba(15, 23, 42, 0.14);
}

.home-page .post-card img {
  width: 100%;
  height: 260px;

  display: block;
  object-fit: cover;

  transition: transform 0.35s ease;
}

.home-page .post-link:hover .post-card img {
  transform: scale(1.025);
}

.home-page .post-card .post-body {
  padding: 20px;
}

.home-page .post-card h3 {
  margin: 0 0 10px;

  color: var(--home-text);
  font-size: 21px;
  line-height: 1.3;
}

.home-page .post-card p {
  margin: 0 0 12px;

  color: var(--home-text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.home-page .post-card .post-meta {
  margin: 0 0 9px;

  color: #64748b;
  font-size: 13px;
}


/* Faux lien « Lire la suite » */

.home-page .post-card .post-body::after {
  content: "Lire la suite →";

  display: inline-block;
  margin-top: 7px;

  color: var(--home-primary);
  font-size: 15px;
  font-weight: bold;
}

.hidden {
  display: none;
}

.resident-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.resident-header h1 {
  margin-top: 0;
  margin-bottom: 8px;
}

.new-message-btn {
  flex-shrink: 0;

  padding: 12px 18px;

  color: white;
  font-weight: 600;

  background: #2f63e9;
  border: none;
  border-radius: 999px;

  cursor: pointer;
}

.new-message-btn:hover {
  background: #234fc4;
}

.message-form-card h2 {
  margin-top: 0;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;

  margin-bottom: 7px;

  font-weight: 600;
}

.form-group textarea {
  width: 100%;

  padding: 12px;

  resize: vertical;

  font: inherit;

  border: 1px solid #ccc;
  border-radius: 8px;
}

.optional {
  color: #777;
  font-size: 13px;
  font-weight: normal;
}

.message-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.publish-btn,
.secondary-btn {
  padding: 10px 16px;

  border-radius: 8px;

  cursor: pointer;
}

.publish-btn {
  color: white;

  background: #2f63e9;
  border: none;
}

.secondary-btn {
  color: #333;

  background: #f5f5f5;
  border: 1px solid #ccc;
}

.resident-feed-card h2 {
  margin-top: 0;
}

.resident-message {
  padding: 22px 0;
  border-bottom: 5px solid dodgerblue;
}

.resident-message:last-child {
  border-bottom: none;
}

.resident-message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.resident-message-author {
  color: #102445;
  font-size: 17px;
}

.resident-message-date {
  margin-top: 3px;
  color: #777;
  font-size: 13px;
}

.resident-message-text {
  margin: 0;
  color: #334155;
  line-height: 1.6;
  white-space: pre-wrap;
}

.resident-message-photo {
  display: block;

  width: auto;
  max-width: 100%;
  max-height: 500px;

  margin-top: 16px;

  object-fit: contain;
  border-radius: 12px;
}

.message-photo-preview img {
  max-width: 300px;
  max-height: 220px;
  margin-bottom: 18px;

  object-fit: cover;

  border-radius: 10px;
}

.form-status {
  margin-top: 12px;
  color: #475569;
  font-size: 14px;
}

.resident-image-link {
  display: inline-block;
}

.resident-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  margin-top: 16px;
  padding: 14px 16px;

  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.resident-file-info {
  display: flex;
  align-items: center;
  gap: 10px;

  min-width: 0;
}

.resident-file-icon {
  font-size: 25px;
}

.resident-file-name {
  overflow: hidden;

  color: #334155;
  font-size: 14px;
  font-weight: 600;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.resident-file-actions {
  display: flex;
  gap: 8px;

  flex-shrink: 0;
}

.resident-file-btn {
  display: inline-block;

  padding: 8px 12px;

  color: white;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;

  background: #2f63e9;
  border-radius: 7px;
}

.resident-file-btn:hover {
  background: #244fc0;
}

.resident-file-btn.secondary {
  color: #334155;

  background: white;
  border: 1px solid #cbd5e1;
}

.resident-file-btn.secondary:hover {
  background: #f1f5f9;
}


/* ==================================================
   TABLETTES
================================================== */

@media (max-width: 1080px) {
  .home-page .nav-container {
    width: calc(100% - 32px);
  }

  .home-page .site-logo {
    width: 105px;
    margin-right: 25px;
  }

  .home-page .site-logo img {
    width: 100px;
    height: 82px;
  }

  .home-page .nav-left {
    gap: 20px;
  }

  .home-page .nav-left a {
    font-size: 14px;
  }
}


/* ==================================================
   MENU MOBILE
================================================== */

@media (max-width: 850px) {
  .home-page .nav-container {
    position: relative;
    min-height: 84px;
  }

  .home-page .site-logo {
    width: auto;
    margin-right: 0;
  }

  .home-page .site-logo img {
    width: 88px;
    height: 72px;
    border-radius: 14px;
  }

  .home-page .menu-toggle {
    display: block;
  }

  .home-page .nav-content {
    position: absolute;
    top: 84px;
    right: 0;
    left: 0;
    z-index: 100;

    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;

    padding: 20px;

    background: var(--home-white);
    border: 1px solid var(--home-border);
    border-radius: 0 0 14px 14px;

    box-shadow:
      0 12px 30px rgba(15, 23, 42, 0.12);
  }

  .home-page .nav-content.open {
    display: flex;
  }

  .home-page .nav-left {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .home-page .nav-left a {
    padding: 12px 10px;
    border-radius: 8px;
  }

  .home-page .nav-left a::after {
    display: none;
  }

  .home-page .nav-left a.active {
    padding-left: 15px;
    background: var(--home-primary-light);
  }

  .home-page .logout-btn {
    width: 100%;
  }

  .home-page .site-header {
    height: 260px;
  }

  .home-page .page {
    width: min(100% - 24px, 720px);
    margin-top: 16px;
  }

  .home-page .posts-grid {
    grid-template-columns: 1fr;
  }
}


/* ==================================================
   PETITS TÉLÉPHONES
================================================== */

@media (max-width: 560px) {
  .home-page .nav-container {
    width: calc(100% - 24px);
  }

  .home-page .site-header {
    height: 190px;
  }

  .home-page .page {
    width: calc(100% - 20px);
  }

  .home-page .card {
    padding: 20px;
  }

  .home-page .news-card {
    align-items: flex-start;
    gap: 15px;
  }

  .home-page .news-icon {
    width: 50px;
    height: 50px;

    font-size: 22px;
  }

  .home-page .news-content h1 {
    font-size: 23px;
  }

  .home-page .home-content {
    font-size: 15px;
  }

  .home-page .latest-posts-card {
    padding: 20px 14px 22px;
  }

  .home-page .post-card img {
    height: 210px;
  }

  .home-page .post-card h3 {
    font-size: 19px;
  }

    .resident-file {
    align-items: stretch;
    flex-direction: column;
  }

  .resident-file-actions {
    width: 100%;
  }

  .resident-file-btn {
    flex: 1;
    text-align: center;
  }
}

/* ==================================================
   PAGE DE CONNEXION
================================================== */

.login-page .login-nav {
  position: relative;
  z-index: 30;

  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.login-page .login-nav .nav-container {
  position: relative;

  width: min(1420px, calc(100% - 48px));
  max-width: none;
  min-height: 125px;

  margin: 0 auto;
  padding-left: 0;
}

.login-page .login-logo {
  position: absolute;
  top: 18px;
  left: 0;

  width: 220px;
  height: 100%;

  z-index: 50;

  display: block;
  overflow: hidden;

  border-radius: 26px;
}

.login-page .login-logo img {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;
  object-position: center;

  border-radius: 26px;
}


/* Formulaire sous la bannière */

.login-page .login-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;

  padding: 45px 20px 60px;
}

.login-page .login-box {
  width: min(420px, 100%);

  padding: 35px 40px;

  background: white;
  border-radius: 14px;

  box-shadow:
    0 8px 30px rgba(15, 23, 42, 0.10);
}

.login-page .login-box h1 {
  margin-top: 0;

  color: #102445;
  font-size: 26px;
}


/* Tablette */

@media (max-width: 1080px) {
  .login-page .login-nav .nav-container {
    width: calc(100% - 32px);
    min-height: 100px;
  }

  .login-page .login-logo {
    width: 105px;
  }

  .login-page .login-logo img {
    width: 100px;
    height: 82px;
  }
}


/* Mobile */

@media (max-width: 850px) {
  .login-page .login-nav .nav-container {
    min-height: 84px;
  }

  .login-page .login-logo {
    position: static;

    width: 88px;
    height: 72px;
  }

  .login-page .login-logo img {
    width: 88px;
    height: 72px;

    border-radius: 14px;
  }

  .login-page .site-header {
    height: 230px;
  }
}


/* Petit téléphone */

@media (max-width: 560px) {
  .login-page .login-nav .nav-container {
    width: calc(100% - 24px);
  }

  .login-page .site-header {
    height: 190px;
  }

  .login-page .login-wrapper {
    padding: 25px 14px 40px;
  }

  .login-page .login-box {
    padding: 28px 22px;
  }
}