/* ============================================================
   Gallery Grid & Patient Detail Viewer
   Adapted from drpanossian.com live site to our theme:
   Sharp corners, black/white/gray, Gloock headings, Figtree body
   ============================================================ */

/* --- Gallery Index (Landing Page) --- */
.gallery-index-section {
  background: #f5f5f5;
  padding: 60px 0 80px;
}
.gallery-index-section .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.gallery-index-group {
  display: flex;
  align-items: stretch;
  background: #fff;
  margin-bottom: 32px;
  overflow: hidden;
  transition: box-shadow .3s;
}
.gallery-index-group:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
/* Alternate direction: even groups flip */
.gallery-index-group:nth-child(even) {
  flex-direction: row-reverse;
}
.group-media {
  width: 38%;
  min-height: 280px;
  flex-shrink: 0;
  overflow: hidden;
}
.group-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .6s ease;
}
.gallery-index-group:hover .group-media img {
  transform: scale(1.04);
}
.group-content {
  flex: 1;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.group-content h2 {
  font-family: 'Gloock', serif;
  font-size: 36px;
  font-weight: 400;
  color: #111;
  margin: 0 0 24px;
  letter-spacing: -0.01em;
}
.group-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.group-content ul li a {
  font-family: 'Figtree', sans-serif;
  font-size: 16px;
  font-style: italic;
  color: #444;
  text-decoration: none;
  position: relative;
  padding-left: 20px;
  transition: color .2s;
  display: inline-block;
}
.group-content ul li a::before {
  content: '→';
  position: absolute;
  left: 0;
  top: 0;
  color: #999;
  transition: transform .2s, color .2s;
}
.group-content ul li a:hover {
  color: #000;
}
.group-content ul li a:hover::before {
  transform: translateX(4px);
  color: #000;
}
@media (max-width: 768px) {
  .gallery-index-group,
  .gallery-index-group:nth-child(even) {
    flex-direction: column;
  }
  .group-media {
    width: 100%;
    min-height: 200px;
    max-height: 240px;
  }
  .group-content {
    padding: 32px 24px;
  }
  .group-content h2 {
    font-size: 28px;
    margin-bottom: 16px;
  }
}

/* --- Page Hero --- */
.gallery-page-hero {
  background: #1a1a1a;
  padding: 100px 0 48px;
  text-align: center;
}
.gallery-page-hero .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
}
.gallery-page-hero .back-to-gallery {
  color: rgba(255,255,255,.6);
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 24px;
  transition: color .2s;
}
.gallery-page-hero .back-to-gallery:hover { color: #fff; }
.gallery-page-hero .section-label {
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: rgba(255,255,255,.5);
  margin-bottom: 12px;
}
.gallery-page-hero h1 {
  font-family: 'Gloock', serif;
  font-size: 52px;
  color: #fff;
  margin: 0 0 8px;
  font-weight: 400;
}
.gallery-page-hero .gallery-page-subtitle {
  color: rgba(255,255,255,.5);
  font-family: 'Figtree', sans-serif;
  font-size: 15px;
  margin: 0;
}
@media (max-width: 768px) {
  .gallery-page-hero { padding: 80px 0 36px; }
  .gallery-page-hero h1 { font-size: 36px; }
}

/* --- Gallery Grid Section --- */
.gallery-grid-section {
  background: #fafafa;
  padding: 48px 0 80px;
}
.gallery-grid-section .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Result Count --- */
.gallery-result-count {
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 24px;
}

/* --- Category Selector Dropdown --- */
.gallery-category-selector {
  position: relative;
  display: inline-block;
  margin-bottom: 32px;
}
.gallery-category-selector .dropdown-toggle {
  background: #fff;
  border: 1px solid #ddd;
  padding: 10px 40px 10px 16px;
  font-family: 'Figtree', sans-serif;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  min-width: 240px;
}
.gallery-category-selector .dropdown-toggle .arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #333;
  transition: transform .2s;
}
.gallery-category-selector.open .dropdown-toggle .arrow {
  transform: translateY(-50%) rotate(180deg);
}
.gallery-category-selector .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 240px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.gallery-category-selector.open .dropdown-menu { display: block; }
.gallery-category-selector .dropdown-menu li a {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: #333;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  transition: background .15s;
}
.gallery-category-selector .dropdown-menu li a:hover { background: #f5f5f5; }
.gallery-category-selector .dropdown-menu li a.back-link {
  color: #999;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

/* --- Subcategory Heading --- */
.gallery-subcategory { margin-bottom: 48px; }
.gallery-subcategory[style*="display: none"] { display: none !important; }
.gallery-subcategory-heading {
  font-family: 'Gloock', serif;
  font-size: 28px;
  font-weight: 400;
  color: #1a1a1a;
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e0e0e0;
}

/* ============================================================
   Patient Detail Viewer (3-panel layout)
   ============================================================ */

.patient-viewer {
  width: 100%;
  margin-bottom: 40px;
}

/* --- Panel 1 + Panel 2: Main image + thumbnails row --- */
.patient-viewer-top {
  width: 100%;
  display: flex;
  gap: 20px;
  margin-bottom: 0;
}

/* Panel 1: Main Image */
.patient-main-image {
  flex: 1;
  min-width: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.patient-main-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  max-height: 560px;
}

/* Panel 2: Thumbnails (right column) */
.patient-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 120px;
  min-width: 120px;
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
}
.patient-thumbnails::-webkit-scrollbar { width: 4px; }
.patient-thumbnails::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.patient-thumbnails .thumb-item {
  cursor: pointer;
  border: 2px solid transparent;
  transition: opacity .2s, border-color .2s;
  flex-shrink: 0;
}
.patient-thumbnails .thumb-item:hover { opacity: .7; }
.patient-thumbnails .thumb-item.active {
  opacity: .4;
  border-color: #1a1a1a;
}
.patient-thumbnails .thumb-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- Panel 3: Patient Navigation (bottom) --- */
.patient-nav-panel {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #e0e0e0;
}
.patient-nav-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.patient-nav-buttons .patient-info {
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  color: #999;
}
.patient-nav-btn {
  background: #1a1a1a;
  color: #fff;
  border: none;
  padding: 10px 24px;
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: opacity .2s;
}
.patient-nav-btn:hover { opacity: .7; }
.patient-nav-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.patient-nav-heading {
  font-family: 'Gloock', serif;
  font-size: 18px;
  font-weight: 400;
  color: #1a1a1a;
  margin: 0 0 16px;
}

.patient-strip-container {
  position: relative;
  overflow: hidden;
}
.patient-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.patient-strip::-webkit-scrollbar { height: 4px; }
.patient-strip::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.patient-strip .strip-item {
  flex-shrink: 0;
  width: 100px;
  cursor: pointer;
  transition: opacity .2s;
  border: 2px solid transparent;
}
.patient-strip .strip-item:hover { opacity: .7; }
.patient-strip .strip-item.active {
  opacity: .4;
  border-color: #1a1a1a;
}
.patient-strip .strip-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .patient-viewer-top {
    flex-direction: column;
    gap: 12px;
  }
  .patient-thumbnails {
    flex-direction: row;
    width: 100%;
    min-width: unset;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
  }
  .patient-thumbnails .thumb-item {
    width: 80px;
    min-width: 80px;
  }
  .patient-main-image img {
    max-height: none;
  }
  .patient-nav-buttons {
    flex-wrap: wrap;
    gap: 12px;
  }
  .patient-nav-btn {
    padding: 8px 16px;
    font-size: 12px;
  }
  .patient-strip .strip-item {
    width: 80px;
  }
}

/* --- Gallery Grid (for pages without data / fallback) --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.gallery-grid .gallery-item {
  display: block;
  overflow: hidden;
  background: #eee;
  cursor: pointer;
}
.gallery-grid .gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform .3s;
}
.gallery-grid .gallery-item:hover img { transform: scale(1.03); }

/* --- Lightbox (legacy, kept for compatibility) --- */
.gallery-lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.92);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.gallery-lightbox.active { display: flex; }
.gallery-lightbox img {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 10001;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 48px;
  padding: 8px 16px;
  cursor: pointer;
  z-index: 10001;
  transition: background .2s;
}
.lightbox-nav:hover { background: rgba(255,255,255,.3); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* Pagination (unused in new viewer but kept) */
.gallery-pagination { display: none; }
