/* New styles for image-based layout */
.profile-container {
  max-width: 1000px;
  margin: 16px auto;
  padding: 0 20px;
}

.profile-card-top {
  display: flex;
  gap: 20px;
  padding: 20px;
  border-radius: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
}

.photo-wrapper {
  width: 300px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.profile-details {
  flex: 1;
  padding-left: 12px;
}

.profile-details h2 {
  margin: 0 0 4px 0;
  font-size: 1.8rem;
  color: var(--text-primary);
}

.profile-details .hint {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 12px;
}

/* Larger purple-gradient pills — high-contrast modern look */
.profile-meta-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.profile-meta-list li {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed 0%, #6d28d9 100%);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 12px 36px rgba(124,58,237,0.12);
  transition: transform 140ms ease, box-shadow 140ms ease;
  min-height: 52px;
  border: none;
}

.profile-meta-list li:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(124,58,237,0.16);
}

.profile-meta-list svg {
  width: 18px;
  height: 18px;
  color: rgba(255,255,255,0.95);
  flex-shrink: 0;
}

/* Text inside pills */
.profile-meta-list .meta-value,
.profile-meta-list span {
  font-size: 1rem;
  color: #ffffff;
  font-weight: 800;
  white-space: nowrap;
}

/* Make secondary lighter pill variant (optional) */
.profile-meta-list li.secondary {
  background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
  color: #6b7280;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: none;
}

/* Responsive: stack pills on small screens */
@media (max-width: 720px) {
  .profile-meta-list {
    gap: 10px;
    justify-content: center;
  }
  .profile-meta-list li {
    flex: 1 1 calc(50% - 12px);
    justify-content: center;
    padding: 12px 14px;
    min-height: 44px;
  }
  .profile-meta-list .meta-value, .profile-meta-list span { font-size: 0.95rem; }
}

.profile-meta-list li {
  display: inline-block;
  margin-right: 15px;
  margin-bottom: 8px;
}

.profile-meta-list li::before {
  content: '•';
  color: var(--primary);
  margin-right: 8px;
}

.profile-meta-list li:first-child::before {
  content: none;
}

.profile-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* small icon styles within cards */
.card-icon { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; margin-right:8px; font-size:16px; color:var(--primary); }
.info-label .label-icon { margin-right:8px; color:var(--primary); }
.status-pill { padding:6px 10px; border-radius:999px; font-weight:700; font-size:0.85em; background:rgba(111,66,193,0.08); color:var(--primary); }

.profile-actions .btn-outline {
  padding: 10px 18px;
  border-radius: 24px;
}

.profile-actions .btn-cta {
  padding: 10px 18px;
  border-radius: 24px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.section-header h4 {
  margin: 0;
  font-size: 1.4em;
  font-weight: 600;
}

.info-table {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 20px;
  font-size: 1em;
}

.info-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.info-value {
  color: var(--text-primary);
  font-weight: 600;
}

.info-value a {
  color: var(--primary);
  text-decoration: none;
}

/* Overriding old styles */
.profile-hero, .profile-main-content, .profile-sidebar, .profile-photo-section, .profile-photo-card, .info-grid, .info-item, .about-section, .contact-card {
  all: unset; /* Resetting old layout styles */
}

.mod-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

/* Photo Gallery adjustments for new layout */
/* Top primary photo container */
.profile-photo-gallery {
  width: 100%;
  height: 360px; /* Adjusted height for tighter layout */
  margin-bottom: 0;
  border-radius: 12px;
  box-shadow: none;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Primary photo frame and image -- preserve aspect and avoid ugly cropping */
.photo-frame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
}
.photo-frame-img, #primary-photo, .profile-photo-gallery img.photo-frame-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 12px;
}

/* Thumbnail grid below the primary photo */
#photo-gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
#photo-gallery-grid .gallery-thumb-wrap {
  width: 120px;
  height: 120px;
  flex: 0 0 120px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
#photo-gallery-grid .gallery-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  cursor: pointer;
}

/* When a thumbnail is clicked we open a lightbox; ensure thumbnails are NOT replaced by full-size images */
#photo-gallery-section .mod-card > img.fullsize {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* Interest / view card photo tweak: keep a framed thumbnail rather than the large profile-photo size */
.interest-card .profile-photo,
.view-card .profile-photo {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  border: 8px solid #fff;
  box-shadow: 0 12px 30px rgba(2,6,23,0.08);
}

/* Ensure primary top card photo stays prominent while preventing overflow */
.profile-card-top .photo-wrapper img,
.profile-photo {
  max-width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center;
}

/* Hide any legacy gallery thumbnail controls that may conflict */
.gallery-nav, .gallery-thumbnails { display: none !important; }

.gallery-image {
  border-radius: 12px;
}

