/* 全局变量：只改这一处，全局所有圆角同步生效 */
:root {
  /* 直角：设为 0
     如需换回圆角：改为 4px / 8px / 16px 任意数值即可 */
  --radius:2px;
  --primary:#e60023;
  --primary-hover:#c2001e;
  --bg:#fafafa;
  --text:#222;
  --text-light:#666;
  --shadow:0 10px 20px rgba(0,0,0,.15);
}

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: var(--bg);
  padding-top: 60px;
}

/* ========== 顶部固定导航栏 ========== */
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 1px 4px rgba(0,0,0,.08);
  z-index: 1000;
}

.logo {
  color: var(--primary);
  font-size: 22px;
  font-weight: bold;
  margin-left: 5px;
}

/* 顶部上传按钮 */
.upload-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s;
}

.upload-btn:hover {
  background: var(--primary-hover);
}

/* ========== 主体内容 ========== */
.main-container {
  padding: 10px 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: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  margin: 0 8px;
  font-size: 14px;
  transition: background .2s;
}

.btn:hover {
  background: var(--primary-hover);
}

/* 图库标题 */
.gallery-title {
  font-size: 18px;
  font-weight: 500;
  margin: 10px 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: transparent;
  display: inline-block;
  width: 100%;
  position: relative;
  cursor: default;
}

/* 图片独立容器 */
.img-wrap {
  position: relative;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform .25s ease,
    box-shadow .25s ease;
}
/* 仅图片区域 hover 放大+阴影 */
.img-wrap:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow);
}
.img-wrap img{
    width:100%;
    display:block;
    height:auto;
    object-fit:cover;
    border-radius:inherit;
}
/* 下层三点容器，单独一行 */
.btn-bottom-box{
    position:relative;
    padding:0 12px 8px;
    text-align:right;
    background:transparent;
}


/* 三点按钮基础样式 */
.more-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color .2s;
}

.more-btn:hover {
  color: var(--text);
}

/* 下拉菜单：固定在三点按钮正下方、紧贴对齐 */
.action-menu{
    position:absolute;
    top:100%;
    right:0;
    margin-top:6px;

    display:none;

    width:160px;

    background:#fff;

    border-radius:2px;

    overflow:hidden;

    box-shadow:0 6px 20px rgba(0,0,0,.12);

    z-index:100;
}

.action-menu.show{
    display:block;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px; /* 上下、左右内边距 */
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left; /* 强制按钮内文字左对齐 */
  transition:background .15s;
}
.menu-item:hover {
  background:#f2f2f2;
}


/* 上传弹窗单独样式 */
.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;
}

/* ========== 响应式适配 ========== */
@media (max-width: 1200px) {
  .waterfall {
    column-count: 4;
  }
}
@media (max-width: 900px) {
  .waterfall {
    column-count: 3;
  }
}
@media (max-width: 600px) {
  .waterfall {
    column-count: 2;
  }
}

/* 加载状态居中样式 */
#imgGrid {
  /* 加载时：启用弹性布局，内容靠顶部对齐 */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 80px;
  margin-top: 10px; /* 和上面gallery标题拉开一点距离 */
}

/* 存在图片卡片时，还原为原生瀑布流列布局 */
#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: var(--primary);
  transition: width .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;
}

/* 手机端统一适配 宽度≤480px */
@media (max-width: 480px) {
  /* ---------- 导航栏：logo 左对齐、上传按钮强制靠右 ---------- */
  header {
    padding: 0 16px;
  }
  .logo {
    font-size: 18px;
    flex-shrink: 1; /* logo 空间不足可缩小文字 */
  }
  .upload-btn {
    flex-shrink: 0; /* 关键：按钮禁止压缩，牢牢固定在最右侧 */
    padding: 6px 14px;
    font-size: 13px;
  }

  /* ---------- 上传弹窗移动端缩小适配（之前功能保留） ---------- */
  .upload-popover {
    width: 70vw;
    height: 48vh;
    right: 16px; /* 手机屏幕右侧留16px空隙，贴右上角 */
    left: auto;
    transform: none;
    top: 65px;
  }
  .upload-icon {
    width: 48px;
    height: 48px;
  }
  .pop-tip {
    font-size: 14px;
  }
  .popover-close {
    font-size: 20px;
    top: 8px;
    right: 10px;
  }
  .progress-text {
    font-size: 14px;
  }
}

/* 上传成功链接区域按钮样式 */
.copy-link-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 16px;
  cursor: pointer;
  border-radius: var(--radius);
}

.copy-link-btn:hover {
  background: var(--primary-hover);
}
.pop-link-area {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
