/* ============================================================
   ZNDU Public Pages — Mobile & Tablet Responsiveness
   Loaded after main.css on all base1.html public pages.
   ============================================================ */

/* ── Layout safety ─────────────────────────────────────────── */
@media (max-width: 1199.98px) {
  .main {
    overflow-x: clip;
  }
}

@media (max-width: 767.98px) {
  .container,
  .container-fluid.container-xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ── Global page title (BootstrapMade template) ────────────── */
@media (max-width: 991.98px) {
  .page-title {
    padding: 6.5rem 0 2.5rem !important;
    text-align: left;
  }

  .page-title h1 {
    font-size: clamp(1.45rem, 5.5vw, 2rem) !important;
    line-height: 1.25;
    word-break: break-word;
  }

  .page-title p {
    font-size: 0.95rem;
  }

  .page-title .breadcrumbs ol {
    justify-content: flex-start;
    font-size: 0.8rem;
  }
}

@media (max-width: 767.98px) {
  .page-title {
    padding-top: calc(5.75rem + 38px) !important;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .page-title {
    padding: 5.75rem 0 2rem !important;
  }
}

/* ── Shared hero sections (ZNDU custom pages) ──────────────── */
@media (max-width: 991.98px) {
  .zndu-programme-hero,
  .zndu-dept-hero,
  .zndu-faculty-hero,
  .zndu-academics-hero,
  .events-hero-wrapper,
  .public-notice-hero,
  .admissions-hero-wrapper,
  .vacancies-hero-wrapper,
  .campus-hero,
  [class*="-hero-wrapper"] {
    padding-top: 6.5rem !important;
    padding-bottom: 2rem !important;
    margin-top: 0 !important;
  }

  .zndu-programme-hero h1,
  .zndu-dept-hero h1,
  .zndu-faculty-hero h1,
  .zndu-academics-hero h1,
  .events-hero-wrapper h1,
  .public-notice-hero h1,
  .admissions-hero-wrapper h1,
  .vacancies-hero-wrapper h1,
  .campus-hero h1,
  [class*="-hero-wrapper"] h1 {
    font-size: clamp(1.4rem, 5.5vw, 2rem) !important;
    line-height: 1.2;
    word-break: break-word;
  }

  .zndu-programme-hero p,
  .zndu-dept-hero .zndu-hero-subtitle,
  .zndu-faculty-hero p,
  .zndu-academics-hero p,
  .events-hero-wrapper p,
  .public-notice-hero p,
  .admissions-hero-wrapper p,
  .vacancies-hero-wrapper p {
    font-size: 0.95rem !important;
    max-width: 100%;
  }
}

@media (max-width: 767.98px) {
  .zndu-programme-hero,
  .zndu-dept-hero,
  .zndu-faculty-hero,
  .zndu-academics-hero,
  .events-hero-wrapper,
  .public-notice-hero,
  .admissions-hero-wrapper,
  .vacancies-hero-wrapper,
  .campus-hero,
  [class*="-hero-wrapper"] {
    padding-top: calc(5.5rem + 38px) !important;
    padding-bottom: 1.75rem !important;
  }

  .hero-badge,
  .zndu-hero-badge,
  .zndu-programme-badge,
  .zndu-stat-badge {
    font-size: 0.72rem !important;
    padding: 0.35rem 0.85rem !important;
  }
}

/* ── Breadcrumbs ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .breadcrumb,
  .zndu-breadcrumb .breadcrumb {
    flex-wrap: wrap;
    font-size: 0.75rem;
    line-height: 1.45;
    margin-bottom: 0.75rem;
  }

  .breadcrumb-item {
    max-width: 100%;
    word-break: break-word;
  }

  .breadcrumb-item + .breadcrumb-item {
    padding-left: 0.35rem;
  }

  .breadcrumb-item + .breadcrumb-item::before,
  .zndu-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    padding-right: 0.35rem;
  }
}

/* ── Section spacing ───────────────────────────────────────── */
@media (max-width: 767.98px) {
  section,
  .section {
    padding: 2.5rem 0 !important;
  }

  .section-title h2 {
    font-size: clamp(1.35rem, 4.5vw, 1.75rem);
  }

  .section-title p {
    font-size: 0.9rem;
  }
}

/* ── Cards (all public card patterns) ──────────────────────── */
@media (max-width: 767.98px) {
  .zndu-content-card,
  .zndu-sidebar-card,
  [class*="zndu-"][class*="-card"],
  .event-card,
  .notice-card,
  .featured-card,
  .news-card,
  .notice-card-home,
  .sidebar-card,
  .document-card,
  .vacancy-card,
  .gallery-card,
  .campus-facility-card,
  .card {
    padding: 1.1rem 1.15rem !important;
    border-radius: 12px;
    max-width: 100%;
  }

  .zndu-content-card h3,
  .zndu-sidebar-card h5 {
    font-size: 1.05rem;
  }
}

/* ── Sticky sidebars → static on tablet/mobile ─────────────── */
@media (max-width: 991.98px) {
  .zndu-sidebar-card,
  .sidebar-card,
  [class*="sidebar-card"] {
    position: static !important;
    top: auto !important;
  }
}

/* ── Rich text / CMS content ───────────────────────────────── */
@media (max-width: 767.98px) {
  .zndu-content-card,
  .zndu-content-card div,
  .notice-body,
  .notice-excerpt,
  .event-description,
  .post-content,
  .article-content,
  .document-content,
  .vacancy-description,
  main .container [class*="content"] {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .zndu-content-card img,
  .zndu-content-card iframe,
  .zndu-content-card video,
  .zndu-content-card embed,
  .zndu-content-card object,
  .notice-body img,
  .event-description img,
  .post-content img,
  .article-content img,
  article img,
  .ck-content img {
    max-width: 100% !important;
    height: auto !important;
  }

  .zndu-content-card iframe,
  .zndu-content-card video,
  .ck-content iframe {
    width: 100% !important;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 200px;
  }

  .zndu-content-card table,
  .notice-body table,
  .event-description table,
  .article-content table,
  .ck-content table {
    display: block;
    width: 100% !important;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.85rem;
  }

  .zndu-content-card pre,
  .zndu-content-card code,
  .ck-content pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.8rem;
  }

  .zndu-content-card h1,
  .zndu-content-card h2,
  .zndu-content-card h3,
  .ck-content h1,
  .ck-content h2,
  .ck-content h3 {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    line-height: 1.3;
  }
}

/* ── Campus & Facilities page ──────────────────────────────── */
@media (max-width: 767.98px) {
  .campus-intro-copy,
  #campusModalDescription {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .campus-intro-copy table,
  #campusModalDescription table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.85rem;
  }

  .campus-tour-card {
    max-width: 100%;
  }

  .campus-empty {
    padding: 2rem 1rem;
  }
}

/* ── Home page (index) ─────────────────────────────────────── */
@media (max-width: 991.98px) {
  #hero.hero .hero-container .container {
    width: 100%;
  }
}

