/* Layout styles */
body {
  font-family: "Roboto", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh; /* Ensures footer is at the bottom */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0); /* iOS Safari */
  -webkit-touch-callout: none; /* Disable callout, image save panel (iOS Safari) */
  user-select: none; /* Disable text selection */
  -ms-touch-action: manipulation; /* IE 10 */
  touch-action: manipulation; /* Non-prefixed version, currently supported by Chrome, Edge, and Firefox */
  color: var(--text-color);
}

header {
  width: 100%;
  background-color: var(--primary-color);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  box-shadow: 0 2px 4px var(--shadow-color);
  z-index: 1000;
  transition: transform 0.3s ease-in-out, height 0.3s ease-in-out,
    padding 0.3s ease-in-out;
}

header h1 {
  margin: 0;
  font-size: 2em;
  transition: font-size 0.3s ease-in-out;
}

.header-buttons {
  display: flex;
  align-items: center;
  align-items: baseline;
  transition: font-size 0.3s ease-in-out;
}

header a {
  color: white;
  font-size: 1.5em;
  margin-right: 20px;
  text-decoration: none;
  transition: font-size 0.3s ease-in-out;
}

header button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  transition: font-size 0.3s ease-in-out;
  display: flex;
}

header button img {
  width: 26px;
  height: 26px;
  transition: font-size 0.3s ease-in-out;
  margin-right: 0.1em;
}

header a img {
  width: 26px;
  height: 26px;
  transition: font-size 0.3s ease-in-out;
  margin-right: 0.1em;
}

footer {
  width: 100%;
  background-color: var(--primary-color);
  color: white;
  text-align: center;
  padding: 10px 0;
  margin-top: auto; /* Pushes footer to the bottom */
  opacity: 0; /* Start hidden */
  transition: opacity 1s; /* Fade-in effect */
}

footer a {
  color: white;
  text-decoration: none;
}

.load-more {
  padding: 10px 20px;
  margin: 20px 0;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s, opacity 1s; /* Fade-in effect for the button */
  opacity: 0; /* Start hidden */
  display: flex;
  align-items: center;
  justify-content: center;
}

.load-more.loading {
  background-color: #a0a0a0; /* 灰色 */
  cursor: not-allowed;
}

.load-more.loading::after {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  content: "";
  border: 2px solid #fff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  margin-left: 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Dark theme styles */
body.dark {
  background-color: #2d2d2d;
  color: #e0e0e0;
  --primary-color: #3d3d3d;
  --text-color: #e0e0e0;
  --bg-color: #121212;
  --shadow-color: rgba(0, 0, 0, 0.6);
}

body.dark header,
body.dark footer {
  background-color: #3d3d3d;
  border-bottom: 1px solid #4d4d4d;
}

body.dark .tag-filter {
  background-color: #3d3d3d;
}

body.dark .tag {
  background-color: #4d4d4d;
  color: #e0e0e0;
}

body.dark .modal {
  background-color: rgba(61, 61, 61, 0.9);
}

body.dark .modal-content {
  background-color: #4d4d4d;
}

body.dark #exif-info {
  color: #e0e0e0;
}

/* Loading animation */
#loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loading::after {
  content: "";
  border: 4px solid var(--primary-color);
  border-top: 4px solid transparent;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  will-change: transform; /* 优化动画性能 */
}

#loading.hidden {
  display: none;
}

@media (max-width: 600px) {
  header {
    height: 2.07em;
    padding: 10px 15px;
  }
  header h1 {
    font-size: 1.5em;
  }
  header a {
    font-size: 24px;
  }
  header button {
    margin-right: 30px;
  }
}

@media (min-width: 600px) and (max-width: 1200px) {
  header {
    height: 2.085em;
    padding: 15px 20px;
  }
  header h1 {
    font-size: 1.75em;
  }
  header a {
    font-size: 24px;
  }
  header button {
    margin-right: 40px;
  }
}

@media (min-width: 1200px) {
  header {
    height: 2.1em;
    padding: 20px 30px;
  }
  header h1 {
    font-size: 2em;
  }
  header a {
    font-size: 24px;
  }
  header button {
    margin-right: 50px;
  }
}

/* 浅色模式 */
:root {
  --primary-color: #4CAF50; /* 统一绿色主题色 */
  --background-color: #ffffff;
  --text-color: #333333;
  --header-bg: #f5f5f5;
  --button-bg: #4CAF50; /* 统一绿色 */
  --button-text: #ffffff;
  --tag-bg: #4CAF50; /* 统一绿色 */
  --tag-text: #ffffff;
  --modal-bg: rgba(255, 255, 255, 0.9);
  --modal-text: #333333;
}

/* 深色模式 */
.dark {
  --primary-color: #4CAF50; /* 保持绿色主题 */
  --background-color: #121212;
  --text-color: #e0e0e0;
  --header-bg: #1e1e1e;
  --button-bg: #4CAF50; /* 保持绿色 */
  --button-text: #ffffff;
  --tag-bg: #4CAF50; /* 保持绿色 */
  --tag-text: #ffffff;
  --modal-bg: rgba(18, 18, 18, 0.9);
  --modal-text: #e0e0e0;
}

/* 使用变量替换原有颜色值 */
header, footer, .load-more {
    background-color: var(--primary-color);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.gallery img {
    box-shadow: 0 4px 8px var(--shadow-color);
}

.tag-filter {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.08); /* 将透明度从0.05调整为0.08 */
    position: sticky;
    top: 0;
    z-index: 1;
}

/* 优化暗黑模式下垂直标签栏的背景 */
body.dark .tag-filter-vertical {
    background-color: rgba(255, 255, 255, 0.1); /* 使用半透明白色背景，降低突兀感 */
    /* 可根据需要调整内边距、圆角等其他样式 */
}

/* 加载指示器样式 */
#temp-loading-msg {
    text-align: center;
    margin: 20px 0;
    padding: 10px;
    color: #777;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 5px;
    animation: fadeInOut 1.5s infinite alternate;
}

@keyframes fadeInOut {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* 适配深色模式 */
body.dark #temp-loading-msg {
    color: #aaa;
    background-color: rgba(255, 255, 255, 0.05);
}

/* 通知系统样式 */
.notification-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  max-width: 300px;
}

.notification {
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.3s, transform 0.3s, top 0.3s;
  position: relative;
  word-wrap: break-word;
  max-width: 100%;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification.fade-out {
  opacity: 0;
  transform: translateY(-10px);
}

/* 带加载图标的通知 */
.notification.with-spinner {
  padding-left: 16px; /* 减小左侧内边距，与普通通知一致 */
}

.notification .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

/* 深色模式下的通知样式 */
body.dark .notification {
  background-color: #1e1e1e; /* 改为不透明背景 */
  color: #f0f0f0;
  border: 1px solid rgba(80, 80, 80, 0.5); /* 添加边框 */
}