.gallery-counter {
  position: absolute;
  bottom: 10px;
  left: 10px;
  transform: none;
  background: rgba(0,0,0,0.5);
  padding: 4px 8px;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.gallery-nav {
  display: none; /* Hide arrows for cleaner look */
}

.gallery-thumbnails {
  display: none; /* Hide thumbnails for cleaner look */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .profile-card-top {
    flex-direction: column;
  }
  .photo-wrapper {
    width: 100%;
    height: 300px;
  }
  .info-table {
    grid-template-columns: 1fr;
  }
}
/* ===== Targeted fixes: interest card thumbnails, profile top photo, and gallery thumbnails ===== */

/* Ensure interest/view cards use a compact framed thumbnail (not the large profile-photo style) */
.interest-card .profile-photo,
.view-card .profile-photo {
  width: 120px !important;
  height: 120px !important;
  border-radius: 12px !important;
  object-fit: cover !important;
  object-position: center !important;
  border: 6px solid #fff !important;
  box-shadow: 0 12px 30px rgba(2,6,23,0.08) !important;
  flex-shrink: 0;
}

/* Prevent .profile-photo global rules from making every photo huge inside cards */
.interest-card .profile-photo:hover,
.view-card .profile-photo:hover {
  transform: none !important;
  box-shadow: 0 12px 30px rgba(2,6,23,0.10) !important;
}

/* Keep the top profile card image prominent but properly cropped */
.profile-card-top .photo-wrapper {
  width: 300px;
  height: 300px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 12px;
}
.profile-card-top .photo-frame-img,
.profile-card-top #primary-photo {
  width: 100%;
  height: 100%;
  /* Use 'cover' so the image fills the square frame while preserving aspect ratio.
     This avoids long vertical images showing as thin strips and matches the desired square rounded look. */
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 12px;
  background-color: #f6f7f9;
}

/* Thumbnail grid: show as small cover thumbnails, not full-size images */
#photo-gallery-grid .gallery-thumb-wrap {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  background: #fff;
}
#photo-gallery-grid .gallery-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  cursor: pointer;
  border-radius: 0; /* image sits flush inside wrapper which already has radius */
}

/* When a large/full-size image is intentionally shown inside the photo section,
   it should be marked with .fullsize so thumbnails aren't reflowed into full width */
#photo-gallery-section .mod-card > img.fullsize {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Safety: do not make all images under photo gallery full-width */
#photo-gallery-section img:not(.fullsize) {
  max-width: none;
}

/* Slight padding adjustments so meta text doesn't sit too low in card */
.interest-card .profile-meta,
.view-card .profile-meta {
  padding-top: 6px;
}

/* Ensure action buttons are aligned near the meta content */
.interest-card .actions, .view-card .actions {
  margin-top: 10px;
}

/* Responsive tweaks keep thumbnail smaller on mobile */
@media (max-width: 900px) {
  .interest-card .profile-photo,
  .view-card .profile-photo {
    width: 84px !important;
    height: 84px !important;
    border: 4px solid #fff !important;
  }
  #photo-gallery-grid .gallery-thumb-wrap {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
  }
  .profile-card-top .photo-wrapper {
    width: 100%;
    height: 280px;
  }
}
/* Final UI refinements: make primary photo square & rounded, thumbnails rounded, muted placeholders, and reset thumbnail buttons */
.photo-frame {
  /* enforce square framed primary photo and rounded corners */
  width: 300px !important;
  height: 300px !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  background: #f6f7f9 !important;
  box-shadow: 0 18px 40px rgba(2,6,23,0.06) !important;
  border: 1px solid rgba(226,232,240,0.7) !important;
}

/* Ensure image fills the square frame and is nicely cropped */
.photo-frame .photo-frame-img,
.profile-card-top .photo-frame-img,
.profile-card-top #primary-photo {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}

/* Make small thumbnail buttons clean and square with rounded corners */
.thumb-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-block;
  line-height: 0;
}
.photo-grid .gallery-thumb-wrap,
#photo-gallery-grid .gallery-thumb-wrap {
  width: 96px !important;
  height: 96px !important;
  flex: 0 0 96px !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  border: 1px solid rgba(226,232,240,0.7) !important;
  box-shadow: 0 8px 22px rgba(2,6,23,0.06) !important;
  background: #fff !important;
}

/* Slight hover affordance */
.photo-grid .gallery-thumb-wrap:hover,
#photo-gallery-grid .gallery-thumb-wrap:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(2,6,23,0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

/* Muted placeholder styling used by display_readable() */
.muted {
  color: #9ca3af;
  font-weight: 700;
  font-size: 0.96rem;
}

/* Tidy Personal Information spacing and make values clearer */
.personal-info .info-table {
  gap: 10px 18px !important;
}
.personal-info .info-label {
  color: #7c3aed !important;
  font-weight: 700;
  min-height: 30px;
}
.personal-info .info-value {
  color: #111827 !important;
  font-weight: 600;
}

/* Stronger hero card look matching the mock */
.profile-card-top {
  background: linear-gradient(180deg, #ffffff, #fbfbff) !important;
  border-radius: 20px !important;
  padding: 28px !important;
  box-shadow: 0 30px 70px rgba(2,6,23,0.06) !important;
}

/* Keep the photo counter visible but subtle */
.photo-frame .photo-counter {
  font-size: 13px !important;
  padding: 6px 9px !important;
  right: 12px !important;
  bottom: 12px !important;
  background: rgba(0,0,0,0.55) !important;
}

/* Smaller screens: scale down framed photo */
@media (max-width: 900px) {
  .photo-frame, .profile-card-top .photo-wrapper {
    width: 260px !important;
    height: 260px !important;
  }
  .photo-grid .gallery-thumb-wrap, #photo-gallery-grid .gallery-thumb-wrap {
    width: 72px !important;
    height: 72px !important;
    flex: 0 0 72px !important;
  }
}

/* Accessibility: focus ring for thumbnail buttons */
.thumb-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(124,58,237,0.12);
  border-radius: 12px;
}