/* 响应式设计 */
/* 桌面端布局优化 */
@media (min-width: 769px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* 宽屏幕时优化布局 */
  .main-content {
    max-width: 1800px;
    margin: 0 auto;
  }
  
  /* 控制区域左侧固定 */
  .controls-sidebar {
    border-right: 1px solid rgba(0, 0, 0, 0.05);
  }
  
  /* 搜索框和随机按钮样式优化 */
  .search-random-container {
    margin-bottom: 10px;
  }
  
  #search {
    width: 100%;
    transition: all 0.3s ease;
  }
  
  #search:focus {
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.4);
  }
  
  #random {
    width: 100%;
    margin-top: 10px;
  }
  
  /* 位置选择器样式优化 */
  .location-selectors {
    margin-top: 15px;
  }
  
  #affiliation, #province, #city, #district {
    width: 100%;
    margin-bottom: 15px;
  }
}

/* 超宽屏幕优化 */
@media (min-width: 1600px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .main-content {
    max-width: 2000px;
  }
}

/* 分页控件样式优化 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}

/* 桌面端分页控件 */
.pagination-desktop {
  display: none;
}

/* 移动端分页控件 */
.pagination-mobile {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 15px 0;
  padding: 10px;
  bottom: 0;
  z-index: 100;
}

.pagination-mobile button {
  background-color: #2751a0;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  min-width: 60px;
}

.pagination-mobile button:hover {
  background-color: #ff4d3d;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pagination-mobile button:disabled {
  background-color: var(--disabled-color);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pagination-mobile .page-info {
  font-size: 14px;
  color: var(--text-color);
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .pagination {
    gap: 10px;
    margin: 20px 0;
  }
  
  .pagination button {
    padding: 8px 15px;
    font-size: 14px;
  }
  
  .page-info {
    font-size: 14px;
  }
}

/* 桌面端布局 */
@media (min-width: 769px) {
  /* 显示桌面端分页控件 */
  .pagination-desktop {
    display: flex;
    margin-top: 2px;
    margin-bottom: 2px;
  }
  
  /* 隐藏移动端分页控件 */
  .pagination-mobile {
    display: none;
  }
}

/* 移动端布局 */
@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
  .controls {
    flex-direction: column;
    gap: 8px; /* 减小间距 */
    margin-left: 20px;
    margin-right: 20px;
    justify-content: center;
    animation: fadeIn 0.5s ease;
    padding: 12px; /* 进一步减小内边距 */
  }
  .search-random-container {
    display: flex;
    gap: 8px;
    width: 100%;
  }
  #search {
    flex: 1;
    font-size: 14px;
    padding: 8px 10px; /* 减小内边距 */
  }
  #random {
    width: 90px; /* 减小宽度 */
    font-size: 14px;
    padding: 8px 10px; /* 减小内边距 */
  }
  
  /* 优化位置选择器布局 - 使用弹性布局让多个选择器在一行显示 */
  .location-selectors {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px; /* 减小间距 */
    justify-content: space-between;
  }
  
  /* 创建两行布局，第一行放所属，第二行放省市县 */
  .location-selectors > * {
    margin-bottom: 6px;
  }
  
  /* 创建省市县容器，强制它们在同一行 */
  .location-selectors::after {
    content: "";
    display: block;
    width: 100%;
    order: 1;
  }
  
  /* 设置所属和图标在第一行 */
  #affiliation-logo-container,
  .select-with-icon {
    order: 0;
    width: 100%;
  }
  
  /* 设置省市县容器在第二行 */
  .province-city-district-container {
    order: 2;
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  
  /* 第一行：图标容器和所属下拉框 */
  #affiliation-logo-container {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    margin-bottom: 0;
    width: auto;
    flex: 0 0 auto;
  }
  
  #affiliation-logo {
    height: 30px; /* 减小图标大小 */
    max-width: 35px;
  }
  
  /* 所属下拉框样式 */
  .select-with-icon {
    width: auto;
    flex: 1; /* 让所属下拉框占据剩余空间 */
    min-width: auto;
    display: inline-flex;
    margin-top: 15px;
    max-width: 66%; /* 限制最大宽度，避免占据过多空间 */
  }
  
  /* 移动端下调整affiliation下拉框宽度 */
  #affiliation {
    width: 100%; /* 在容器内占满宽度 */
    min-width: auto; /* 覆盖默认的最小宽度 */
    max-width: 100%; /* 确保不超出容器 */
  }
  
  /* 省市县三个强制在同一行 */
  .province-city-district-container #province,
  .province-city-district-container #city,
  .province-city-district-container #district {
    width: calc(33.33% - 4px); /* 三个元素一行 */
    min-width: auto;
    flex: 1;
  }
  
  /* 所有下拉框共同样式 */
  #affiliation, #province, #city, #district {
    font-size: 13px;
    padding: 6px 25px 6px 8px; /* 大幅减小内边距 */
    margin: 0;
    height: 32px; /* 固定高度 */
  }
  
  /* 为带图标的下拉框调整内边距 */
  .select-with-icon select {
    padding-left: 30px !important;
  }
  
  /* 调整图标大小和位置 */
  .select-icon {
    left: 6px;
    width: 16px;
    height: 16px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
  }
  
  /* 超小屏幕控制区域优化 */
  .controls {
    padding: 10px;
    margin-left: 8px;
    margin-right: 8px;
    gap: 6px; /* 进一步减小间距 */
  }
  
  /* 搜索和随机按钮改为一行 */
  .search-random-container {
    flex-direction: row;
    gap: 4px;
    align-items: center;
  }
  
  #search {
    width: auto;
    flex: 1;
    font-size: 12px;
    padding: 6px 8px;
    height: 30px; /* 固定高度 */
  }
  
  #random {
    width: 70px; /* 进一步减小宽度 */
    font-size: 12px;
    padding: 6px 8px;
    height: 30px; /* 固定高度 */
  }
  
  /* 位置选择器 - 保持两列布局 */
  .location-selectors {
    gap: 4px;
  }
  
  /* 调整图标容器 */
  #affiliation-logo-container {
    margin-right: 2px;
  }
  
  #affiliation-logo {
    height: 24px;
    max-width: 28px;
  }
  
  /* 小屏幕下图标容器和所属下拉框在同一行 */
  .select-with-icon {
    flex: 1;
    margin-bottom: 0;
    display: inline-flex;
  }
  
  #affiliation-logo-container {
    flex: 0 0 auto;
    margin-right: 2px;
  }
  
  /* 确保第一行和第二行之间有间距 */
  .location-selectors > * {
    margin-bottom: 4px;
  }
  
  /* 省市县容器样式 */
  .province-city-district-container {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 0;
  }
  
  /* 省市县三个放在一行 */
  .province-city-district-container #province,
  .province-city-district-container #city,
  .province-city-district-container #district {
    width: calc(33.33% - 2px);
    margin-bottom: 0;
    flex: 1;
  }
  
  /* 所有下拉框共同样式 */
  #affiliation, #province, #city, #district {
    font-size: 12px;
    padding: 4px 20px 4px 6px; /* 极小内边距 */
    height: 28px; /* 更小的高度 */
  }
  
  /* 为带图标的下拉框调整内边距 */
  .select-with-icon select {
    padding-left: 24px !important;
  }
  
  /* 调整图标大小和位置 */
  .select-icon {
    left: 4px;
    width: 14px;
    height: 14px;
  }
  
  /* 调整标题大小 */
  header .header-content h1 {
    font-size: 2.0rem;
  }
  
  /* 调整打字机效果文字大小 */
  #typing-text {
    font-size: 1.0rem;
  }
}