
/* ==========================================================================
   CODE GALLERY TABLE
   ========================================================================== */

/* Base table layout and typography */
.code-gallery-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: fixed;
}

/* Shared table cell spacing and separators */
.code-gallery-table th,
.code-gallery-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  vertical-align: middle;
}

/* Table header styling */
.code-gallery-table th {
  text-align: left;
  font-weight: 600;
}

/* Title column width (allows long tutorial titles) */
.code-gallery-table th:nth-child(1),
.code-gallery-table td:nth-child(1) {
  width: 35%;
}

/* Enable wrapping for long titles */
.code-gallery-table td:nth-child(1) {
  white-space: normal;
  word-break: break-word;
}

/* Preview, resources, and download columns */
.code-gallery-table td:nth-child(n+3),
.code-gallery-table th:nth-child(n+3) {
  text-align: center;
  width: 4.25rem;
}


/* ==========================================================================
   ICON LINKS (PREVIEW / DOWNLOAD / RESOURCES)
   ========================================================================== */

/* Icon link wrapper */
.cg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  color: inherit;
  text-decoration: none;
}

/* Prevent SVG baseline alignment issues */
.cg-icon svg {
  display: block;
}

/* Hover feedback for icon buttons */
.cg-icon:hover {
  background: rgba(0,0,0,0.06);
  border-radius: 0.4rem;
}


/* ==========================================================================
   MODAL BACKDROP (DIM OVERLAY)
   ========================================================================== */

/* Primary backdrop used by modal open/close logic */
.cg-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  z-index: 99998;
}

/* Legacy/alternate backdrop (currently unused) */
.cg-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  z-index: 99998;
}


/* ==========================================================================
   MODAL CONTAINER AND CONTENT LAYOUT
   ========================================================================== */

/* Modal positioning, sizing, and container styling */
.cg-modal {
  position: fixed;
  left: 50%;
  top: 0;
  transform: translateX(-50%);    /* Center horizontally only */
  margin-top: 40px;

  width: min(900px, 92vw);
  max-height: calc(100vh - 120px);
  overflow: auto;

  background: #fff;
  border-radius: 14px;
  padding: 18px;
  display: none;

  z-index: 99999;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

/* Modal heading spacing */
.cg-modal h3 {
  margin: 0 0 8px;
}

/* Optional description block spacing */
.cg-modal .cg-desc {
  margin: 0 0 12px;
}

/* Grid layout for multi-language outputs */
.cg-modal .cg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* Stack language blocks on smaller screens */
@media (max-width: 750px){
  .cg-modal .cg-grid {
    grid-template-columns: 1fr;
  }
}

/* Remove default figure margin */
.cg-modal figure {
  margin: 0;
}

/* Default modal image styling (overridden for framed previews) */
.cg-modal img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
}

/* Optional modal action row */
.cg-modal .cg-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

/* Modal close button */
.cg-modal .cg-close {
  border: 0;
  background: rgba(0,0,0,0.06);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}


/* ==========================================================================
   PRIMARY ACTION BUTTON
   ========================================================================== */

/* Base button style */
.cg-btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  background: #0d6efd;
  color: #ffffff;
  border: 1px solid #0d6efd;
  text-decoration: none;
  font-weight: 500;
}

/* Button hover state */
.cg-btn:hover {
  background: #0b5ed7;
  border-color: #0b5ed7;
  color: #ffffff;
}

/* Keyboard focus styling */
.cg-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13,110,253,0.35);
}


/* ==========================================================================
   CAROUSEL CONTROLS
   ========================================================================== */

/* Carousel container */
.cg-carousel {
  position: relative;
}

