@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Segoe UI', sans-serif;
}

.title h1, .title h2 {
  font-family: 'Newsreader', serif;
}

body {
  background: #f5f5f5;
  color: #333;
  overflow-x: hidden; /* prevent horizontal scroll when sidebar opens */
}

/* Sticky Header Container - wraps both menu-bar and header */
.sticky-header-container {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 999;
  background: #f5f5f0;
}

/* Menu Bar (separate row above header) */
.menu-bar {
  background-color: #f5f5f0;
  padding: 12px 20px;
  display: flex;
  align-items: center;
}

.header {
  background: #054634;
  color: white;
  padding: 10px 20px;
  padding-bottom: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-icon {
  font-size: 32px;
  cursor: pointer;
  color: #054634;
  transition: opacity 0.3s ease;
  line-height: 1;
  font-weight: bold;
  letter-spacing: -2px;
}

.menu-icon:hover {
  opacity: 0.7;
}

/* App Sidebar (slide-out menu) */
.app-sidebar {
  position: fixed;
  top: 0;
  left: -280px; /* hidden by default */
  width: 280px;
  height: 100vh;
  background: #054634;
  color: #fff;
  z-index: 1000;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 10px rgba(0,0,0,0.15);
  pointer-events: none; /* don't block clicks when closed */
  overflow-y: auto; /* allow internal scrolling */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.app-sidebar::-webkit-scrollbar { display: none; }

.app-sidebar.open { left: 0; pointer-events: auto; }

.app-sidebar-header {
  padding: 30px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  position: relative;
}

.sidebar-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  line-height: 1;
  font-weight: bold;
  letter-spacing: -2px;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.user-profile { display: flex; align-items: center; gap: 15px; }
.user-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.2); }
.user-info h3 { margin: 0; font-size: 18px; font-weight: bold; color: #fff; }
.user-info .status { margin: 4px 0 0 0; font-size: 12px; color: #90EE90; }

.nav-menu { list-style: none; padding: 15px 0; }
.nav-divider { height: 1px; margin: 8px 18px; background: rgba(255,255,255,0.15); }
.nav-item { margin: 0; }
.nav-link { display: flex; align-items: center; padding: 14px 22px; color: rgba(255,255,255,0.85); text-decoration: none; transition: all 0.25s ease; position: relative; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; transform: translateX(4px); }
.nav-link.active { background: rgba(255,255,255,0.1); color: #fff; font-weight: bold; pointer-events: none; cursor: default; }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #f7941d; }
.nav-icon { font-size: 20px; width: 24px; margin-right: 14px; text-align: center; transition: transform 0.25s ease; }
.nav-link:hover .nav-icon { transform: scale(1.1); }

.app-sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; pointer-events: none; }
.app-sidebar-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }

.menu-icon.active { transform: rotate(90deg); }

@media (max-width: 768px) {
  .app-sidebar { width: 100%; left: -100%; }
  .app-sidebar.open { left: 0; }
}

/* Departments list inside sidebar */
.dept-section { padding: 12px 16px 20px; }
.dept-title { font-weight: bold; color: #fff; opacity: 0.9; margin: 6px 0 10px; }
.dept-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dept-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.12); border-radius: 4px; transition: background 0.25s ease, transform 0.2s ease; }
.dept-item:hover { background: rgba(255,255,255,0.08); transform: translateX(4px); }
.dept-item span { font-size: 17px; line-height: 1.4; color: rgba(255,255,255,0.95); }
.dept-item img { width: 40px; height: 40px; object-fit: contain; }

.logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: 1;
}

.logo {
  width: 115px;
  height: auto;
}

.logo2 {
  width: 85px;
  height: auto;
}

.title {
  text-align: center;
}

.title h1 {
  font-size: 36px;
  font-weight: normal;
}

.title h2 {
  font-size: 36px;
  font-weight: normal;
}

.title p {
  font-size: 24px;
  font-style: italic;
  padding-bottom: 20px;
}

/* Header Navigation Dropdown */
.header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  background: white;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 20px;
}

.nav-dropdown-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 20px;
  justify-content: center;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: block;
  padding: 8px 16px;
  color: #054634;
  text-decoration: none;
  font-weight: 500;
  font-size: 18px;
  transition: all 0.3s ease;
  white-space: nowrap;
  border-radius: 4px;
}

.nav-dropdown-toggle:hover {
  background-color: rgba(5, 70, 52, 0.1);
  color: #054634;
}

.nav-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  min-width: 280px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  list-style: none;
  margin: 0;
  padding: 8px 0;
  z-index: 1001;
}

.nav-dropdown:hover .nav-dropdown-content {
  display: block;
}

.nav-dropdown-content li {
  margin: 0;
}

.nav-dropdown-content a {
  display: block;
  padding: 10px 20px;
  color: #333;
  text-decoration: none;
  font-size: 18px;
  transition: background-color 0.2s ease;
}

