/* 覆盖与补充样式，便于复刻历史卡片与背景 */

body, html {
  background-image: linear-gradient(var(--color-grid-line) 1px, transparent 0),
    linear-gradient(90deg, var(--color-grid-line) 1px, transparent 0);
  background-size: 32px 32px;
  background-color: var(--color-background);
}

.global-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--color-text-secondary);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--color-card-bg);
  border-top: 1px solid var(--color-border-light);
  box-shadow: 0 -2px 6px var(--color-shadow-sm);
}
.global-footer a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}
.global-footer a:hover {
  text-decoration: underline;
}

/* 用户管理 */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr auto auto;
  gap: 8px;
  align-items: center;
}
.user-row .tailwind-btn {
  height: 36px;
}
.tailwind-btn.danger-btn {
  background: var(--color-danger);
  color: #fff;
}
.tailwind-btn.danger-btn:hover {
  background: var(--color-danger-dark);
}

/* 进度条（上传中） */
.progress-bar {
  width: 240px;
  height: 8px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.progress-bar-inner {
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, #5f0, #55ff00a8, #5f0);
  border-radius: 999px;
  animation: progressPulse 1s linear infinite;
}
@keyframes progressPulse {
  0% { transform: translateX(-60%); }
  100% { transform: translateX(160%); }
}

.upload-content { cursor: pointer; }

.api-view,
.history-view {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  display: block;
  background: transparent;
  box-shadow: none;
  padding-bottom: 20px;
}

.api-container {
  background: var(--color-card-bg);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border: 1px solid var(--color-border);
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
}

.history-view .recent-images {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
}

#resultContainer.result-container,
.result-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  justify-items: center;
  align-items: start;
  padding: 10px 0 20px;
  position: relative;
  margin: 16px auto 10px;
  max-width: 1200px;
  cursor: default;
}

#totalImages.hide-badge,
#totalImages:empty {
  display: none !important;
}
#historyBtn #totalImages.hide-badge {
  background: none !important;
  color: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  padding: 14px 6px 30px;
  width: 100%;
  align-items: start;
  justify-items: center;
}

.history-card {
  background: var(--color-card-bg);
  border-radius: 8px;
  box-shadow: 0 3px 8px var(--color-shadow);
  overflow: hidden;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: 270px;
  min-height: 0;
  cursor: default;
  transition: all .2s ease, box-shadow var(--transition-speed) ease, border-color var(--transition-speed) ease;
  animation: slideInFromTop .5s ease forwards;
}
.history-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px var(--color-shadow-hover);
  border-color: var(--color-primary);
}

.history-card .thumb-wrap {
  position: relative;
  background: repeating-linear-gradient(0deg, #dcdcdc 0, #dcdcdc 1px, transparent 1px, transparent 24px),
    repeating-linear-gradient(90deg, #dcdcdc 0, #dcdcdc 1px, transparent 1px, transparent 24px);
  min-height: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
[data-theme=dark] .history-card .thumb-wrap {
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.08) 0, rgba(255,255,255,0.08) 1px, transparent 1px, transparent 24px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0, rgba(255,255,255,0.08) 1px, transparent 1px, transparent 24px);
}

.history-card img {
  max-width: 100%;
  max-height: 140px;
  object-fit: cover;
}

@keyframes slideInFromTop {
  0% { opacity: 0; transform: translateY(-20px) scale(.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.history-card .delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(231, 76, 60, 0.38);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(231, 76, 60, 0.2);
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.2s ease;
}

.history-card:hover .delete-btn { opacity: 1; transform: scale(1); }
.history-card .delete-btn:hover {
  background: rgba(231, 76, 60, 0.6);
  box-shadow: 0 10px 18px rgba(231, 76, 60, 0.25);
}
.history-card .delete-btn svg {
  width: 18px;
  height: 18px;
}

.history-card .body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.history-card .title-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-weight: 600;
  color: var(--color-text-primary);
  gap: 4px;
}

.history-card .title-row .id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.history-card .title-row .date {
  font-size: 12px;
  color: var(--color-text-secondary);
  width: 100%;
}

.history-card .link-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-card .link-input input {
  flex: 1;
  border: 1px solid var(--color-border-input);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
}
[data-theme=dark] .history-card .link-input input {
  background: var(--color-input-bg);
  border-color: var(--color-border-input);
  color: var(--color-text-primary);
}

.history-card .link-input button {
  border: none;
  background: var(--color-primary);
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.history-card .link-input button:hover { transform: translateY(-1px); }

.history-card .format-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.history-card .format-btn-small {
  flex: 1;
  min-width: 60px;
  text-align: center;
  border: 1px solid var(--color-border-input);
  border-radius: 10px;
  padding: 8px 10px;
  background: #f9fafb;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-card .format-btn-small:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 6px 12px rgba(52, 152, 219, 0.18);
}

.history-card .checkbox-abs {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  background: rgba(255,255,255,0.9);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  opacity: 0;
  transition: opacity 0.2s ease;
}
[data-theme=dark] .history-card .checkbox-abs {
  background: rgba(0,0,0,0.35);
}
.history-card:hover .checkbox-abs {
  opacity: 1;
}

.history-card.selected { box-shadow: 0 0 0 3px var(--color-primary); }

.history-card .checkbox-abs input[type=\"checkbox\"] {
  width: 18px;
  height: 18px;
}

.history-card .format-btn-small.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 6px 14px rgba(52,152,219,0.3);
}

.setting-title,
.setting-desc,
.history-card .setting-title,
.history-card .setting-desc {
  font-size: 14px;
  color: var(--color-text-primary);
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-input);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  background: #fff;
  color: var(--color-text-primary);
}
[data-theme=dark] .text-input {
  background: var(--color-input-bg);
  border-color: var(--color-border-input);
  color: var(--color-text-primary);
}

.full-input { width: 100%; }

.simple-input-row {
  padding: 6px 0;
}

.personal-setting-box {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}

.apply-brand-btn {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff !important;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(39, 174, 96, 0.3);
}
.apply-brand-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(39, 174, 96, 0.35);
}

