/* =========================
   NEWS (base card styles)
   ========================= */

.nav-box-profil-right-newspage {
    grid-column: 2/3;
    border-radius: 10px;
    padding: 30px 50px;
    grid-area: content;
}

.news-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
  gap: 20px;
  padding: 0px clamp(12px, 4vw, 80px);
  margin-top: 20px;
  margin-bottom: 40px;
}

.news-box {
  justify-self: center;
  border: 0.5px solid rgba(0,0,0,0.2);
  border-radius: 5px;
  padding: 15px;
  margin-bottom: 20px;
  width: 100%;
  height: 440px;

  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.news-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 5px;
}

.news-title {
  margin: 10px 0px 5px 0px;
  font-size: 16px;
  line-height: 1.5rem;
  text-align: left;
  font-weight: 700;
}

.news-date {
  margin: 0px 0px 10px 0px;
  font-size: 12px;
  font-weight: 400;
  color: rgba(0,0,0,0.6);
  text-align: left;
}

.news-desc {
  font-size: 14px;
  line-height: 1.5rem;
  text-align: left;
  font-weight: 300;
}

.news-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  opacity: 1.0;
}

/* Section title */
#news-title {
  font-size: 22px;
  letter-spacing: 1.5px;
  margin: 20px 0px;
  text-align: center;
}

/* =========================
   Controls
   ========================= */

.news-controls {
  display: inline-flex;
  gap: 8px;
}

.view-btn {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.12);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.view-btn-img {
  height: 20px;
  width: 20px;
}

.view-btn.active {
  background: black;
  color: white;
  border-color: black;
}

/* =========================
   Gallery view
   ========================= */

.news-container.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, 340px);
  margin: 0px auto;
  margin-top: 20px;
  margin-bottom: 40px;
  gap: 25px;
  justify-content: center;
}

/* =========================
   List view
   ========================= */

.news-container.list {
  display: block;
}

.news-container.list .news-box {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 30px;
  border-bottom: 1px solid rgba(0,0,0,0.08);

  width: 100%;
  max-width: 1000px;

  height: auto;
  border: none;
  margin-bottom: 0;

  transform: none; /* avoid lift in list layout */
  box-shadow: none;
}

.news-container.list .news-box:hover {
  transform: none;
  box-shadow: 0 8px 8px rgba(0, 0, 0, 0.15);
}

.news-container.list .news-img {
  width: 110px;
  height: 82px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Content wrapper (only if you actually have a wrapper div inside .news-box in list view) */
.news-container.list .news-box > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.news-container.list .news-title {
  font-weight: 600;
  font-size: 16px;
  margin: 0;
  line-height: 1.4;
}

.news-container.list .news-desc {
  margin: 0;
  color: rgba(0,0,0,0.7);
  font-size: 13px;
  line-height: 1.5;
  flex-grow: 1;
}

.news-container.list .news-date {
  margin: 0;
  font-size: 12px;
  color: rgba(0,0,0,0.55);
  text-align: left;
  margin-top: auto;
}

/* =========================
   Title container (your layout)
   ========================= */

#news-title-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px 150px;
}

/* =========================
   Detail page / nav
   ========================= */

.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.nav-btn {
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 5px;
}

.nav-btn:hover {
  background-color: #0056b3;
}

#news-detail .menu-title {
  width: 100%;
  display: block;
  margin: 30px auto;
}



.detailed-news-container {
  display: block;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 30px 50px;
}

/* =========================
   Horizontal scroller mode
   Use: <div class="news-container scroller">
   ========================= */

.news-container.scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 340px; /* card width */
  gap: 20px;

  overflow-x: auto;
  overflow-y: hidden;

  padding: 50px clamp(12px, 4vw, 80px) 20px;
  padding-top: 5px;
  margin-top: 20px;
  margin-bottom: 40px;

  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;

  justify-content: start;
  width: 100%;

  scroll-behavior: smooth;
  scrollbar-width: thin; /* Firefox */
}

/* Force each card to the intended width so overflow always happens when needed */
.news-container.scroller > .news-box {
  width: 340px;
  margin-bottom: 0;
  scroll-snap-align: start;
}

/* Peek space at the end */
.news-container.scroller::after {
  content: "";
  width: clamp(12px, 4vw, 80px);
}

/* WebKit scrollbar styling */
.news-container.scroller::-webkit-scrollbar {
  height: 10px;
}

.news-container.scroller::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.25);
  border-radius: 999px;
}