.nav-dropdown-content a:hover {
  background-color: #f0f0f0;
  color: #054634;
}

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto auto auto; 
  gap: 20px;
  padding: 25px;
  max-width: 1200px;
  margin: auto;
  align-items: start;
}

/* Carousel */
.carousel {
  grid-column: 1 / 2;
  grid-row: 1;
}

.carousel-box {
  position: relative;
  width: 100%;
  height: 450px; /* modern tall look */
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.carousel-box img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* fills space neatly */
  display: block;
  transition: opacity 0.3s ease;
}

/* Arrows - Full height click areas that fade out unless hovered */
.arrow {
  font-size: 48px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0);
  user-select: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 80px;
  z-index: 5;
  background: rgba(0, 0, 0, 0);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
}

.carousel-box:hover .arrow {
  opacity: 1;
  color: rgba(200, 200, 200, 0.8);
  background: rgba(0, 0, 0, 0.1);
}

.arrow:hover {
  color: rgba(255, 255, 255, 1);
  background: rgba(0, 0, 0, 0.4);
}

.arrow:active {
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 1);
}

.arrow.left { left: 0; }
.arrow.right { right: 0; }

/* Caption - Fades with controls */
.carousel-caption {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 14px;
  font-style: italic;
  max-width: 80%;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.carousel-box:hover .carousel-caption {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .carousel-box {
    height: 280px; /* smaller on mobile */
  }
  .arrow {
    font-size: 32px;
    width: 60px;
  }
  /* On mobile, show arrows with slight visibility by default */
  .carousel-box .arrow {
    opacity: 0.5;
  }
  .carousel-box:hover .arrow,
  .carousel-box:active .arrow {
    opacity: 1;
  }
  .carousel-caption {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* Sidebar */
.sidebar {
  grid-column: 2 / 3;
  grid-row: 1 / span 3; 
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-left: 1px solid #ccc;
  padding-left: 20px;
  position: sticky;
  top: 20px;
  align-self: start;
}
.sidebar .card {
  background: none;
  border: none;
  padding: 0;
  border-bottom: 1px solid #ccc;
  padding-bottom: 15px;
}

.sidebar .card:last-child {
  border-bottom: none;
}

.sidebar h3 {
  margin-bottom: 5px;
  font-size: 24px;
  font-weight: bold;
  color: #054634;
}

.sidebar p {
  font-size: 16px;
  line-height: 1.6;
}

/* Content */
.content {
  grid-column: 1 / 2;
  margin-top: 20px;
  border-top: 1px solid #ccc;
  padding-top: 20px;
}

.content h2 {
  margin-bottom: 10px;
  font-size: 24px;
  font-weight: bold;
  color: #004d2b;
}

.content p {
  margin-bottom: 15px;
  font-size: 16px;
  line-height: 1.6;
  text-align: justify;
}

/* Articles */
.articles {
  grid-column: 1 / 2;
  grid-row: 3; 
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex-wrap: wrap;
  
}

.article-card {
  background: white;
  padding: 15px;
  border: 1px solid #ddd;
  flex: 0 1 calc(33.333% - 10px);
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.3s ease;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #054634;
}

.article-card.is-entering {
  opacity: 0;
  transform: translateY(15px);
}

.article-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  margin-bottom: 10px;
}

.article-card h4 {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: bold;
  color: #004d2b;
}

.article-card p {
  font-size: 14px;
  margin-bottom: 10px;
  flex: 1;
}

.article-card .program-details {
  margin-bottom: 15px;
}

.article-card button {
  padding: 8px 12px;
  background: #f7941d;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.3s ease, transform 0.2s ease;
}

.article-card button:active {
  transform: scale(0.98);
}

.article-card button:hover {
  background: #d97914;
}

/* Load more button */
.load-more-container {
  grid-column: 1 / 2;
  margin-top: 15px;
  display: flex;
  justify-content: center;
}

#load-more-btn {
  padding: 10px 16px;
  background: #054634;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

#load-more-btn:hover { background: #07624a; }
#load-more-btn:active { transform: translateY(1px); }

/* Error and status messages */
.error-message {
  background: #ffebee;
  color: #c62828;
  padding: 15px;
  border: 1px solid #ffcdd2;
  border-radius: 4px;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.5;
}

.no-programs {
  background: #f3f4f6;
  color: #6b7280;
  padding: 20px;
  text-align: center;
  border-radius: 8px;
  font-style: italic;
}
/* Modal (Program Details) */
.program-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

.program-modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }

.program-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%) scale(0.98);
  width: min(1000px, 96vw);
  max-height: 92vh;
  background: #fafafa;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 1210;
  opacity: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none; /* disabled until active */
}

.program-modal.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.program-modal-header {
  background: #054634;
  color: #fff;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.program-modal-header h3 { font-size: 20px; }
.program-modal-close { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }

.program-modal-content {
  padding: 20px;
  overflow: auto;
}

/* Modal carousel */
.modal-carousel {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
}

.modal-carousel-main {
  position: relative;
  height: 400px;
  overflow: hidden;
  border-radius: 6px;
}

.modal-carousel-main img { width: 100%; height: 100%; object-fit: cover; display: block; }

.modal-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  color: white;
  border: none;
  font-size: 48px;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0.7;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  padding: 20px;
}

