/* =========================================================
   TQMS PAGE CSS — FINAL BASELINE (DOCUMENT SAFE)
   Version: v01.0 FINAL
   Purpose:
   - Stable layout
   - Mobile-safe document viewing
   - No viewport hacks
   ========================================================= */


/* =========================================================
   HEADER (SAFE OVERRIDE)
   ========================================================= */

.tqms-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 20px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}


/* =========================================================
   BRAND / LOGO
   ========================================================= */

.header-left {
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  line-height: 1;
}

.brand-logo {
  height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

@media (max-width: 1024px) {
  .brand-logo { height: 36px; }
}

@media (max-width: 640px) {
  .brand-logo { height: 30px; }
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.header-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.header-nav a {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  text-decoration: none;
}

.header-nav a:hover {
  text-decoration: underline;
}


/* =========================================================
   RIGHT SIDE (TOOLS)
   ========================================================= */

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#themeToggle {
  cursor: pointer;
  border: 1px solid var(--border-soft);
  background: var(--bg-main);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
}


/* =========================================================
   MOBILE MENU
   ========================================================= */

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 18px;
  cursor: pointer;
}

@media (max-width: 768px) {

  .menu-toggle {
    display: inline-block;
  }

  .header-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
  }

  .header-nav.is-open {
    display: flex;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }
}


/* =========================================================
   MAIN LAYOUT
   ========================================================= */

.tqms-main {
  max-width: 1400px;
  margin: auto;
  padding: 36px 20px;
}


/* =========================================================
   HERO
   ========================================================= */

.tqms-hero h1 {
  font-weight: 800;
  line-height: 1.2;
  font-size: clamp(1.6rem, 4.5vw, 2.2rem);
}

.subtitle {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  line-height: 1.55;
  max-width: 68ch;
}


/* =========================================================
   GATEWAYS / CARDS
   ========================================================= */

.tqms-gateways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
  margin-top: 36px;
}

.gateway-card {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.gateway-card.clickable {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.gateway-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.25);
}

.gateway-card h2 {
  margin-bottom: 10px;
  color: var(--text-title);
}


/* =========================================================
   TAGS
   ========================================================= */

.tag {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  display: inline-block;
  margin-top: 12px;
}

.tag.live {
  background: #064e3b;
  color: #a7f3d0;
}

.tag.coming {
  background: #374151;
  color: #ffffff;
}


/* =========================================================
   FOOTER
   ========================================================= */

.tqms-footer {
  margin-top: 60px;
  padding: 32px 20px;
  background: var(--bg-footer);
  border-top: 1px solid var(--border-soft);
}

.footer-inner {
  max-width: 1400px;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}


/* =========================================================
   BACK LINK
   ========================================================= */

.back-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}


/* =========================================================
   DOCUMENT / PDF VIEW — SINGLE SOURCE OF TRUTH
   ========================================================= */

.tqms-detail-section {
  margin-top: 32px;
  overflow-x: hidden;
}

/* Scanned documents / images */
.tqms-detail-section img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto 16px;
}

