/* Photo Gallery Styles - Light Theme */

:root {
  --bg-color: #f5f5f5;
  --text-color: #333;
  --accent-color: #2563eb;
  --banner-bg: #fff;
  --card-bg: #fff;
  --border-color: #ddd;
  --hover-color: #f0f0f0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
}

/* Banner / Header */
.banner {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background: var(--banner-bg);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumbs {
  font-size: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.breadcrumbs a {
  color: var(--accent-color);
  text-decoration: none;
  transition: opacity 0.2s;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .current {
  color: var(--text-color);
  font-weight: 600;
}

.banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: #666;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.header-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.header-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.logout-btn {
  text-decoration: none;
  margin-left: 0.5rem;
}

.header-checkbox {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #666;
  cursor: pointer;
}

.header-checkbox input {
  cursor: pointer;
}

.admin-link {
  font-size: 1.3rem;
  color: #888;
  text-decoration: none;
  transition: color 0.2s;
}

.admin-link:hover {
  color: var(--accent-color);
}

/* Header dropdown */
.header-dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 200;
  min-width: 150px;
  margin-top: 4px;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu button {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-color);
}

.dropdown-menu button:hover {
  background: #f3f4f6;
}

/* Status Modal */
.status-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.status-modal-content {
  background: white;
  border-radius: 8px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.status-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.status-modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.status-modal-header button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.status-modal-body {
  padding: 1rem;
  overflow-y: auto;
  font-size: 0.85rem;
}

.status-summary {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.status-row {
  display: flex;
  gap: 1rem;
  padding: 0.25rem 0;
}

.status-row span:first-child {
  min-width: 100px;
}

.status-ok { color: #166534; }
.status-missing { color: #dc2626; }
.status-stale { color: #d97706; }

.status-details table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.status-details th,
.status-details td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.status-details th {
  background: #f3f4f6;
  font-weight: 500;
}

.status-details td small {
  color: #888;
}

.status-details td.status-ok { background: #d1fae5; }
.status-details td.status-missing { background: #fee2e2; }
.status-details td.status-stale { background: #fef3c7; }

/* Floating admin status */
.admin-status-float {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  font-size: 0.85rem;
  max-width: 300px;
}

.admin-status-float.running {
  border-color: #f59e0b;
  background: #fef3c7;
}

.admin-status-float.success {
  border-color: #22c55e;
  background: #d1fae5;
}

.admin-status-float.error {
  border-color: #ef4444;
  background: #fee2e2;
}

/* Main content */
main {
  padding: 1.5rem;
  max-width: 1800px;
  margin: 0 auto;
}

/* Processing banner button */
.processing-banner button {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.processing-banner button:hover {
  background: #1d4ed8;
}

/* Processing banner */
.processing-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.processing-banner.hidden {
  display: none;
}

.processing-status {
  color: #92400e;
}

.processing-status.complete {
  color: #166534;
}

/* Section Header */
.section-header {
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
}

/* Thumbnail Grid (Sub pages) */
.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 3px;
}

@media (min-width: 768px) {
  .thumbnail-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
  }
}

@media (min-width: 1200px) {
  .thumbnail-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.thumb-container {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f0f0f0;
  border-radius: 6px;
}

.thumb-container a {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.thumb-container a:hover {
  opacity: 0.9;
}

.thumb-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-container .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 0.75rem;
}

.thumb-container .video-placeholder {
  flex-direction: column;
  gap: 0.5rem;
}

.thumb-container .video-name {
  font-size: 0.65rem;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Caption overlay on thumbnail */
.thumb-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 0.7rem;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  display: none;
}

/* Show captions when toggled - higher specificity to override edit mode hiding */
.thumbnail-grid.show-captions .thumb-container .thumb-caption {
  display: block;
}

/* Video name captions - same behavior as photo captions */
.video-name-caption {
  font-size: 0.65rem;
  background: rgba(0,0,0,0.7);
}

.video-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.6);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.video-badge.large {
  position: static;
  transform: none;
  width: 48px;
  height: 48px;
  font-size: 20px;
  background: var(--accent-color);
}

/* Caption editing */
.caption-edit {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.caption-edit input {
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 0 0 6px 6px;
  background: rgba(255,255,255,0.95);
  color: #333;
  font-size: 0.75rem;
}

.caption-edit input:focus {
  outline: none;
  background: #fff;
}

/* Hide caption overlay when editing */
.thumb-container:has(.caption-edit[style*="block"]) .thumb-caption {
  display: none;
}

/* Group Grid */
.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .group-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.6rem;
  }
}

@media (min-width: 1200px) {
  .group-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

.group-item {
  display: block;
  text-decoration: none;
  color: var(--text-color);
  background: var(--card-bg);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.group-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.group-thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #e5e7eb;
}

.group-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.group-thumb.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.75rem;
}

.group-name {
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Custom Lightbox */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.97);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  padding-top: 50px;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-caption {
  color: white;
  text-align: center;
  padding: 10px;
  font-size: 0.95em;
  max-width: 100%;
  word-wrap: break-word;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  font-size: 1.8em;
  padding: 15px 12px;
  cursor: pointer;
  z-index: 1001;
  border-radius: 4px;
}

.lightbox-nav:hover {
  background: rgba(255,255,255,0.25);
}

.lightbox-nav:active {
  background: rgba(255,255,255,0.3);
}

.lightbox-nav.prev {
  left: 5px;
}

.lightbox-nav.next {
  right: 5px;
}

.lightbox-close {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  padding: 8px 12px;
  z-index: 1001;
  border-radius: 4px;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.25);
}

.lightbox-close:active {
  background: rgba(255,255,255,0.3);
}

.lightbox-footer {
  text-align: center;
  margin-top: 5px;
}

.lightbox-counter {
  color: rgba(255,255,255,0.7);
  font-size: 0.85em;
}

.lightbox-fullpic {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.85em;
}

.lightbox-fullpic:hover {
  color: #fff;
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Preface section */
.preface {
  max-width: 900px;
  margin: 0 auto 2rem auto;
  padding: 1.5rem 2rem;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  line-height: 1.6;
  color: #333;
}

.preface img {
  max-width: 100%;
  height: auto;
}

.preface table {
  margin: 0 auto;
}

.preface a {
  color: var(--accent-color);
}

.preface p {
  margin: 0.75rem 0;
}

@media (max-width: 768px) {
  .preface {
    margin: 0 1rem 1.5rem 1rem;
    padding: 1rem;
  }
}

/* Div text sections (from captions.yaml divs) */
.div-separator {
  max-width: 900px;
  margin: 2rem auto;
  border: none;
  border-top: 1px solid var(--border-color);
}

.div-text {
  max-width: 900px;
  margin: 0 auto 2rem auto;
  padding: 1rem 2rem;
  line-height: 1.7;
  color: #333;
}

.div-text img {
  max-width: 100%;
  height: auto;
}

.div-text table {
  margin: 0 auto;
}

.div-text a {
  color: var(--accent-color);
}

.div-text p {
  margin: 0.75rem 0;
}

.div-text iframe {
  max-width: 100%;
  margin: 1rem 0;
}

@media (max-width: 768px) {
  .div-text {
    margin: 0 1rem 1.5rem 1rem;
    padding: 1rem;
  }
}

/* Print styles */
@media print {
  .banner {
    position: static;
  }
  .sub-controls,
  .processing-banner {
    display: none;
  }
}
