:root {
  --bg-start: #f5f7fa;
  --bg-end: #c3cfe2;
  --accent: #0099ff;
}
body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
}

body.with-header {
  /* Ensure page content starts below the fixed header */
  padding-top: 120px;
}

.top-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
  padding: 0.5rem 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 1000;
}

.logo-title {
  display: flex;
  align-items: center;
}

.site-title {
  margin: 0 0 0 0.5rem;
}

.top-header img {
  height: 60px;
}

.logo-center {
  text-align: center;
  margin-top: 2rem;
}

.logo-center img {
  width: 200px;
  height: auto;
}

#controls-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}
#logout-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 4px;
  display: none;
}
#logout-btn:hover {
  background: #007acc;
}

.with-header #logout-btn {
  position: static;
  display: inline-block;
  margin-right: 40px;
}

#return-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 4px;
  margin-top: 1rem;
}
#return-btn:hover {
  background: #007acc;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.controls button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}
.controls button:hover {
  background: #007acc;
}
.controls input[type="text"],
.controls select {
  padding: 0.6rem;
  font-size: 1.05rem;
}

#file-upload {
  padding: 0.6rem;
  font-size: 1.1rem;
}
#photos {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
}

.photo-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.photo-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.photo-item img,
.photo-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-item.video-item::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 1.5rem 0 1.5rem 2.4rem;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.8);
  pointer-events: none;
}
#viewer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
#viewer-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
#viewer-content img,
#viewer-content video {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  z-index: 1;
  border-radius: 8px;
}
#viewer > button:not(#download-btn):not(#share-btn) {
  position: absolute;
  /* top: 50%; */
  transform: translateY(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 2rem;
  padding: 0.5rem;
  cursor: pointer;
  z-index: 2;
  border-radius: 50%;
}
#prev-btn { left: 0.5rem; }
#next-btn { right: 0.5rem; }
#close-btn {
  top: 1rem;
  right: 1rem;
  transform: none;
  margin-top: 20px;
}

#download-btn,
#share-btn {
  position: absolute;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  z-index: 2;
  border-radius: 4px;
  text-decoration: none;
  display: inline-block;
}

#download-btn {
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}

#share-btn {
  top: 2rem;
  left: 2rem;
}

#upload-progress {
  width: 100%;
  height: 1rem;
  display: none;
}

/* Responsive adjustments for small screens */
@media (max-width: 600px) {
  /* Hide the site title to save space next to the logo */
  .site-title {
    display: none;
  }

  /* Ensure page content starts below the fixed header */
  body.with-header {
    padding-top: 100px;
  }
}