/* PDF / iframe viewers */
.document-viewer {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.document-viewer iframe,
.document-viewer embed,
.document-viewer object {
  width: 100%;
  height: 80vh;
  border: none;
  display: block;
}


/* =========================================================
   MOBILE TUNING (REAL DEVICE SAFE)
   ========================================================= */

@media (max-width: 640px) {

  .tqms-main {
    padding: 20px 12px;
  }

  .gateway-card {
    padding: 16px;
    border-radius: 12px;
  }

  .tqms-detail-section img {
    width: 100%;
    max-width: 100%;
  }

  .document-viewer iframe,
  .document-viewer embed,
  .document-viewer object {
    height: 65vh;
  }
}


/* =========================================================
   HOME – 2E + 1P EXECUTION FRAMEWORK
   ========================================================= */

.tqms-2e1p {
  width: 100%;
  padding: 3rem 1rem 4rem;
  background: linear-gradient(
    to bottom,
    rgba(245, 247, 250, 0.6),
    rgba(255, 255, 255, 1)
  );
}

.tqms-2e1p-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.tqms-2e1p img {
  width: 100%;
  max-width: 1100px;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* =========================================================
   PROJECT MODULE LAYOUT
========================================================= */

.project-layout {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}

.project-sidebar {
  width: 220px;
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-sidebar a {
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 500;
  transition: all 0.2s ease;
}

.project-sidebar a:hover {
  background: #f3f4f6;
}

.project-sidebar a.active {
  background: #facc15;
  color: #000;
}

.project-content {
  flex: 1;
}

/* ============================================
   MOBILE SIDEBAR DRAWER
============================================ */

.sidebar-toggle {
  display: none;
  margin-bottom: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: #facc15;
  font-weight: 600;
  cursor: pointer;
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9998;
}

/* Mobile Mode */
@media (max-width: 768px) {

  .project-layout {
    flex-direction: column;
  }

  .sidebar-toggle {
    display: inline-block;
  }

  .project-sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100%;
    border-radius: 0;
    z-index: 9999;
    transition: left 0.3s ease;
  }

  .project-sidebar.open {
    left: 0;
  }

  .sidebar-overlay.active {
    display: block;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

/* Hide toggle by default (desktop) */
.sidebar-toggle-icon {
  display: none;
}

/* Show only on mobile */
@media (max-width: 768px) {
  .sidebar-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #facc15;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
  }
}

.hero-topline {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* =========================================================
   PROJECT PHOTO GRID
========================================================= */

/* =========================================================
   PROJECT PHOTO GRID (Responsive)
========================================================= */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 20px;
}

/* Tablet */
@media (max-width: 1024px) {
  .photo-grid {
    gap: 16px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .photo-grid {
    grid-template-columns: 1fr;  /* ✅ One column */
    gap: 18px;
  }
}


.photo-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

/* Tablet */
@media (max-width: 1024px) {
  .photo-item img {
    height: 260px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .photo-item img {
    height: auto;              /* ✅ natural ratio */
    max-height: 70vh;          /* ✅ prevents too tall */
  }
}


.photo-item img:hover {
  transform: scale(1.02);
}

.photo-filters select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: #fff;
  font-weight: 600;
}


/* =========================================================
   FULLSCREEN LIGHTBOX — FIXED VERSION
========================================================= */

body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;               /* replaces top/left/width/height */
  z-index: 100000;        /* higher than header */
  background: rgba(0,0,0,0.95);

  align-items: center;
  justify-content: center;
}

.lightbox-content {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  transition: transform 0.2s ease;
  cursor: zoom-in;
}

.lightbox .close {
  position: fixed;
  top: 25px;
  right: 40px;
  font-size: 40px;
  color: #fff;
  cursor: pointer;
  z-index: 100001;
}

.lightbox .nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 60px;
  color: #fff;
  cursor: pointer;
  z-index: 100001;
  user-select: none;
}

.lightbox .prev { left: 30px; }
.lightbox .next { right: 30px; }

/* =====================================
   PHOTO SUB TABS
===================================== */

.photo-subtabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.photo-subtabs a {
    padding: 8px 16px;
    border-radius: 20px;
    background: #f3f4f6;
    text-decoration: none;
    font-weight: 500;
    color: #333;
    transition: 0.2s ease;
}

.photo-subtabs a:hover {
    background: #e5e7eb;
}

.photo-subtabs a.active {
    background: #facc15; /* SLG gold */
    color: #000;
    font-weight: 600;
}

.incident-table {
    width:100%;
    border-collapse: collapse;
    margin-top:20px;
}

.incident-table th,
.incident-table td {
    padding:10px;
    border-bottom:1px solid var(--border-soft);
    text-align:left;
}

.incident-table th {
    background:var(--bg-surface);
}

.sidebar-section-title {
  margin-top: 18px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