/* 登录表单优化 */
.auth-form input {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--color-border-input);
  border-radius: 8px;
  font-size: 14px;
}

.auth-actions {
  display: flex;
  gap: 10px;
}

.hidden-auth { display: none !important; }

/* 上传区齿轮不触发上传 */
.card-corner-btn { z-index: 20; }
.nav-toggle-container #backBtn2 { display: none !important; }

/* 页脚简化 */
.site-footer { box-shadow: none; border-top: 1px solid var(--color-border-light); }
.site-footer, .site-footer * { background: transparent !important; }
.footer-content, .footer-copyright { background: transparent !important; }

/* 上传结果卡片适配 */
.result-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 20px;
  justify-items: center;
}
.upload-result-card .image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.upload-result-card {
  width: 100%;
  max-width: 270px;
  min-height: 0;
  border: 1px solid var(--color-border);
  box-shadow: 0 3px 8px var(--color-shadow);
  border-radius: 8px;
  background: var(--color-card-bg);
  padding: 0 10px 12px;
  margin: 0 auto;
  cursor: default;
  transition: all .2s ease, box-shadow var(--transition-speed) ease, border-color var(--transition-speed) ease;
  animation: slideInFromTop .5s ease forwards;
}
.upload-result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px var(--color-shadow-hover);
  border-color: var(--color-primary);
}

.result-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  justify-items: center;
  align-items: start;
  padding: 10px 0 20px;
  position: relative;
  margin: 16px auto 10px;
  max-width: 1200px;
}
.upload-result-card .image-container {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--color-border-light);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}
.upload-result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.upload-result-actions .link-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
}

.upload-result-actions .url-buttons {
  position: relative;
  display: flex;
  gap: 0;
  background: none;
  border-radius: 9999px;
  width: fit-content;
  margin: 0 auto;
  padding: 4px 6px;
}
.upload-result-actions .format-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 38px;
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .3px;
  color: #fff;
  position: relative;
  z-index: 2;
  transition: transform .2s ease, box-shadow .2s ease;
  background: transparent;
  border-radius: 9999px;
  border: none;
}
.upload-result-actions .format-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  pointer-events: none;
}
.upload-result-actions .format-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(52,152,219,0.15);
}
.upload-result-actions .format-btn.active {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(52,152,219,0.25);
}
.upload-result-actions .url-buttons .glass-glider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 25%;
  border-radius: 9999px;
  z-index: 1;
  transition: transform .5s cubic-bezier(.37,1.95,.66,.56),background .4s ease-in-out,box-shadow .4s ease-in-out;
  background: linear-gradient(135deg,#c0c0c055,#e0e0e0);
  box-shadow: 0 0 18px #c0c0c080,0 0 10px #fff6 inset;
}
.url-buttons.direct .glass-glider { transform: translate(0); background: linear-gradient(135deg,#5f0,#55ff008a); box-shadow: 0 0 18px #c0c0c080,0 0 10px #fff6 inset; }
.url-buttons.html .glass-glider { transform: translate(100%); background: linear-gradient(135deg,#ffd70055,#fc0); box-shadow: 0 0 18px #ffd70080,0 0 10px #ffeb9666 inset; }
.url-buttons.markdown .glass-glider { transform: translate(200%); background: linear-gradient(135deg,#84bffe55,#57b9ff); box-shadow: 0 0 18px #a0d8ff80,0 0 10px #c8f0ff66 inset; }
.url-buttons.bbcode .glass-glider { transform: translate(300%); background: linear-gradient(135deg,#ff7f5055,tomato); box-shadow: 0 0 18px #ff7f5080,0 0 10px #ffa07a66 inset; }
.upload-result-actions .link-input input { width: 100%; }

.upload-history-card .format-row { gap: 8px; }

.icon-format-row {
  position: relative;
  display: flex;
  gap: 6px;
  background: none;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  align-items: center;
}
.format-icon-btn {
  position: relative;
  z-index: 2;
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 12px 10px;
  cursor: pointer;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  transition: color 0.2s ease, transform 0.15s ease;
}
.format-icon-btn svg { width: 18px; height: 18px; }
.format-icon-btn .text-icon { font-weight: 700; font-size: 14px; }
.format-icon-btn.active { color: #fff; }
.format-indicator {
  position: absolute;
  left: 0;
  top: 4px;
  height: calc(100% - 8px);
  border-radius: 10px;
  z-index: 1;
  transition: transform 0.2s ease, width 0.2s ease, background 0.15s ease;
}
