* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f6f8;
  color: #222;
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
}

.pu-topnav {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  border-bottom: 1px solid #e2e6ec;
  background: #fff;
}

.pu-topnav-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.pu-site-brand {
  font-weight: 900;
  font-size: 16px;
  color: #2f6fed;
  text-decoration: none;
}

.pu-topnav-left a:not(.pu-site-brand) {
  color: #556;
  text-decoration: none;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pu-topnav-left a:not(.pu-site-brand):hover {
  color: #2f6fed;
}

.pu-ad {
  margin: 16px 0;
  text-align: center;
}

.pu-empty {
  padding: 60px 20px;
  text-align: center;
  color: #98a2b3;
  font-size: 14px;
  background: #fff;
  border: 1px dashed #dde3ea;
  border-radius: 10px;
}

.pu-copyright {
  text-align: center;
  padding: 20px 0 32px;
  font-size: 12px;
  color: #aaa;
}

#pageSizeInput {
  width: 68px;
  padding: 5px 6px;
  border: 1px solid #cdd4de;
  border-radius: 4px;
  font-size: 13px;
}

/* 페이지당 개수가 일괄처리 한도(500)를 넘으면 선택/일괄처리 UI를 숨긴다 */
.bulk-disabled .selection-bar {
  display: none;
}

.bulk-disabled .thumb-select {
  display: none;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.page-header .sub {
  margin: 0;
  color: #666;
  font-size: 13px;
}

.lib-warning {
  margin: 16px 0;
  padding: 12px 16px;
  background: #fdecea;
  border: 1px solid #f5c2c0;
  color: #9c2b26;
  border-radius: 6px;
  font-size: 14px;
}

.drop-zone {
  margin: 20px 0;
  padding: 40px 20px;
  border: 2px dashed #b8c0cc;
  border-radius: 10px;
  background: #fff;
  text-align: center;
  color: #667;
  transition: background 0.15s, border-color 0.15s;
}

.drop-zone.drag-over {
  background: #eef5ff;
  border-color: #4d8fea;
}

.drop-zone p {
  margin: 0 0 12px;
  font-size: 14px;
}

.file-btn {
  display: inline-block;
  padding: 8px 18px;
  background: #2f6fed;
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.file-btn:hover {
  background: #2559c0;
}

.summary {
  margin: 4px 0 20px;
  padding: 10px 14px;
  background: #eef5ff;
  border-radius: 6px;
  font-size: 13px;
  color: #1f4fa3;
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.gallery-head h2 {
  margin: 0;
  font-size: 16px;
}

#photoCount {
  color: #888;
  font-size: 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.tool-btn {
  display: inline-block;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid #cdd4de;
  border-radius: 6px;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.tool-btn:hover {
  background: #f0f3f7;
  border-color: #aab4c2;
}

.tool-btn:disabled {
  color: #b2b8c2;
  cursor: not-allowed;
  background: #f5f6f8;
}

.tool-btn:disabled:hover {
  background: #f5f6f8;
  border-color: #cdd4de;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e2e6ec;
  border-radius: 8px;
}

.filter-fields {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
}

.filter-field input[type="date"],
.filter-field select {
  padding: 5px 6px;
  border: 1px solid #cdd4de;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pager-info {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #e2e6ec;
  border-radius: 8px;
}

.select-all-page {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
}

.selection-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.selection-info {
  font-size: 13px;
  color: #2f6fed;
  font-weight: 600;
  white-space: nowrap;
}

.tag-input {
  padding: 6px 8px;
  border: 1px solid #cdd4de;
  border-radius: 4px;
  font-size: 13px;
  min-width: 200px;
}

.tool-btn-danger {
  color: #b3261e;
  border-color: #f0c4c0;
}

.tool-btn-danger:hover {
  background: #fdecea;
  border-color: #e39a94;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.thumb {
  position: relative;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.thumb img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: #eee;
  cursor: zoom-in;
}

.thumb-meta {
  padding: 8px 10px;
}

.thumb-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-sub {
  margin-top: 2px;
  font-size: 11px;
  color: #888;
}

.thumb-select {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  cursor: pointer;
}

.thumb-select input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.thumb-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.tag-chip {
  padding: 2px 8px;
  background: #eef2f7;
  color: #445;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
}

.tag-edit-btn {
  padding: 2px 6px;
  border: 1px dashed #cdd4de;
  border-radius: 10px;
  background: none;
  color: #888;
  font-size: 11px;
  cursor: pointer;
}

.tag-edit-btn:hover {
  background: #f0f3f7;
  color: #2f6fed;
}

.thumb-tags .tag-input {
  width: 100%;
  min-width: 0;
  font-size: 12px;
  padding: 4px 6px;
}

.thumb-download {
  display: block;
  margin-top: 8px;
  padding: 5px 0;
  border-radius: 4px;
  background: #eef2f7;
  color: #2f6fed;
  font-size: 12px;
  text-align: center;
  text-decoration: none;
}

.thumb-download:hover {
  background: #dde6f2;
}

.thumb-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.thumb-del:hover {
  background: rgba(200, 40, 40, 0.85);
}

.page-footer {
  margin-top: 40px;
  font-size: 12px;
  color: #999;
}

.version-tag {
  margin-top: 10px;
  color: #bbb;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(0, 0, 0, 0.85);
}

.lightbox.open {
  display: flex;
}

.lightbox-content {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.lightbox-info {
  max-width: 640px;
  color: #fff;
  text-align: center;
}

.lightbox-name {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.lightbox-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #ccc;
}

.lightbox-tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.lightbox-tags .tag-chip {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
}

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

.lightbox-close {
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 26px;
}

.lightbox-nav:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

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

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}