.news-container.scroller::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.06);
}

/* =========================
   Responsive tweaks
   ========================= */

@media (max-width: 768px) {
  .news-box:hover {
    transform: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    opacity: 1.0;
  }
  .news-box:hover .news-img {
    transform: none;
  }
}

@media (max-width: 640px) {
  #news-title-container {
    flex-direction: column;
  }
}

@media (max-width: 575px) {
  .news-box {
    height: 400px;
  }
}

/* IMPORTANT: don't break the scroller's padding/overflow on smaller screens */
@media (max-width: 1200px) {
  .news-container:not(.scroller) {
    padding: 0px;
  }
  /* Optional: slightly smaller cards on smaller screens */
  .news-container.scroller {
    grid-auto-columns: 300px;
  }
  .news-container.scroller > .news-box {
    width: 300px;
  }
}

/* --- FIX: allow scroll container to shrink inside flex layouts --- */
.nav-box-profil-right,
.nav-box-profil,
.nav-box-container,
.nav-box-profil * {
  min-width: 0;
}

/* If your layout uses flex, this is the key one: */
.nav-box-profil-right { min-width: 0; }

/* --- FIX: ensure the scroller is constrained to available width --- */
.news-container.scroller {
  max-width: 100%;
  width: 100%;
}

/* --- FIX: make sure no ancestor kills the scrollbar --- */
html, body {
  overflow-x: visible; /* change to 'auto' if you prefer */
}

.news-container.scroller{
  grid-auto-columns: 340px;
  /*border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;*/
}

.news-container.scroller > .news-box{
  width: 340px;       /* match grid-auto-columns */
  box-sizing: border-box;
  margin-bottom: 0;
}

.news-container.scroller{
  justify-content: start;
  align-content: start;
}

/* --- SCROLLER: force fixed card widths and disable the base grid columns --- */
.news-container.scroller{
  grid-template-columns: none !important;  /* cancel repeat(auto-fit, ...) */
  grid-auto-flow: column;
  grid-auto-columns: 340px;
  gap: 20px;

  overflow-x: auto;
  overflow-y: hidden;

  justify-content: start;
  align-content: start;
  width: 100%;
  max-width: 100%;
}

/* --- SCROLLER CARDS: DO NOT allow width:100% or centering to break columns --- */
.news-container.scroller > .news-box{
  width: 340px !important;         /* override width:100% */
  justify-self: stretch !important; /* override justify-self:center */
  box-sizing: border-box;
  margin-bottom: 0;
  flex: 0 0 auto;                  /* harmless, but prevents weird shrink behavior */
}

/* Hide scrollbar but keep scroll functionality */
.news-container.scroller {
  scrollbar-width: none;          /* Firefox */
}

.news-container.scroller::-webkit-scrollbar {
  display: none;                  /* Chrome, Safari, Edge */
}

.news-container.scroller {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.25) transparent; /* Firefox */
}

.news-container.scroller::-webkit-scrollbar {
  height: 6px;
}

.news-container.scroller::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.25);
  border-radius: 999px;
}

.news-container.scroller::-webkit-scrollbar-track {
  background: transparent;
}


.news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0px;
  margin-top: 2em;
}

.news-header-right {
  display: flex;
  gap: 15px;
  align-items: center;
}

.news-arrow {
    height: 40px;
    opacity: 0.8;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.news-arrow:hover {
    opacity: 1.0;
    border: none;
    background-color: rgba(0,0,0,0.1);
}

.news-arrow.first, .news-arrow.first:hover, .news-arrow.last, .news-arrow.last:hover {
    opacity: 0.1;
    cursor: default;
    background-color: white;
}

.news-header h4 {
  margin-bottom: 0.1em;
  margin-top: 0.3em;
}

#news-link {
    text-decoration: none;
    font-weight: 300;
    font-size: 13px;
    line-height: 1.5rem;
    color: black;
}
#news-link:hover {
    text-decoration: underline;
} 


/* Responsive adjustments */
@media (max-width: 768px) {
    .news-container.scroller {
        gap: 15px;
    }
    .news-container.scroller .news-box {
        width: 300px;
    }
}

@media (max-width: 1200px) {
    .nav-box-profil-right-newspage { 
        padding: 18px 50px;
        max-width: 900px; 
        margin: 0px auto;
    }
}

@media (max-width: 640px) {
    .nav-box-profil-right-newspage { padding: 18px 0px; } /* Can be deleted */
}
