/* 全局变量：只改这一处，全局所有圆角同步生效 */
:root {
  /* 直角：设为 0
     如需换回圆角：改为 4px / 8px / 16px 任意数值即可 */
  --radius: 0;
}

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background-color: #f5f5f5;
}

/* ========== 顶部固定导航栏 ========== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  position: relative;
}

.logo {
  color: #e60023;
  font-size: 22px;
  font-weight: bold;
  margin-left: 4px;
}

/* 顶部上传按钮 */
.upload-btn {
  background: #e60023;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.upload-btn:hover {
  background: #c2001e;
}

/* ========== 主体内容 ========== */
.main-container {
  padding: 20px 20px 20px;
  max-width: 1400px;
  margin: 0 auto;
}

#result {
  margin: 15px 0;
  text-align: left;
  word-break: break-all;
  background: #fff;
  padding: 15px;
  border-radius: var(--radius);
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  background: #e60023;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  margin: 0 8px;
  font-size: 14px;
  transition: background 0.2s;
}
.btn:hover {
  background: #c2001e;
}

/* 图库标题 */
.gallery-title {
  font-size: 18px;
  font-weight: 500;
  margin: 20px 0;
  text-align: left;
}

/* ========== 瀑布流核心样式 ========== */
.waterfall {
  column-count: 5;
  column-gap: 15px;
  min-height: 40px;
  overflow: visible;
  display: block;
  visibility: visible !important;
}

/* 外层卡片容器 */
.img-item {
  break-inside: avoid;
  margin-bottom: 15px;
  background: #fff;
  border-radius: var(--radius);
  display: inline-block;
  width: 100%;
  position: relative;
  cursor: default;
}

/* 图片独立容器 */
.img-wrap {
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
/* 仅图片区域 hover 放大+阴影 */
.img-wrap:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}
.img-wrap img {
  width: 100%;
  display: block;
}

/* 三点按钮独立容器 */
.btn-wrap {
  width: 100%;
  padding: 8px 12px;
  text-align: right;
}

/* 三点按钮基础样式 */
.more-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  color: #666;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
}
/* 三点按钮 hover 高亮效果 */
.more-btn:hover {
  background: #eee;
  color: #000;
}

/* 下拉菜单：固定在三点按钮正下方、紧贴对齐 */
.action-menu {
  position: absolute;
  top: 100%;
  right: 12px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-radius: var(--radius);
  display: none;
  z-index: 30;

  /* 新增/修改下面两行 */
  width: 140px;  /* 调大宽度，根据实际效果微调 130~150px 都行 */
  text-align: left; /* 内部文字左对齐 */
}
.action-menu.show {
  display: block;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px; /* 上下、左右内边距 */
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left; /* 强制按钮内文字左对齐 */
}
.menu-item:hover {
  background: #f5f5f5; /*  hover 背景，可选加 */
}

/* ========== 通用弹窗样式 ========== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: #fff;
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  position: relative;
}

/* 上传弹窗单独样式 */
.upload-content {
  padding: 60px 30px 30px;
  max-width: 600px;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
}

#drop-area {
  border: 2px dashed #e0e0e0;
  border-radius: var(--radius);
  padding: 60px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fff;
  text-align: center;
}
#drop-area:hover {
  border-color: #767676;
  background-color: #f9f9f9;
}

/* 上传预览图片样式 */
#result img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

/* 全局关闭按钮（大图预览弹窗，单独保留圆形，不跟随全局圆角） */
.close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  color: #000000;
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  line-height: 44px;
  cursor: pointer;
  z-index: 99999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  user-select: none;
  transition: background 0.2s, color 0.2s;
}
.close-btn:hover {
  background: #f1f1f1;
  color: #e60023;
}

/* ========== 响应式适配 ========== */
@media (max-width: 1200px) {
  .waterfall {
    column-count: 4;
  }
}
@media (max-width: 900px) {
  .waterfall {
    column-count: 3;
  }
}
@media (max-width: 600px) {
  .waterfall {
    column-count: 2;
  }
}

/* ========== 大图预览弹窗 专属样式 ========== */
.preview-content {
  max-width: 700px;
  width: 90%;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  margin-top: 60px;
}

.preview-img-wrapper {
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: auto;
}

.preview-img-wrapper #modalImg {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

/* 加载状态居中样式 */
#imgGrid {
  /* 加载时：启用弹性布局实现居中 */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

/* 存在图片卡片时，还原为原生瀑布流列布局 */
#imgGrid.has-img {
  display: block;
  min-height: auto;
}

/* 加载/空状态文字样式 */
.load-tip {
  font-size: 16px;
  color: #666;
}

/* ========== 新增：上传悬浮浮层样式 ========== */
.upload-popover {
  position: absolute;
  top: 65px;
  right: 20px;
  width: 420px;
  height: 420px;
  background: #f9f9f9;
  border: 2px dashed #ccc;
  border-radius: var(--radius);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  cursor: pointer;
}

.popover-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.popover-close:hover {
  color: #e60023;
}

/* 初始图标+文字区域 */
.pop-init {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.upload-icon {
  width: 60px;
  height: 60px;
}

.pop-tip {
  font-size: 16px;
  color: #666;
}

/* 进度条区域 */
.pop-progress {
  width: 80%;
  display: none;
}

.progress-bg {
  width: 100%;
  height: 12px;
  background: #e5e5e5;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #e60023;
  transition: width 0.1s linear;
}

.progress-text {
  text-align: center;
  margin-top: 10px;
  font-size: 16px;
  color: #333;
}

/* 上传预览区域 */
.pop-preview {
  display: none;
  width: 90%;
  height: 90%;
}

.pop-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}