* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease;
}

h1 {
    color: #1a202c;
    font-size: 2.5em;
    font-weight: 700;
    text-shadow: none;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #718096;
    font-size: 1.1em;
    font-weight: 400;
}

/* 控制面板 */
.controls {
    background: white;
    backdrop-filter: none;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    animation: fadeIn 0.6s ease 0.2s both;
}

.sort-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* 图片更新按钮 */
.item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.item:hover .item-actions {
    opacity: 1;
}

.update-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.95);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.update-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: scale(1.1);
}

.update-btn:active {
    transform: scale(0.95);
}

/* 确认对话框 */
.confirm-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.confirm-dialog.active {
    display: flex;
}

.confirm-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.confirm-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
}

.confirm-message {
    color: #718096;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.confirm-image-name {
    background: #f7fafc;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    color: #2d3748;
    margin-bottom: 24px;
    word-break: break-all;
}

.confirm-input-label {
    display: block;
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 500;
}

.confirm-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.confirm-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.confirm-input.error {
    border-color: #fc8181;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.confirm-hint {
    font-size: 12px;
    color: #a0aec0;
    margin-top: 6px;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.confirm-buttons button {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.confirm-btn-cancel {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.confirm-btn-cancel:hover {
    background: #edf2f7;
}

.confirm-btn-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.confirm-btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.confirm-btn-confirm:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.confirm-btn-confirm:not(:disabled):active {
    transform: translateY(0);
}

/* 状态提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

@keyframes slideInRight {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success {
    background: #d4edda;
    color: #155724;
}

.toast.error {
    background: #f8d7da;
    color: #721c24;
}

.toast.uploading {
    background: #fff3cd;
    color: #856404;
}

.sort-buttons button {
    padding: 10px 24px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.sort-buttons button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.02), transparent);
    transition: left 0.5s;
}

.sort-buttons button:hover::before { left: 100%; }
.sort-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-color: #cbd5e0;
    color: #2d3748;
}

.sort-buttons button.active {
    background: #2d3748;
    color: white;
    border-color: #2d3748;
    box-shadow: 0 2px 8px rgba(45, 55, 72, 0.2);
}

/* 图库网格 */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    animation: fadeInUp 0.6s ease both;
}

.item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: #cbd5e0;
}

.item-image-container {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 比例 */
    background: #f7fafc;
    overflow: hidden;
}

.item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* 改为contain，保持比例不裁剪 */
    transition: transform 0.5s ease;
}

.item:hover img {
    transform: scale(1.1);
}

/* 图片加载动画 */
.item img.loading { opacity: 0; }
.item img.loaded { animation: imageLoad 0.5s ease forwards; }

@keyframes imageLoad {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.caption {
    padding: 15px;
}

.caption-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.caption-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #718096;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-icon {
    width: 14px;
    height: 14px;
}

/* 弹窗 */
#lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

#lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#lightbox img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-info {
    margin-top: 20px;
    color: white;
    text-align: center;
    background: rgba(0,0,0,0.6);
    padding: 15px 30px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    max-width: 600px;
}

.lightbox-info-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.lightbox-info-meta {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.6;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    font-weight: 300;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1001;
}

.close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0;
    flex-wrap: wrap;
    animation: fadeIn 0.6s ease 0.4s both;
}

.pagination button {
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 12px;
    background: white;
    color: #667eea;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.pagination button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 加载指示器 */
.loading-indicator {
    text-align: center;
    padding: 40px;
    color: white;
    font-size: 18px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式 */
@media (max-width: 768px) {
    body { padding: 12px; }
    h1 { font-size: 1.8em; }
    .subtitle { font-size: 1em; }
    header { margin-bottom: 24px; }
    .controls { padding: 16px; margin-bottom: 20px; border-radius: 8px; }
    .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
    .sort-buttons { gap: 8px; }
    .sort-buttons button { padding: 8px 16px; font-size: 14px; border-radius: 6px; }
    .item { border-radius: 8px; }
    .caption { padding: 12px; }
    .caption-name { font-size: 13px; }
    .caption-meta { font-size: 11px; }
    .lightbox-content { width: 95%; }
    .lightbox-info { padding: 12px 16px; }
    .lightbox-info-name { font-size: 14px; }
    .lightbox-info-meta { font-size: 12px; }
    .close { top: 10px; right: 15px; font-size: 30px; width: 40px; height: 40px; }
    .pagination button { padding: 8px 12px; font-size: 13px; min-width: 36px; }
}

/* AI èŠå¤©çª—å£ */
#chatWidget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#chatButton {
  background: white;
  color: #2d3748;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

#chatButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border-color: #cbd5e0;
}

#chatWindow {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  min-height: 400px;       /* 👈 固定最小高度 */
  max-height: 500px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideUp 0.3s ease;
}

#chatStop {
  background: #f7fafc;
  color: #4a5568;
  border: 1.5px solid #e2e8f0;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
}
#chatStop:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
  color: #2d3748;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#chatStop:active {
  transform: translateY(0);
  background: linear-gradient(135deg, #edf2f7 0%, #edf2f7 100%);
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#chatWindow.hidden { display: none; }

#chatHeader {
  background: #f8f9fa;
  color: #1a202c;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
}

#chatClose {
  background: transparent;
  border: none;
  color: #718096;
  font-size: 20px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

#chatClose:hover {
  background: #edf2f7;
  color: #2d3748;
}

#chatMessages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
}

#chatMessages::-webkit-scrollbar {
  width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
  background: transparent;
}

#chatMessages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

.msg {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 75%;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
  animation: msgFadeIn 0.2s ease;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  background: #2d3748;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg.ai {
  background: #f7fafc;
  color: #2d3748;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid #e2e8f0;
}

#chatInputContainer {
  display: flex;
  border-top: 1px solid #e2e8f0;
  background: #f8f9fa;
  padding: 12px;
  gap: 8px;
}

#chatInput {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
  background: white;
  transition: all 0.2s ease;
  font-family: inherit;
}

#chatInput:focus {
  border-color: #cbd5e0;
  box-shadow: 0 0 0 3px rgba(203, 213, 224, 0.1);
}

#chatSend {
  background: #2d3748;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
}

#chatSend:hover {
  background: #1a202c;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#chatSend:active {
  transform: translateY(0);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


/* 为每个项目添加延迟动画 */
.item:nth-child(1) { animation-delay: 0.05s; }
.item:nth-child(2) { animation-delay: 0.1s; }
.item:nth-child(3) { animation-delay: 0.15s; }
.item:nth-child(4) { animation-delay: 0.2s; }
.item:nth-child(5) { animation-delay: 0.25s; }
.item:nth-child(6) { animation-delay: 0.3s; }