.modal-carousel-arrow:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.2);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}

.modal-carousel-arrow.left { left: 0; }
.modal-carousel-arrow.right { right: 0; }

.modal-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.modal-thumbs img {
  width: 70px;
  height: 50px;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

.modal-thumbs img.active { border-color: #054634; }

/* Modal body readability */
.program-modal-body p { line-height: 1.7; font-size: 15px; }

/* Fullscreen Image Lightbox */
.fullscreen-image-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.fullscreen-image-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.fullscreen-image-container {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.fullscreen-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Make modal carousel main image clickable */
.modal-carousel-main img {
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.modal-carousel-main img:hover {
  transform: scale(1.02);
}

/* Responsive cards per row */
@media (max-width: 1024px) {
  .article-card { flex: 0 1 calc(50% - 10px); }
}

@media (max-width: 600px) {
  .article-card { flex: 0 1 100%; }
}

/* Footer */
.footer {
  margin-top: 30px;
  background: #e0e0e0;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.6;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-left img {
  width: 70px;
}

.footer-right {
  max-width: 400px;
}

/* Page transition animations */
body {
  animation: pagefadeIn 0.5s ease-in-out;
}

@keyframes pagefadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.page-exit {
  animation: pageExit 0.4s ease-in-out forwards;
}

@keyframes pageExit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Make carousel image indicate it's clickable */
.carousel img#carousel-img { cursor: pointer; }

/* When body has .blurred, blur everything except the fullscreen overlay and program modal elements */
body.blurred > :not(.fullscreen-image-overlay):not(.program-modal):not(.program-modal-overlay) {
  filter: blur(8px);
  transition: filter 0.18s ease-in-out;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Admin actions styles */
.admin-actions {
  margin-top: 15px;
  text-align: center;
  display: flex;
  gap: 10px;
  justify-content: center;
}
.edit-btn {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s, opacity 0.2s;
}
.edit-btn:hover {
  background-color: #0056b3;
}
.edit-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}
.delete-btn {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s, opacity 0.2s;
}
.delete-btn:hover {
  background-color: #c82333;
}
.delete-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Confirmation Modal Styles */
.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}
.confirm-modal-overlay.active {
  display: flex;
}
.confirm-modal {
  background: white;
  border-radius: 8px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.confirm-modal-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 12px;
  color: #333;
}
.confirm-modal-message {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.5;
}
.confirm-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.confirm-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}
.confirm-btn-cancel {
  background-color: #6c757d;
  color: white;
}
.confirm-btn-cancel:hover {
  background-color: #5a6268;
}
.confirm-btn-confirm {
  background-color: #dc3545;
  color: white;
}
.confirm-btn-confirm:hover {
  background-color: #c82333;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* Tablet and smaller (768px and below) */
@media (max-width: 768px) {
  /* Header adjustments */
  .header {
    padding: 8px 15px;
  }
  
  .logo-section {
    flex-direction: column;
    gap: 10px;
  }
  
  .logo, .logo2 {
    width: 60px;
  }
  
  .title h1 {
    font-size: 20px;
  }
  
  .title h2 {
    font-size: 20px;
  }
  
  .title p {
    font-size: 14px;
  }
  
  /* Stack main layout to single column */
  .main-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 15px;
    gap: 15px;
  }
  
  /* Carousel takes full width */
  .carousel {
    grid-column: 1;
    grid-row: auto;
  }
  
  .carousel-box {
    height: 250px;
  }
  
  /* Sidebar moves below carousel */
  .sidebar {
    grid-column: 1;
    grid-row: auto;
    border-left: none;
    border-top: 2px solid #054634;
    padding-left: 0;
    padding-top: 20px;
    position: static;
  }
  
  .sidebar h3 {
    font-size: 20px;
  }
  
  .sidebar p {
    font-size: 14px;
  }
  
  /* Content section */
  .content {
    grid-column: 1;
    grid-row: auto;
  }
  
  .content h2 {
    font-size: 20px;
  }
  
  .content p {
    font-size: 14px;
  }
  
  /* Article cards stack on mobile */
  .articles {
    grid-column: 1;
    grid-row: auto;
    flex-direction: column;
  }
  
  .article-card {
    flex: 1 1 100%;
  }
  
  /* Increase touch targets */
  .nav-link {
    padding: 16px 22px;
    font-size: 16px;
  }
  
  .nav-icon {
    font-size: 22px;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  /* Even smaller fonts */
  .title h1, .title h2 {
    font-size: 18px;
  }
  
  .title p {
    font-size: 12px;
  }
  
  .logo, .logo2 {
    width: 50px;
  }
  
  .carousel-box {
    height: 200px;
  }
  
  .sidebar h3 {
    font-size: 18px;
  }
  
  .sidebar p, .content p {
    font-size: 13px;
  }
  
  .main-layout {
    padding: 10px;
  }
}