/* Navigation row (prev/next + counter) */
.cg-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* Navigation arrow buttons */
.cg-arrow {
  border: 0;
  background: #eee;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

/* Slide counter text */
.cg-count {
  font-size: 0.9em;
  opacity: 0.75;
}


/* ==========================================================================
   PREVIEW SLIDES AND FRAMES
   ========================================================================== */

/* Preview slide wrapper */
.cg-figure {
  width: 100%;
  height: 260px;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  background: #f8f9fa;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Image sizing inside preview frame */
.cg-figure img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  width: auto;
  height: auto;
}

/* Hide inactive slides */
.cg-slide {
  display: none;
}

/* Show active slide */
.cg-slide.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Uniform image frame */
.cg-imgframe {
  width: 100%;
  height: 260px;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  background: #f8f9fa;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* Prevent framed images from stretching to full width */
.cg-modal .cg-imgframe img {
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}


/* ==========================================================================
   IMAGE LIGHTBOX (CLICK-TO-ZOOM)
   ========================================================================== */

/* Fullscreen lightbox overlay */
.cg-imglightbox {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100000;
  padding: 24px;
  background: rgba(0,0,0,.75);
}

/* Enlarged image styling */
.cg-imglightbox img {
  display: block;
  max-width: min(1100px, 96vw);
  max-height: 90vh;
  margin: 0 auto;
  border-radius: 14px;
  background: #fff;
}

/* Lightbox close button */
.cg-imgclose {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

/* Cursor cue for zoomable images */
.cg-modal img {
  cursor: zoom-in;
}


/* ==========================================================================
   CAPTIONS
   ========================================================================== */

/* Caption under preview image */
.cg-caption {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #555;
  text-align: center;
}

/* Caption under lightbox image */
.cg-lightbox-caption {
  margin-top: 12px;
  text-align: center;
  color: #eee;
  font-size: 0.95rem;
}


/* ==========================================================================
   FILTER BAR (CATEGORY + SOFTWARE)
   ========================================================================== */

/* Filter bar container */
.cg-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  background: rgba(0,0,0,0.02);
}

/* Group wrapper for related controls */
.cg-filtergroup {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Filter group label */
.cg-filterlabel {
  font-weight: 600;
  opacity: 0.85;
  margin-right: 2px;
}

/* Category dropdown */
.cg-select {
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 999px;
  background: #fff;
}

/* Software filter chip */
.cg-chip {
  border: 1px solid rgba(0,0,0,0.18);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  user-select: none;
}

/* Close icon inside chip (hidden until active) */
.cg-chip .cg-chipx {
  display: none;
  font-weight: 700;
  opacity: 0.7;
}

/* Active chip styling */
.cg-chip[aria-pressed="true"] {
  background: rgba(13,110,253,0.10);
  border-color: rgba(13,110,253,0.35);
}

/* Show close icon when active */
.cg-chip[aria-pressed="true"] .cg-chipx {
  display: inline;
}

/* Clear filters chip */
.cg-chipclear {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.12);
}

/* Results count indicator */
.cg-filtercount {
  margin-left: auto;
  opacity: 0.75;
  font-size: 0.95rem;
}


/* ==========================================================================
   SINGLE-LANGUAGE MODAL VARIANTS
   ========================================================================== */

/* Force single-language modal grid to one column */
.cg-grid-single {
  grid-template-columns: 1fr;
}

/* Side-by-side layout (image + button) */
.cg-one {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

/* Side-by-side media wrapper */
.cg-one-media {
  width: fit-content;
  max-width: 100%;
}

/* Prevent frame stretching in side-by-side mode */
.cg-one .cg-imgframe {
  width: fit-content !important;
  max-width: 100%;
  margin: 0 auto;
}

/* Prevent carousel stretching in side-by-side mode */
.cg-one .cg-carousel {
  width: fit-content;
  max-width: 100%;
}

/* Side-by-side button wrapper */
.cg-one-actions {
  display: flex;
  align-items: center;
}

/* Shrink-wrap entire preview block */
.cg-one .cg-figure {
  width: fit-content !important;
  max-width: 100%;
  margin: 0 auto;
}

/* Ensure carousel shrink-wraps as well */
.cg-one .cg-carousel {
  width: fit-content !important;
  max-width: 100%;
  margin: 0 auto;
}

/* Override full-width frame in single-language mode */
.cg-one .cg-imgframe {
  width: auto !important;
  display: inline-flex;
}

/* Prevent captions from spanning full modal width */
.cg-one .cg-caption {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}


/* ==========================================================================
   SINGLE-LANGUAGE (VERTICAL) — BUTTON UNDER IMAGE
   ========================================================================== */

/* Vertical stack layout (image above button) */
.cg-one-vertical {
  display: flex;
  flex-direction: column;
  align-items: flex-start;   /* LEFT-align image and button */
  gap: 10px;
}

/* Shrink-wrap preview container */
.cg-one-vertical .cg-figure,
.cg-one-vertical .cg-carousel {
  width: fit-content !important;
  max-width: 100%;
  margin: 0;
}

/* Prevent frame from forcing full width */
.cg-one-vertical .cg-imgframe {
  width: auto !important;
  display: inline-flex;
}

/* Button container under image (left-aligned) */
.cg-one-vertical .cg-one-actions {
  width: auto;
  display: flex;
  justify-content: flex-start;
}

/* ==========================================================================
   FAQ styling
   ========================================================================== */

.faq-section {
  background-color: #f5f6f7;
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 6px;
}

.faq details summary {
  font-weight: 600;
  color: #005cb9;
  cursor: pointer;
}

.faq details summary:hover {
  color: #003f88;
}

.faq details {
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   Resources grid styling
   ========================================================================== */

.resource-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.resource-card {
  background: #f7f8f9;
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid #005cb9;
}

/* ==========================================================================
   News cards styling
   ========================================================================== */

.news-card {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: #f7f8f9;
  border-left: 4px solid #005cb9;
  border-radius: 6px;
}

.news-card h3 {
  margin-top: 0;
}