@media (max-width: 767.98px) {
  #hero.hero .hero-container {
    padding-top: calc(6.25rem + 38px) !important;
  }
}

@media (max-width: 767.98px) {
  .about {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  .about .display-6 {
    font-size: clamp(1.45rem, 5vw, 1.85rem) !important;
    text-align: center;
    word-break: break-word;
  }

  .about .lead {
    font-size: 1rem !important;
    text-align: center;
  }

  .about .d-flex.flex-wrap.gap-4 {
    justify-content: center;
    gap: 0.75rem !important;
  }

  .about .stat-box {
    min-width: calc(33.333% - 0.5rem);
    flex: 1 1 calc(33.333% - 0.5rem);
    padding: 0.75rem 0.65rem;
  }

  .about .stat-box .stat-number {
    font-size: 1.35rem;
  }

  .about .stat-box .stat-label {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
  }

  .about .image-stack {
    height: 260px !important;
    margin-top: 1.5rem !important;
  }

  .about .col-lg-6.pe-lg-5 {
    padding-right: 0 !important;
  }

  .section-title {
    text-align: center;
  }

  .section-title h2 {
    font-size: clamp(1.35rem, 4.5vw, 1.75rem) !important;
    line-height: 1.3;
  }

  .section-title h2::before,
  .section-title h2::after {
    width: 28px;
    margin: 0 8px 8px !important;
  }

  .section-title p {
    font-size: 0.9rem;
  }

  .recent-news article {
    padding: 1.15rem !important;
  }

  .recent-news .post-img {
    margin: -1.15rem -1.15rem 0.85rem -1.15rem !important;
    max-height: 200px;
  }

  .recent-news .post-img img {
    height: 200px;
  }

  .recent-news .title {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
  }

  .recent-news .post-category {
    font-size: 0.9rem;
  }

  .recent-news .post-author {
    font-size: 0.85rem;
    word-break: break-word;
  }

  .recent-news .post-author-img {
    width: 42px;
    margin-right: 10px;
  }

  .recent-news .btn-readnews-all,
  .latest-notices .btn-view-all,
  .events .btn-view-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 320px;
    padding: 0.7rem 1.5rem;
  }

  .events .section-title h2 {
    font-size: clamp(1.35rem, 4.5vw, 1.75rem) !important;
  }

  .events .section-title p {
    font-size: 0.9rem;
  }

  .events .event-card .event-content {
    padding: 1.1rem;
  }

  .events .event-card .event-content h3 {
    font-size: 1.05rem;
    word-break: break-word;
  }

  .events .event-card .event-content p {
    font-size: 0.9rem;
  }

  .events .event-card .event-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .events .event-card .event-meta .meta-item {
    font-size: 0.82rem;
    max-width: 100%;
    word-break: break-word;
  }

  .latest-notices .notice-card-home {
    padding: 1.15rem;
  }

  .latest-notices .notice-card-home__title {
    font-size: 1.05rem;
  }
}

