/* latest.css - Light Theme (dynamic, DB-backed) */
*{ margin:0; padding:0; box-sizing:border-box; }

:root{
  --header-h: 60px;
  --sidebar-w: 220px;
  --menu-btn-size: 45px;
  --menu-btn-gap: 12px;

  --primary-color: #111c4e;
  --primary-hover: #0e173d;
  --primary-light: #2a3a94;

  --card-img: url('/Main_Images/imgs/placeholder-card-orange.svg');

  /* Uniform row height (desktop/tablet) */
  --list-row-h: 240px;
  --list-desc-lines: 3;

  /* Modal footer/button sizing */
  --lr-action-h: 48px;
  --lr-action-gap: 18px;
}

body{
  background:#f5f5f5;
  line-height:1.6;
  padding-top: var(--header-h);
  color:#333;
}
.container{ display:flex; min-height: calc(100vh - var(--header-h)); }

.main-content{
  font-family: 'Metropolis', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
               Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  flex:1;
  margin-left: var(--sidebar-w);
  padding:30px;
  background:#f5f5f5;
  transition: margin-left .3s ease;
  -webkit-user-select:text; user-select:text;
}

/* Sidebar active color */
.sidebar .nav-links a.active,
.sidebar .nav-links a.selected{
  background: var(--primary-color);
  color:#fff !important;
  font-weight:700;
}
.sidebar .nav-links a.active i,
.sidebar .nav-links a.selected i{ color:#fff !important; }

/* ===================== HEADER ===================== */
.content-header{
  display:flex; align-items:center; gap:16px; flex-wrap:wrap;
  margin-bottom:25px;
}
.page-title{
  font-size:28px; font-weight:800; color:#1f2937; flex:1 1 auto; min-width:180px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* === Search + Filter === */
.header-actions{
  display:flex;
  align-items:center;
  gap:12px;
  flex: 0 0 auto; /* desktop: no stretch */
}

.searchbar{
  position: relative;
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 40px 8px 36px;
  min-width: 280px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.searchbar:focus-within{
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(17,28,78,.1);
}
.search-icon{
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: #6b7280;
}
.search-input{
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  width: 240px;
  color: #111827;
}
.clear-search{
  position: absolute;
  right: 8px;
  width: 28px; height: 28px;
  border: none; background: transparent; color: #9ca3af;
  border-radius: 8px; display: grid; place-items:center; cursor: pointer;
}
.clear-search:hover{ background:#f3f4f6; color:#6b7280; }

.filter-group{ position: relative; }
.filter-toggle{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid #e5e7eb;
  background: #fff; color: #111827; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); transition: all .2s ease;
}
.filter-toggle:hover{
  border-color: var(--primary-color); color: var(--primary-color); transform: translateY(-1px);
}
.filter-toggle[aria-expanded="true"]{
  border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(17,28,78,.1);
}
.filter-label{ display:inline-block; }
.filter-badge{
  display: inline-grid; place-items:center;
  width: 20px; height: 20px; font-size: 12px; font-weight: 800; color:#fff;
  background: var(--primary-color); border-radius: 999px; margin-left: 2px;
  opacity: 0; transform: scale(.7); transition: all .18s ease;
}
.filter-badge.is-visible{ opacity:1; transform: scale(1); }

.filter-panel{
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 320px; max-width: 86vw; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 12px; z-index: 50;
}
.filter-panel__header{
  display:flex; align-items:center; justify-content:space-between;
  font-weight:800; color:#111827; padding: 4px 2px 10px 2px; border-bottom:1px dashed #e5e7eb;
}
.filter-close{
  width: 34px; height: 34px; border-radius: 8px; border:  1px solid #e5e7eb; background:#fff; cursor:pointer;
  display:grid; place-items:center; color:#6b7280;
}
.filter-close:hover{ background:#f9fafb; color:#374151; }

/* ===================== CARD FILTERS ===================== */
.filter-section{ padding: 10px 2px; }
.filter-label-h{
  font-size: 12px; text-transform: uppercase; letter-spacing:.12em; font-weight:900; color: var(--primary-color);
  margin-bottom: 8px;
}
.filter-options{ display:flex; flex-wrap: wrap; gap: 8px; }
.checkbox-chip{
  display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border-radius: 999px;
  border:1px solid #e5e7eb; background:#fff; cursor:pointer; user-select:none;
  transition: all .18s ease; font-weight:700; color:#111827;
}
.checkbox-chip input{
  appearance: none; width: 14px; height: 14px; border-radius: 4px; border: 2px solid #9ca3af; display:inline-block;
}
.checkbox-chip input:checked{ border-color: var(--primary-color); background: var(--primary-color); }
.checkbox-chip:hover{ transform: translateY(-1px); border-color: var(--primary-color); }
.checkbox-chip span{ font-size: 12.5px; }

/* === Filter ACTION buttons === */
.filter-actions{
  display:flex; align-items:center; justify-content:flex-end;
  gap:10px; padding-top:12px; margin-top:8px; flex-wrap:wrap;
  border-top:1px dashed #e5e7eb;
}
.apply-btn,
.reset-btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 16px; font-weight:800; font-size:14px; letter-spacing:.2px;
  border-radius:12px; cursor:pointer; transition:all .2s ease;
}
.apply-btn{
  background: var(--primary-color);
  color:#fff; border:1px solid var(--primary-color);
  box-shadow:0 6px 16px rgba(17,28,78,.18);
}
.apply-btn:hover{ background: var(--primary-hover); transform: translateY(-1px); }
.apply-btn i{ font-size:14px; }

.reset-btn{
  background:#fff; color:#111827; border:1px solid #e5e7eb;
}
.reset-btn:hover{ background:#f8fafc; transform: translateY(-1px); }
.reset-btn i{ color:#374151; font-size:14px; }

/* actions under description (for buttons) */
.action-buttons{ display:flex; align-items:center; gap:12px; margin-top:auto; flex-wrap:nowrap; }

/* ===================== VIEW CONTROLS ===================== */
.view-controls{
  display:flex; align-items:center; gap:4px; background:#fff;
  border:1px solid #e5e7eb; border-radius:8px; padding:4px;
  box-shadow:0 2px 8px rgba(0,0,0,.1);
}
.view-btn{
  display:flex; align-items:center; justify-content:center;
  width:36px; height:36px; border:none; background:transparent;
  color:#6b7280; cursor:pointer; border-radius:6px;
  transition: all .2s ease; font-size:14px;
}
.view-btn:hover{ background:#f3f4f6; color:#374151; }
.view-btn.active{ background: var(--primary-color); color:#fff; }

/* ===================== CONTAINER & EMPTY ===================== */
.cards-container{ display:flex; flex-direction:column; gap:16px; }
.empty-note{ color:#6b7280; padding:8px 2px; }

/* ===================== SHARED IMAGE STYLE (with hover zoom) ===================== */
.card-image{
  position:relative; display:flex; align-items:center; justify-content:center;
  overflow:hidden; background:#0b0b0b;
}
.card-image::before{
  content:"";
  position:absolute; inset:0; z-index:0;
  background-image: var(--thumb, var(--card-img));
  background-position:center; background-repeat:no-repeat; background-size:cover;
  filter: blur(24px) saturate(1.05) brightness(.92);
  transform: scale(1.2);
  transition: transform .5s ease;
}
.card-image::after{
  content:""; position:absolute; inset:0; z-index:1;
  background: linear-gradient(90deg, rgba(0,0,0,.26), transparent 18%, transparent 82%, rgba(0,0,0,.26));
  pointer-events:none;
}
.card-image img{
  position:relative; z-index:2;
  width:100%; height:100%; object-fit:contain; object-position:center;
  display:block;
  transition: transform .5s ease, filter .5s ease;
  will-change: transform;
}
/* Hover zoom (all views) */
.content-item:hover .card-image img{ transform: scale(1.06); }
.content-item:hover .card-image::before{ transform: scale(1.28); }
@media (prefers-reduced-motion: reduce){
  .card-image::before, .card-image img{ transition:none; }
}

/* ===================== TEXT: DESCRIPTION RULES (SPACING + JUSTIFY) ===================== */
.content-description{
  font-size:14px; color:#4b5563; line-height:1.6; margin-bottom:12px;
  /* preserve DB line breaks; justify text; avoid horizontal scroll */
  white-space: pre-line;
  text-align: justify;
  text-justify: inter-word;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ===================== LIST VIEW ===================== */
.cards-container.view-list .content-item{
  background:#fff; border-radius:12px; overflow:hidden;
  box-shadow:0 2px 8px rgba(0,0,0,.1);
  transition: all .3s cubic-bezier(0.25,0.8,0.25,1);
  border:1px solid #e5e7eb; display:flex; flex-direction:row;
  min-height:140px; position:relative; z-index:0;
  height: var(--list-row-h);
}
.cards-container.view-list .content-item::before{
  content:''; position:absolute; top:0; left:0; width:0; bottom:0;
  background:var(--primary-color); transition:width .3s ease;
  z-index:20; pointer-events:none; /* strip above image */
}
.cards-container.view-list .content-item:hover::before{ width:5px; }
.cards-container.view-list .content-item:hover{
  transform:translateX(5px);
  box-shadow:0 10px 20px rgba(17,28,78,.15), 0 6px 6px rgba(17,28,78,.1);
}
/* Image: fixed column, fill row height */
.cards-container.view-list .card-image{ width:220px; min-width:220px; height:100%; aspect-ratio:auto; flex-shrink:0; }
.cards-container.view-list .content-info{ padding:20px; flex:1; display:flex; flex-direction:column; justify-content:space-between; }

/* Clamp description lines in LIST view (with justify still on) */
.cards-container.view-list .content-description{
  display: -webkit-box;
  -webkit-line-clamp: var(--list-desc-lines);
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1em * 1.6 * var(--list-desc-lines));
}

/* “Learn Now” width fix for LIST view */
.cards-container.view-list .learn-more-btn{ width:auto; max-width:max-content; align-self:flex-start; padding:8px 20px; }

/* ===================== CARDS VIEW ===================== */
.cards-container.view-cards{
  display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:20px;
}
.cards-container.view-cards .content-item{
  background:#fff; border-radius:12px; overflow:hidden;
  box-shadow:0 4px 15px rgba(0,0,0,.1);
  transition: all .3s cubic-bezier(0.25,0.8,0.25,1);
  border:1px solid #e5e7eb; display:flex; flex-direction:column; position:relative; z-index:0;
}
.cards-container.view-cards .content-item::before{
  content:''; position:absolute; top:0; left:0; right:0; height:0;
  background:var(--primary-color); transition:height .3s ease; z-index:20; pointer-events:none;
}
.cards-container.view-cards .content-item:hover::before{ height:5px; }
.cards-container.view-cards .content-item:hover{
  transform:translateY(-8px);
  box-shadow:0 14px 28px rgba(0,0,0,.15), 0 10px 10px rgba(0,0,0,.1);
}
.cards-container.view-cards .card-image{ aspect-ratio:16/9; }
.cards-container.view-cards .content-info{ padding:16px; flex:1; display:flex; flex-direction:column; }

/* Scrollable descriptions in CARDS view (still justified + pre-line) */
.cards-container.view-cards .content-description{
  max-height: 200px; overflow: auto; padding-right: 4px;
}
.cards-container.view-cards .content-description::-webkit-scrollbar{ width:6px; }
.cards-container.view-cards .content-description::-webkit-scrollbar-thumb{ background:#e5e7eb; border-radius:999px; }

/* ===================== GRID VIEW ===================== */
.cards-container.view-grid{
  display:grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap:20px;
}
.cards-container.view-grid .content-item{
  background:transparent; border-radius:12px; overflow:hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor:pointer; position:relative;
}
.cards-container.view-grid .content-item:hover{ transform: translateY(-8px) scale(1.03); }
.cards-container.view-grid .card-image{
  position:relative; aspect-ratio: 16 / 9;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden; border-radius:12px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}
.cards-container.view-grid .content-item:hover .card-image{ box-shadow: 0 12px 30px rgba(17, 28, 78, 0.25); }
.cards-container.view-grid .content-info{ display:none; }
.grid-title{ display:none; }
.cards-container.view-grid .grid-title{
  display:block; margin-top:12px; font-size:14px; font-weight:600; color:#374151; text-align:center;
  line-height:1.3; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-box-orient:vertical;
  -webkit-line-clamp: 2; transition: color 0.3s ease;
}
.cards-container.view-grid .content-item:hover .grid-title{ color: var(--primary-color); }

/* ===================== META & TEXT ===================== */
.meta-row{ display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.meta-row .tag{ padding:4px 8px; border-radius:999px; font-size:11px; font-weight:700; letter-spacing:.2px; text-transform:uppercase; }
.generic-tag{ background:#eef2ff !important; color:#1d4ed8 !important; }
.meta-row .dot{ color:#6b7280; font-weight:700; font-size:12px; }

.time-ago{ color:#6b7280; font-size:12px; font-weight:600; transition: color .3s ease; }
.content-item:hover .time-ago{ color:var(--primary-color); }

.content-title{ font-size:18px; font-weight:800; color:#1f2937; margin-bottom:4px; letter-spacing:.2px; transition: color .3s ease; }
.cards-container.view-cards .content-item:hover .content-title,
.cards-container.view-list .content-item:hover .content-title{ color:var(--primary-color); }

/* ===================== BUTTONS ===================== */
.learn-more-btn,
.learn-more-btn:link,
.learn-more-btn:visited{
  background:var(--primary-color); color:#fff;
  padding:10px 24px; border:none; border-radius:6px;
  font-size:13px; font-weight:700; cursor:pointer; width:100%;
  transition: all .3s ease; letter-spacing:.3px;
  margin-top:auto; position:relative; overflow:hidden; z-index:1; text-decoration:none;
  display:inline-flex; align-items:center; justify-content:center; text-align:center; gap:8px;
}
.learn-more-btn::before{
  content:''; position:absolute; top:0; left:-100%; width:100%; height:100%;
  background:var(--primary-hover); transition:all .4s ease; z-index:-1;
}
.learn-more-btn:hover::before{ left:0; }
.learn-more-btn:hover{ transform:translateY(-2px); box-shadow:0 4px 12px rgba(17,28,78,.3); }

.details-btn{
  display:none; background:#fff; color:#111827;
  padding:10px 20px; border:1px solid #e5e7eb; border-radius:6px;
  font-size:13px; font-weight:700; cursor:pointer; transition:all .2s ease; letter-spacing:.3px;
  align-items:center; justify-content:center; gap:8px;
}
.details-btn:hover{ background:#f8fafc; border-color:#d1d5db; box-shadow:0 2px 8px rgba(0,0,0,.06); color:#111c4e; }

/* ===================== RECOMMENDED BADGE ===================== */
.badge-recommended{
  position:absolute; top:10px; right:10px; z-index:5;
  background: var(--primary-color); color:#fff;
  padding:6px 12px; border-radius:999px;
  font-size:11px; font-weight:800; letter-spacing:.3px; text-transform:uppercase;
  box-shadow:0 6px 18px rgba(0,0,0,.25);
  pointer-events:none; user-select:none;
  display:inline-flex; align-items:center; gap:8px;
}
.badge-recommended i{ display:none; font-size:14px; line-height:1; }
.badge-recommended .label{ display:inline; }
.cards-container.view-grid .badge-recommended,
.cards-container.view-cards .badge-recommended{ padding:8px; border-radius:50%; }
.cards-container.view-grid .badge-recommended .label,
.cards-container.view-cards .badge-recommended .label{ display:none; }
.cards-container.view-grid .badge-recommended i,
.cards-container.view-cards .badge-recommended i{ display:block; }

/* ===================== PAGINATION (centered) ===================== */
.pagination-outer{ width:100%; display:flex; justify-content:center; margin-top: 18px; }
.pagination-inner{
  display:flex; align-items:center; gap:14px; padding:8px 14px;
  background:#fff; border:1px solid #e5e7eb; border-radius:14px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08); max-width:100%; overflow-x:auto;
}
.pagination-inner::-webkit-scrollbar{ height:8px; }
.pagination-inner::-webkit-scrollbar-thumb{ background:#e5e7eb; border-radius:999px; }
.pagination-inner .nav-btn,
.pagination-inner .page-btn{
  min-width:36px; height:36px; padding:0 10px;
  border:none; background:transparent; color:#111827;
  border-radius:10px; font-weight:800; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition: all .2s ease;
}
.pagination-inner .page-btn:hover,
.pagination-inner .nav-btn:hover{ background:#f3f4f6; }
.pagination-inner .page-btn.active{
  background: var(--primary-color);
  color:#fff;
  box-shadow: 0 6px 16px rgba(17, 28, 78, 0.25);
}
.pagination-inner .nav-btn[disabled]{ opacity:.35; cursor:not-allowed; pointer-events:none; }

/* ===================== SWEETALERT THEME ===================== */
.swal2-container .swal2-popup{ font-family:'Metropolis', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; }

.lr-swal{
  position:relative; width:min(860px, 92vw) !important; max-width:100%;
  border-radius:16px;
  padding:18px 18px calc(var(--lr-action-h) + var(--lr-action-gap) + env(safe-area-inset-bottom, 0px));
  background:#ffffff;
  box-shadow:0 28px 70px rgba(2,6,23,.28);
  max-height:86vh; display:flex; flex-direction:column;
  overflow:hidden;
}
.lr-swal::before{ content:""; position:absolute; left:0; right:0; top:0; height:4px;
  background: linear-gradient(90deg, var(--primary-color), #2c3e50);
  border-top-left-radius:16px; border-top-right-radius:16px;
}
.lr-swal--show{ animation: lr-pop .18s ease-out; }
.lr-swal--hide{ animation: lr-fade .14s ease-in; }
.swal2-container{ backdrop-filter: blur(2px); }

/* Hide the top-right X */
.swal2-close, .lr-swal__close{ display:none !important; }

/* Scrolling content */
.lr-swal .swal2-html-container{
  margin:0 !important; padding:0 !important;
  overflow:auto; flex:1 1 auto; box-sizing:border-box;
  padding-bottom: calc(var(--lr-action-h) + var(--lr-action-gap));
}

/* Modal content */
.lrm{
  display:grid; grid-template-columns:1fr; grid-template-areas:"media" "content";
  gap:14px; align-items:start; min-height:0;
}
.lrm__media{
  grid-area: media;
  border-radius:18px;
  overflow:hidden;
  background:#f1f5f9;
  display:flex; align-items:center; justify-content:center;
  margin-top:12px;
}
.lrm__media img{
  width:100%;
  aspect-ratio:16/9;
  object-fit:cover;
  display:block;
  border-radius:inherit;
}
.lrm__content{ grid-area: content; }
.lrm__header{ display:flex; align-items:center; gap:10px; margin:10px 0 8px; }
.lrm__icon{ width:38px; height:38px; border-radius:10px; display:grid; place-items:center; color:var(--primary-color); background:#f7f9ff; border:1px solid #e8eefc; flex:0 0 auto; }
.lrm__title{ font-size:20px; font-weight:900; color:#0f172a; margin:0; line-height:1.25; }
.lrm-chips{ display:flex; flex-wrap:wrap; gap:8px; margin:6px 0 10px; }
.lrm-chip{ display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:999px; background:#EEF2FF; color:#1E3A8A; font-size:12px; font-weight:800; letter-spacing:.3px; text-transform:uppercase; }

/* DESCRIPTION IN MODAL: preserve DB breaks + justify */
.lrm__section-title{ font-size:12px; font-weight:900; text-transform:uppercase; letter-spacing:.14em; color:var(--primary-color); margin:20px 0 6px; opacity:.95; }
.lrm__desc{
  color:#334155; line-height:1.68; font-size:15px; max-height:min(58vh,520px);
  overflow:auto; padding-right:6px; scrollbar-width:thin; scrollbar-color:#c7cdd7 transparent;
  white-space: pre-line;               /* preserve DB line breaks */
  text-align: justify;                 /* justify text */
  text-justify: inter-word;
  overflow-wrap: anywhere; word-break: break-word;
}
.lrm__desc::-webkit-scrollbar{ width:8px; }
.lrm__desc::-webkit-scrollbar-thumb{ background:#c7cdd7; border-radius:8px; }

/* ===== Fixed footer Close button ===== */
.lr-swal .swal2-actions{
  position:absolute; left:0; right:0;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  display:flex; justify-content:center; gap:0;
  padding: var(--lr-action-gap) 18px 0;
  margin:0;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 60%);
  border-bottom-left-radius:16px; border-bottom-right-radius:16px;
}
.lr-swal__confirm{
  display:inline-flex !important;
  align-items:center; justify-content:center;
  background:var(--primary-color) !important;
  color:#fff !important;
  font-weight:900 !important;
  border-radius:12px !important;
  border:1px solid var(--primary-color) !important;
  padding:12px 22px !important;
  min-height:var(--lr-action-h) !important;
  box-shadow:0 10px 20px rgba(17,28,78,.25) !important;
}

/* ===================== RESPONSIVE ===================== */
@media (min-width: 720px){
  .lrm{ grid-template-columns: 1.1fr 1.4fr; grid-template-areas:"media content"; gap:18px; }
  .lrm__title{ font-size:22px; }
}

@media (max-width:1024px){
  .cards-container.view-cards{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== Mobile tweaks – keep Filter & View next to each other ===== */
@media (max-width:768px){
  body{ padding-top: var(--header-h); }
  .main-content{
    margin-left:0; padding:20px 15px;
    padding-top: calc(20px + var(--menu-btn-gap) + var(--menu-btn-size) + 8px);
  }

  .content-header{ gap:10px; margin-bottom:18px; }
  .page-title{ font-size:22px; }

  /* Action row: tighter overall and prevents wrapping */
  .action-group{
    display:flex;
    align-items:center;
    gap:2px;
    flex-wrap:nowrap;
    width:100%;
  }
  .header-actions{
    flex: 0 1 auto;
    min-width:0;
    display:flex;
    align-items:center;
    gap:8px;
  }

  /* Mobile search bar */
  .searchbar{
    flex: 0 1 clamp(135px, 46vw, 220px);
    min-width: 0;
    width: auto;
    padding-left:34px;
    padding-right:34px;
  }
  .search-input{ width:100%; }

  .filter-toggle .filter-label{ display:none; }
  .filter-group{ margin-left:0; }
  .view-controls{
    order: 2;
    flex: 0 0 auto;
    margin-left: 2px;
    white-space: nowrap;
    padding:4px;
    gap:2px;
  }
  .view-controls .view-btn[data-view="cards"]{ display:none; }
  .view-controls .view-btn{ width:34px; height:34px; }

  /* Filter panel as sheet on mobile */
  .filter-panel{
    position: fixed;
    right: 14px; left: 14px;
    top: clamp(130px, 12vh, 140px);
    max-width: none;
  }

  /* List rows natural on mobile */
  .cards-container.view-list .content-item{ flex-direction:column; min-height:auto; height:auto; }
  .cards-container.view-list .card-image{ width:100%; aspect-ratio:16/9; height:auto; }

  .cards-container.view-cards{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap:15px; }
  .cards-container.view-grid{ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap:12px; }

  /* Hide description on mobile list/cards; Details button appears */
  .cards-container.view-list .content-description,
  .cards-container.view-cards .content-description{ display:none; }
  .details-btn{ display:inline-flex !important; }
  .action-buttons{ flex-wrap: wrap; gap:10px; }

  /* MOBILE MODAL: smaller image */
  .lr-swal{ width:min(94vw, 540px) !important; max-height: 78vh; }
  .lrm__media{ margin-top:14px; }
  .lrm__media img{
    width:auto; max-width:100%;
    height:auto; max-height:28vh;
    object-fit:contain;
  }
  .lrm__desc{ font-size:14.5px; max-height: 24vh; }
}

/* EXTRA-SMALL */
@media (max-width:480px){
  .page-title{ font-size:22px; min-width: 120px; }
  .header-actions{ gap:8px; }

  .searchbar{
    padding-left:34px;
    padding-right:34px;
    flex-basis: clamp(155px, 52vw, 220px);
  }
  .search-input{ width:100%; }
  .filter-label{ display:none; } /* icon + badge only */
}

@media (max-width: 380px){
  .lr-swal{
    padding:14px 14px calc(var(--lr-action-h) + var(--lr-action-gap) + env(safe-area-inset-bottom, 0px));
    border-radius:14px;
  }
  .lrm{ gap:12px; }
  .lrm__media{ border-radius:16px; margin-top:12px; }
  .lrm__media img{ max-height:24vh; }
  .lrm__header{ gap:8px; margin:6px 0 6px; }
  .lrm__icon{ width:32px; height:32px; border-radius:8px; }
  .lrm__title{ font-size:18px; }
  .lrm-chip{ font-size:11px; padding:4px 8px; }
  .lrm__section-title{ font-size:11px; margin:14px 0 6px; }
  .lrm__desc{ font-size:13px; line-height:1.55; max-height: 22vh; }
  .lr-swal__confirm{
    padding:10px 18px !important;
    border-radius:10px !important;
    min-height:40px !important;
    box-shadow:0 8px 16px rgba(17,28,78,.22) !important;
    font-size:14px !important;
  }
}

@media (max-width: 340px){
  .lrm__title{ font-size:17px; }
  .lrm__desc{ font-size:12.5px; max-height: 20vh; }
  .lrm__media img{ max-height:22vh; }
}

/* Animations */
@keyframes lr-pop { from { opacity:0; transform: scale(.96) translateY(8px); } to { opacity:1; transform: scale(1) translateY(0); } }
@keyframes lr-fade{ from { opacity:1; transform: scale(1); } to { opacity:0; transform: scale(.98); } }

/* Final tiny nudge for desktop alignment */
.action-group{
  display:flex; align-items:center; gap:10px;
  margin-left:auto; flex:0 1 auto; flex-wrap:wrap;
}
