/* --- Pinterest-style Masonry Gallery --- */
.gallery {
  column-count: 4;
  column-gap: 15px;
  padding: 10px;
}

.gallery-item {
  display: inline-block;
  width: 100%;
  margin-bottom: 15px;
  break-inside: avoid;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  transition: transform 0.2s ease-in-out;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.gallery-item img {
  width: 100%;
  height: auto;
  border-radius: 8px 8px 0 0;
  display: block;
}

/* Adjust for smaller screens */
@media (max-width: 1200px) {
  .gallery { column-count: 3; }
}

@media (max-width: 900px) {
  .gallery { column-count: 2; }
}

@media (max-width: 600px) {
  .gallery { column-count: 1; }
}

/* --- Gallery Tabs --- */
.gallery-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: .6rem 0;
}

.gallery-tab {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 20px;
  background-color: #518BA1;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.gallery-tab:hover {
  background-color: #66A9C2;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.gallery-tab:active {
  background-color: #3F7083;
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.gallery-toggle {
  text-align: left;
  margin: 10px 20px 15px 0;
}

.toggle-btn {
  background: #518BA1;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.toggle-btn:hover {
  background: #3e6f84;
  transform: scale(1.03);
}

/* --- Gallery Link Styles --- */
.links a,
.admin-links a,
.theDescEdit {
  color: #518BA1;
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition: all 0.2s ease-in-out;
  padding-bottom: 2px;
}

/* Subtle underline animation */
.links a::after,
.admin-links a::after,
.theDescEdit::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 2px;
  background-color: #518BA1;
  transition: width 0.25s ease-in-out;
}

.links a:hover::after,
.admin-links a:hover::after,
.theDescEdit:hover::after {
  width: 100%;
}

/* Hover color + lift */
.links a:hover,
.admin-links a:hover,
.theDescEdit:hover {
  color: #3F7083;
  transform: translateY(-1px);
}

/* Slightly different tone for admin actions */
.admin-links a {
  color: #A15151;
}

.admin-links a::after {
  background-color: #A15151;
}

.admin-links a:hover {
  color: #803E3E;
}

/* Edit link inline behavior */
.theDescEdit {
  font-style: italic;
  cursor: pointer;
}

.theDescEdit:hover {
  color: #3F7083;
}

/* --- Gallery Meta Layout --- */
.gallery-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
  color: #444;
  margin-top: 6px;
  padding: .1rem .3rem 0 0;
  border-top: 1px solid #eee;
}

.gallery-line a {
  display: inline-block;
  margin-right: 0.3em;
  white-space: normal;
  text-decoration: none;
  color: #337ab7;
}

/* Left side: user & action */
.gallery-info-left {
  color: #518BA1;
  font-style: normal;
  font-weight: 600;
}

.gallery-info-left a {
  display: inline;
}

/* Right side: timestamp */
.gallery-info-right {
  color: #777;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Small screens: stack vertically */
@media (max-width: 600px) {
  .gallery-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .gallery-info-right {
    align-self: flex-end;
  }
}

/* --- Image Tooltip --- */
.img-tooltip {
  position: absolute;
  width: 16em;
  background: #333;
  color: #fff;
  padding: 5px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 1000;
  pointer-events: none;
}

/* --- Image Detail Page --- */
.image-detail {
  max-width: 800px;
}

.image-detail-header h1 {
  margin-bottom: 0.25rem;
}

.image-detail-meta {
  color: #777;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.image-detail-meta a {
  color: #518BA1;
  font-weight: 600;
}

.image-detail-img {
  max-width: 300px;
}

.image-detail-img img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.image-detail-section {
  margin-top: 1.2rem;
}

.image-detail-section h3 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
  color: #518BA1;
}

.image-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.image-detail-tags .tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  background: #518BA1;
  color: #fff;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s;
}

.image-detail-tags .tag:hover {
  background: #3e6f84;
}

/* --- Upload Form --- */
#imgUploadDiv {
  max-width: 650px;
}