@media (max-width: 400px) {
  .about .stat-box {
    min-width: calc(50% - 0.4rem);
    flex: 1 1 calc(50% - 0.4rem);
  }

  .about .stat-box:last-child {
    min-width: 100%;
    flex: 1 1 100%;
  }
}

/* ── Faculties list page ───────────────────────────────────── */
@media (max-width: 767.98px) {
  .zndu-faculty-section {
    padding: 2rem 0 3rem !important;
  }

  .zndu-stats-row {
    gap: 0.65rem;
  }

  .zndu-stat-item {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 0;
  }

  .zndu-faculty-card {
    max-width: 100%;
  }

  .zndu-faculty-name h3,
  .zndu-featured-card h4 {
    overflow-wrap: anywhere;
  }

  .zndu-featured-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }
}

/* ── Academics landing & listings ──────────────────────────── */
@media (max-width: 767.98px) {
  .zndu-academics-hero h1 {
    font-size: clamp(1.5rem, 6vw, 2.2rem) !important;
  }

  .zndu-filter-tabs,
  .zndu-level-filters,
  .zndu-programme-badges,
  .zndu-hero-stats {
    gap: 0.5rem !important;
  }

  .zndu-filter-tabs a,
  .zndu-level-filters button,
  .zndu-level-filters .btn {
    font-size: 0.78rem;
    padding: 0.4rem 0.85rem;
  }

  .zndu-featured-programme,
  .zndu-featured-grid .zndu-featured-card {
    flex-direction: column !important;
  }

  .zndu-featured-programme .zndu-featured-image,
  .zndu-featured-card .zndu-featured-image {
    width: 100% !important;
    min-height: 200px;
    max-height: 240px;
  }

  .zndu-featured-actions,
  .zndu-featured-programme .zndu-featured-actions {
    flex-direction: column;
    width: 100%;
  }

  .zndu-featured-actions a,
  .zndu-btn-primary,
  .zndu-btn-outline,
  .zndu-btn-gold {
    width: 100%;
    justify-content: center;
  }

  .zndu-faculty-grid,
  .zndu-featured-grid,
  .zndu-programmes-grid,
  .notices-list-row {
    row-gap: 1rem !important;
  }

  .zndu-program-card,
  .zndu-programme-card,
  .zndu-featured-card {
    min-height: auto !important;
  }
}

/* ── Faculty / department detail ───────────────────────────── */
@media (max-width: 767.98px) {
  .zndu-faculty-hero-content,
  .zndu-dept-header-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem;
  }

  .zndu-faculty-stats,
  .zndu-dept-stats {
    flex-wrap: wrap;
    width: 100%;
  }

  .zndu-programme-card .zndu-programme-card-body,
  .zndu-programme-link {
    padding: 1rem !important;
  }
}

