@import url('../css/style.css');

body {
  overflow: auto;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.sidebar {
  width: 100%;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 12px 18px;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(64, 158, 255, 0.15);
  border: 1px solid rgba(64, 158, 255, 0.25);
  color: var(--accent-color);
  font-weight: 800;
}

.brand-text {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.category-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-title {
  display: none;
}

#category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  scrollbar-width: thin;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

#subcategory-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  scrollbar-width: thin;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

#subcategory-list.hidden {
  display: none;
}

#category-list li {
  flex: 0 0 auto;
  padding: 10px 14px;
  margin: 0;
  border-radius: 10px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  user-select: none;
  white-space: nowrap;
  cursor: pointer;
}

#category-list li.active {
  color: var(--text-primary);
  background: rgba(64, 158, 255, 0.12);
  border-color: rgba(64, 158, 255, 0.25);
}

#category-list li,
#subcategory-list li,
.image-card,
.image-card *,
.folder-card,
.folder-card * {
  cursor: pointer !important;
}

#subcategory-list li {
  flex: 0 0 auto;
  padding: 8px 12px;
  margin: 0;
  border-radius: 10px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  user-select: none;
  white-space: nowrap;
  cursor: pointer;
  font-size: 12px;
}

#subcategory-list li.active {
  color: var(--text-primary);
  background: rgba(64, 158, 255, 0.12);
  border-color: rgba(64, 158, 255, 0.25);
}

#category-list li[data-menu="__back__"] {
  display: none;
}

.sidebar-footer {
  margin-left: auto;
  padding: 0;
  border-top: none;
  flex: 0 0 auto;
}

.back-link {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 13px;
}

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

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.top-bar {
  display: flex;
  justify-content: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
  width: 100%;
}

.search-box {
  width: min(680px, 100%);
}

.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
}

.search-box input:focus {
  border-color: rgba(64, 158, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(64, 158, 255, 0.08);
}

.image-grid {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  gap: 14px;
  overflow: auto;
  width: min(1280px, 100%);
  justify-content: center;
}

.folder-card {
  position: relative;
  border-radius: 12px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.folder-card * {
  cursor: pointer;
}

.folder-card:hover {
  border-color: transparent;
}

.folder-bag {
  position: relative;
  height: 180px;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
}

.folder-bag::after {
  content: none;
}

.folder-bag::before {
  content: none;
}

.folder-thumbs {
  position: absolute;
  inset: 0;
}

.folder-thumbs:empty::before {
  content: '暂无图片';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.folder-thumb {
  position: absolute;
  width: 72%;
  height: 72%;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  filter: saturate(1.05) contrast(1.02);
}

.folder-thumb.t1 {
  left: 12%;
  top: 12%;
  transform: rotate(-4deg);
}

.folder-thumb.t2 {
  left: 18%;
  top: 16%;
  transform: rotate(2deg);
  opacity: 0.96;
}

.folder-thumb.t3 {
  left: 22%;
  top: 22%;
  transform: rotate(7deg);
  opacity: 0.92;
}

.folder-thumb.t4 {
  left: 14%;
  top: 26%;
  transform: rotate(-10deg);
  opacity: 0.86;
}

.folder-thumb.t5 {
  left: 30%;
  top: 18%;
  transform: rotate(12deg);
  opacity: 0.78;
}

.folder-thumb.t6 {
  left: 8%;
  top: 18%;
  transform: rotate(-14deg);
  opacity: 0.72;
}

.folder-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.folder-title {
  color: var(--text-primary);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-intro {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
}

@media (max-width: 720px) {
  .sidebar {
    padding: 10px 12px;
    gap: 12px;
  }

  .brand-text {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .image-grid {
    padding: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 200px));
  }

  .folder-bag {
    height: 150px;
  }
}

.image-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  user-select: none;
}

.image-card.has-link::before {
  content: none;
}

.image-card.has-link img,
.image-card.has-link .image-overlay {
  position: relative;
  z-index: 4;
}

.image-card.has-link {
  box-shadow: var(--shadow-card), 0 0 0 3px #1F3655 inset;
}

.image-card.has-link .card-title {
  color: #FFD54A;
}

.image-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.image-overlay {
  position: static;
  margin-top: 15px;
  padding: 0 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.card-title {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-intro {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
}

.loading-state {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-color);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  width: 95vw;
  height: 95vh;
  background: rgba(10, 10, 10, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: var(--shadow-float);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lightbox-close,
.lightbox-nav {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image-container {
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-nav:hover,
.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.55);
}

.lightbox-nav:active,
.lightbox-close:active {
  transform: scale(0.98);
}

.lightbox-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
}

.lightbox-controls {
  display: grid;
  grid-template-columns: 1fr minmax(0, 720px) 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

.lightbox-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  grid-column: 3;
  justify-self: end;
}

.lightbox-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.image-info {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  min-width: 0;
}

.image-info h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.image-info span {
  color: var(--text-secondary);
  font-size: 12px;
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.control-buttons {
  display: flex;
  gap: 8px;
}

.control-buttons button {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.control-buttons button:hover {
  background: rgba(255, 255, 255, 0.1);
}


/* =========================================
   全局禁止选中图标样式
   ========================================= */
svg, img, button svg, button img, a svg, a img, .icon, [class*="icon"] {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}
