/* ===== Base / Theme Vars ===== */
* { box-sizing: border-box; }
:root{
  --line: 34,197,94;         /* emerald */
  --text: #e7f7ec;
  --muted: #a7d9b1;
  --caret: #0b2317;          /* dark caret color */
}
html, body { height: 100%; }

body.bg-overlay{
  background:
    linear-gradient(rgba(3,20,12,0.75), rgba(3,20,12,0.75)),
    url("./login_background.png") center/cover fixed no-repeat;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== Main container ===== */
.announce-shell{
  width: 95%;
  max-width: 1280px;

  /* DESKTOP spacing (perfect base) */
  margin: 100px auto 64px;

  border-radius: 18px;
  padding: 28px;
  border: 2px solid rgba(var(--line), 0.6);
  background: linear-gradient(180deg, rgba(15,49,34,0.55), rgba(10,28,20,0.55));
  box-shadow: 0 15px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(var(--line),0.25) inset;
  backdrop-filter: blur(8px);
  flex: 1 0 auto;
}

/* ===== Title ===== */
.title-banner{
  width: 100%;
  font-size: 36px;
  line-height: 1.2;
  font-weight: 800;
  padding: 14px 18px;
  color: var(--text);
  text-align: center;
  border-radius: 14px;
  border: 2px solid rgba(var(--line),0.65);
  box-shadow: 0 0 18px rgba(0,0,0,0.35), 0 0 0 1px rgba(var(--line),0.2) inset;
  background: linear-gradient(90deg,rgba(4,18,10,1) 0%, rgba(3,74,31,1) 50%, rgba(4,18,10,1) 100%);
  margin-bottom: 16px;
}

/* ===== Filters ===== */
.filters-wrap { margin-bottom: 18px; }
.filter-input{
  border-radius: 12px !important;
  border: 2px solid rgba(var(--line),0.45) !important;
  background: rgba(255,255,255,0.92) !important;
  color: #0a2a17 !important;
  padding: 10px 14px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  transition: box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.filter-input::placeholder { color: #5a7c68; }
.filter-input:focus{
  border-color: rgba(var(--line),1) !important;
  outline: none !important;
  box-shadow: 0 0 0 .2rem rgba(34,197,94,.25);
  background: rgba(255,255,255,0.98) !important;
}

/* Select: custom caret icon (forced dark) */
.filter-input.form-select{
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 40px !important;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23000000' d='M3.2 5.5 8 10.3l4.8-4.8 1.2 1.2-6 6-6-6z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 16px 16px !important;
}
.filter-input.form-select::-ms-expand{ display:none; }
.filter-input.form-select option{ background-color:#0d2a19; color:#e6ffe6; }

/* ===== Cards (fixed size + hover) ===== */
.col-fixed { display: flex; }
.card.announcement-card{
  --card-height: 470px;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, filter .22s ease;
  border-radius: 14px;
  border: 1px solid #c8e6c9;
  background-color: #e8f5e9;
  overflow: hidden;
  position: relative;
  animation: fadeInUp .35s ease forwards;
  opacity: 0;

  display: flex;
  flex-direction: column;

  /* allow expansion when content is taller */
  height: auto;
  min-height: var(--card-height);

  width: 100%;
  box-shadow: 0 10px 20px rgba(0,0,0,0.25);
  cursor: pointer;
}
@keyframes fadeInUp { from{transform:translateY(18px);opacity:0;} to{transform:translateY(0);opacity:1;} }

.card.announcement-card:hover{
  transform: translateY(-6px) scale(1.02);
  border-color: #66bb6a;
  box-shadow: 0 22px 36px rgba(76,175,80,0.33);
  filter: brightness(1.02);
}

/* fixed image height to equalize cards regardless of upload aspect */
.card-img-top{
  height: 200px;
  width: 100%;
  object-fit: cover;
  border-bottom: 1px solid #a5d6a7;
}

.card-body{
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: 14px 14px 20px;   /* ensures button never clips */
  min-height: 0;
}
.card-body h5{ font-weight: 800; color:#1b5e20; }

/* author + brgy */
.card-meta{
  font-size: .86rem;
  color:#2e7d32;
  opacity:.95;
  margin-top: -2px;
}

/* category chips */
.badge{ font-size:.72rem; padding:5px 10px; border-radius:20px; width:max-content; }
.badge-general{ background:#388e3c; color:#fff; }
.badge-sports{ background:#43a047; color:#fff; }
.badge-emergency{ background:#c62828; color:#fff; }
.badge-events{ background:#66bb6a; color:#fff; }
.badge-reminder{ background:#2e7d32; color:#fff; }
.badge-notice{ background:#1b5e20; color:#fff; }

/* preview clamp to 3 lines */
.content-clamp{
  color:#2b5d2a;
  font-size:.96rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.9em;
}

/* time */
.card-body .card-ago{
  order: 97;
  color: #4f7a5b;
  font-size: 0.85rem;
  font-weight: 500;
}

/* View More — desktop pill */
.card-body .view-more-btn {
  order: 98;
  align-self: flex-end;
  margin: .25rem .8rem .55rem 0;  /* base */
  padding: .55rem 1.1rem;
  font-size: 0.95rem;
  border-radius: 14px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(0,0,0,.12);
  transition: all 0.2s ease;
}
.card-body .view-more-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
}

/* "NEW" badge */
.badge-new{
  background:#a5d6a7; color:#1b5e20; font-weight:bold;
  position:absolute; top:10px; right:10px; border-radius:14px; padding:5px 10px;
}

/* Empty */
#emptyState p{ color: var(--muted); }

/* Footer anchor */
#footer-container{ flex: 0 0 auto; }

/* ====== Touch-safe: remove hover lift on touch devices ====== */
@media (hover: none){
  .card.announcement-card:hover{
    transform:none;
    box-shadow:0 10px 20px rgba(0,0,0,0.25);
  }
}

/* ===== Pagination (GREEN + compact) ===== */
#pagination { margin-top: 14px; }
.pagination { gap: .35rem; }
.pagination .page-link{
  color: #1b5e20;
  border: 1px solid #a5d6a7;
  background: #f7fff8;
  border-radius: 10px !important;
  padding: .5rem .9rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.pagination .page-link:hover{
  background: #e8f5e9;
  border-color: #66bb6a;
  color: #1b5e20;
}
.pagination .page-item.active .page-link{
  background: #2e7d32;
  border-color: #2e7d32;
  color: #fff;
}

/* ===== Responsive ===== */

/* tablets */
@media (max-width: 992px){
  .announce-shell{
    padding: 22px;
    /* keep almost the same spacing as desktop */
    margin: 96px auto 56px;
  }
  .title-banner{ font-size: 32px; }
}

/* phones (≤576px) */
@media (max-width: 576px){
  .announce-shell{
    width: 96%;
    padding: 16px 14px 20px;

    /* BIGGER top margin so it clears header + browser bar */
    margin: 96px auto 32px;

    border-radius: 16px;
  }
  .title-banner{
    font-size: 26px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 12px;
  }

  /* stack filters nicely with bigger tap targets */
  .filters-wrap .filter-input{
    padding: 12px 14px !important;
    font-size: 16px !important; /* avoid iOS zoom */
    border-radius: 10px !important;
  }
  .filters-wrap{
    position: sticky;
    top: 64px;
    z-index: 5;
  }

  /* cards become auto-height on mobile */
  .card.announcement-card{ --card-height: auto; min-height: 0; }
  .card-img-top{ height: 160px; }
  .card-body h5{ font-size:1rem; }
  .card-meta{ font-size:.82rem; }
  .content-clamp{ font-size:.9rem; min-height: 0; }

  /* actions become full-width for comfortable taps */
  .card-body .view-more-btn{
    align-self: stretch;
    width: 100%;
    margin: .35rem 0 0;
    padding: .85rem 1rem;
    font-size: 1rem;
    border-radius: 12px;
  }
  .card-body .card-ago{
    order: 99;
    margin-top: .35rem;
    margin-bottom: .15rem;
  }

  /* pagination tap targets + tighter spacing */
  #pagination{ margin-top: 10px; }
  .pagination .page-link{
    min-width: 40px;
    min-height: 40px;
    line-height: 40px;
    text-align: center;
    padding: 0;
  }
}

/* very small phones */
@media (max-width: 400px){
  .title-banner{ font-size: 22px; }
  .card-img-top{ height: 140px; }
  .filters-wrap .filter-input{ font-size: 15px !important; }
}

/* === Modal styling for announcement details === */
.modal-content {
  background-color: #f9fff9;
  border-radius: 12px;
  border: 2px solid #a5d6a7;
}
.modal-title {
  color: #1b5e20 !important;
  font-weight: 800;
  font-size: 1.4rem;
}
.modal-body {
  color: #1b5e20 !important;
  font-size: 1rem;
  line-height: 1.5;
}
.modal-body .badge {
  background-color: #388e3c !important;
  color: #fff !important;
}
.modal-body .card-ago {
  color: #2e7d32 !important;
  font-weight: 500;
  margin-top: .5rem;
}

/* modal: tighten on small screens */
@media (max-width: 576px){
  .modal-dialog{ margin: .75rem; }
}

/* =========================
   DESKTOP-ONLY VIEW BUTTON LIFT
   ========================= */
@media (min-width: 577px){
  /* Move the desktop "View More" button slightly up */
  .card-body .view-more-btn{
    margin-bottom: 1.25rem !important;
  }
}

/* Make columns equal-height and pin the button to the bottom */
.announce-shell .row > [class^="col-"],
.announce-shell .row > [class*=" col-"] {
  display: flex;
}
.announce-shell .announcement-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.announce-shell .announcement-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.announce-shell .announcement-card .view-more-btn {
  margin-top: auto;   /* pushes the button to the bottom of the card */
}