/* ── Events public page ────────────────────────────────────── */
@media (max-width: 767.98px) {
  .events-filter-toolbar {
    padding: 1rem 0 !important;
  }

  .events-filter-form .row > [class*="col-"] {
    margin-bottom: 0.25rem;
  }

  .events-period-pills {
    gap: 0.4rem;
  }

  .period-pill {
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
  }

  .event-card {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .event-card .event-date-badge,
  .events .event-card .event-date {
    flex-direction: row !important;
    width: 100%;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px 10px 0 0;
  }

  .event-footer,
  .event-card .event-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem;
  }

  .event-footer .btn-rsvp,
  .event-footer .btn-event,
  .event-card .btn-learn-more {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .event-meta,
  .event-card .event-meta {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.35rem;
  }

  .calendar-widget {
    max-width: 100%;
  }
}

/* ── News & notices ────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .notice-filter-toolbar {
    padding: 1rem !important;
  }

  .notice-filter-pill {
    font-size: 0.75rem;
  }

  .featured-grid {
    grid-template-columns: 1fr !important;
  }

  .news-hero .row,
  .news-hero .side-posts {
    margin-bottom: 0;
  }

  .post-item.main-post h2,
  .news-card .title {
    font-size: 1rem !important;
  }

  .filter-bar .filter-badge,
  .search-filter-alert {
    font-size: 0.8rem;
  }
}

/* ── Official member / council / hierarchy cards ───────────── */
@media (max-width: 767.98px) {
  .official-member-card,
  .official-members-grid .official-member-card,
  .leadership-card,
  .council-member-card {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .official-member-card__photo,
  .leadership-card img {
    max-width: 100%;
    height: auto;
  }
}

/* ── Campus facilities ─────────────────────────────────────── */
@media (max-width: 767.98px) {
  .campus-category-filters {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .campus-facility-card__media {
    height: 200px !important;
  }

  #campusTourModal .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
}

/* ── Gallery & downloads ───────────────────────────────────── */
@media (max-width: 767.98px) {
  .gallery-grid,
  .downloads-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  .album-hero,
  .gallery-hero {
    padding-top: 6rem !important;
  }
}

@media (max-width: 400px) {
  .gallery-grid,
  .downloads-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Forms & filter toolbars ───────────────────────────────── */
@media (max-width: 767.98px) {
  .events-filter-form .btn-filter-apply,
  .events-filter-form .btn-filter-clear,
  .btn-notice-filter,
  .search-input-group {
    width: 100%;
  }

  .search-input-group input,
  .search-input-group .form-control {
    min-width: 0;
    flex: 1 1 auto;
  }

  form .d-flex.flex-wrap.gap-2,
  form .d-flex.gap-2 {
    width: 100%;
  }

  form .form-control[style*="max-width"] {
    max-width: 100% !important;
  }
}

/* ── Button groups & CTAs ──────────────────────────────────── */
@media (max-width: 575.98px) {
  .cta-buttons,
  .zndu-featured-actions,
  .hero-content .cta-buttons,
  .d-flex.gap-2.align-items-center.flex-wrap .btn {
    width: 100%;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: stretch !important;
  }

  .cta-buttons a,
  .cta-buttons .btn-primary,
  .cta-buttons .btn-secondary {
    width: 100%;
    max-width: none !important;
    text-align: center;
  }
}

/* ── Tables & data lists ───────────────────────────────────── */
@media (max-width: 767.98px) {
  .table-responsive,
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    font-size: 0.85rem;
  }
}

/* ── Footer ────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .footer-top {
    padding-top: 2.5rem !important;
  }

  .footer-brand-title {
    font-size: 1.1rem;
  }

  .footer-links h4 {
    font-size: 1rem;
    margin-top: 0.5rem;
  }
}

/* ── Pagination ────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .pag-list {
    gap: 2px !important;
  }

  .pag-btn {
    min-width: 32px !important;
    height: 32px !important;
    font-size: 0.78rem !important;
    padding: 0 0.4rem !important;
  }

  .pag-info {
    font-size: 0.75rem;
  }
}

/* ── Utility: prevent flex/grid children overflow ──────────── */
@media (max-width: 767.98px) {
  .row > [class*="col-"],
  .d-flex > *,
  .grid > * {
    min-width: 0;
  }

  img,
  video,
  svg {
    max-width: 100%;
    height: auto;
  }

  h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
  }
}
