/* Custom styles for Nano Banana Image Generator */

/* Navigation Styles - 任务1: 深度优化导航栏UI样式 */

/* 顶部导航栏整体容器 */
header {
  @apply bg-white border-b border-gray-200;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(8px);
}

/* Logo和标题区域 */
header .flex.items-center > div {
  @apply flex items-center space-x-3;
}

header h1 {
  @apply text-xl font-bold text-gray-900 tracking-tight;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

header p {
  @apply text-xs text-gray-500 font-medium;
}

/* Logo图标优化 */
header .fas.fa-paint-brush {
  @apply text-2xl;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 主导航项样式 */
.nav-item {
  @apply relative px-4 py-2 rounded-lg text-sm font-medium transition-all duration-300 flex items-center;
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
  min-width: fit-content;
}

.nav-item i {
  @apply mr-2 text-base;
  transition: transform 0.3s ease;
}

.nav-item:hover {
  @apply text-primary bg-gradient-to-r from-blue-50 to-indigo-50 border-blue-200;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.nav-item:hover i {
  transform: scale(1.1) rotate(5deg);
}

.nav-item.active {
  @apply text-white;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border: 1px solid #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.nav-item.active i {
  @apply text-white;
}

/* 导航栏布局优化 */
header nav {
  @apply flex items-center;
  gap: 1rem;
  flex-wrap: nowrap;
}

/* 右侧状态区域美化 */
header nav .text-sm.text-gray-600 {
  @apply bg-gradient-to-r from-yellow-50 to-amber-50 text-amber-700 px-4 py-2 rounded-full border border-amber-200 font-medium;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
}

header nav .text-sm.text-gray-600 i {
  @apply mr-2 text-amber-500;
  animation: pulse 2s infinite;
}

/* 用户头像美化 */
header nav .w-8.h-8 {
  @apply transition-all duration-300 border-2 border-transparent;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

header nav .w-8.h-8:hover {
  transform: scale(1.15) rotate(3deg);
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* 子导航样式优化 */
.sub-nav-item {
  @apply px-6 py-3 text-sm font-medium rounded-lg transition-all duration-300;
  color: #64748b;
  background: transparent;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.sub-nav-item::before {
  content: '';
  @apply absolute inset-0 bg-gradient-to-r from-blue-500 to-indigo-500 opacity-0 transition-opacity duration-300;
}

.sub-nav-item:hover {
  @apply text-primary;
  transform: translateY(-2px);
}

.sub-nav-item:hover::before {
  opacity: 0.1;
}

.sub-nav-item.active {
  @apply text-primary bg-white font-semibold;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* 子导航容器优化 */
nav .flex.space-x-1 {
  @apply bg-gradient-to-r from-gray-50 to-slate-50 p-1 rounded-xl border border-gray-200;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 动画效果 */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* 响应式优化 */
@media (max-width: 1200px) {
  .nav-item {
    @apply px-3 text-xs;
  }
  
  .nav-item span {
    @apply hidden lg:inline;
  }
}

@media (max-width: 768px) {
  header .max-w-7xl {
    @apply px-3;
  }
  
  header .flex.items-center.justify-between {
    @apply flex-col space-y-3 h-auto py-4;
  }
  
  header nav {
    @apply flex-wrap justify-center gap-2;
  }
  
  .nav-item {
    @apply px-2 py-1 text-xs;
  }
}

/* Section and Module Management */
.section {
  @apply hidden;
}

.section.active {
  @apply block;
}

.module {
  @apply hidden;
}

.module.active {
  @apply block;
}

/* Upload Area Styles - 任务5: 优化上传组件UI美观性 */
.upload-area {
  @apply relative overflow-hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.upload-area:hover {
  @apply border-primary shadow-lg;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  transform: translateY(-2px);
}

.upload-area.dragover {
  @apply border-primary bg-gradient-to-br from-blue-50 to-blue-100 shadow-xl;
  animation: pulse-border 1.5s infinite;
}

/* 上传图标动画效果 */
.upload-area:hover .fas.fa-cloud-upload-alt {
  animation: float 2s ease-in-out infinite;
  @apply text-primary;
}

/* 上传按钮美化 */
#image-upload,
#reference-upload,
#extend-upload {
  @apply relative overflow-hidden;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#image-upload:hover,
#reference-upload:hover,
#extend-upload:hover {
  @apply shadow-md border-primary;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
  transform: translateY(-1px);
}

#image-upload:focus,
#reference-upload:focus,
#extend-upload:focus {
  @apply ring-2 ring-primary ring-opacity-50 border-primary outline-none;
}

/* 清空按钮美化 */
.clear-all-btn,
.clear-reference-btn {
  @apply relative overflow-hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
}

.clear-all-btn:hover,
.clear-reference-btn:hover {
  @apply shadow-lg;
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  transform: translateY(-2px) scale(1.02);
}

.clear-all-btn:active,
.clear-reference-btn:active {
  transform: translateY(0) scale(1);
}

/* 上传区域脉冲动画 */
@keyframes pulse-border {
  0%, 100% {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  50% {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
  }
}

/* 图标浮动动画 */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* 上传成功提示动画 */
@keyframes upload-success {
  0% {
    transform: scale(1);
    background-color: #eff6ff;
  }
  50% {
    transform: scale(1.05);
    background-color: #dbeafe;
  }
  100% {
    transform: scale(1);
    background-color: #eff6ff;
  }
}

.upload-area.success {
  animation: upload-success 0.6s ease-out;
}

/* 上传进度条样式 */
.upload-progress {
  @apply absolute bottom-0 left-0 h-1 bg-primary transition-all duration-300;
  transform-origin: left;
}

/* 拖拽提示 */
.upload-area::before {
  content: "";
  @apply absolute inset-0 bg-gradient-to-br from-primary/5 to-blue-500/10 opacity-0 transition-opacity duration-300;
}

.upload-area.dragover::before {
  @apply opacity-100;
}

/* 文件类型提示美化 */
.upload-area p {
  transition: all 0.3s ease;
}

.upload-area:hover p {
  @apply text-gray-700;
}

.upload-area.dragover p {
  @apply text-primary font-medium;
}

/* 上传区域内的图标增强 */
.upload-area .fas {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-area.dragover .fas {
  @apply text-primary;
  transform: scale(1.1);
}

/* Image Grid Styles */
/* 任务3: 图片16:9比例显示 - 重新实现 */
.image-item {
  @apply relative bg-gray-100 rounded-lg overflow-hidden border border-gray-200 cursor-pointer;
  /* 强制16:9宽高比 */
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
}

/* 所有图片容器都使用16:9比例 */
.image-item img {
  @apply w-full h-full;
  object-fit: contain !important; /* 强制不裁剪 */
  background-color: #f8fafc; /* 填充背景 */
}

/* 确保主上传区域的16:9比例 */
#image-grid .image-item {
  width: 100%;
  aspect-ratio: 16/9 !important;
}

/* 点击预览提示 */
.image-item:hover::after {
  content: "🔍 点击预览";
  @apply absolute top-2 right-2 bg-black bg-opacity-60 text-white text-xs px-2 py-1 rounded pointer-events-none;
  animation: fadeIn 0.3s ease;
}

/* 缩略图区域16:9比例 */
/* 缩略图16:9比例 */
.thumbnail-16-9 {
  width: 64px !important;
  height: 36px !important; /* 64 * 9/16 = 36 */
  aspect-ratio: 16/9 !important;
}

.thumbnail-16-9 img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  background-color: #f8fafc !important;
}

/* 历史图片16:9比例 */
.history-image-16-9 {
  width: 160px !important;
  height: 90px !important; /* 160 * 9/16 = 90 */
  aspect-ratio: 16/9 !important;
}

.history-image-16-9 img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  background-color: #f8fafc !important;
}

.image-item img {
  @apply w-full h-full object-cover;
}

/* 历史图片固定尺寸 160x90px (16:9比例) */
.history-scroll .image-item {
  @apply flex-shrink-0;
  width: 160px;
  height: 90px;
  aspect-ratio: 16/9;
}

/* 确保所有历史图片容器使用固定尺寸 */
.history-scroll .flex > div {
  @apply flex-shrink-0;
}

.history-scroll img {
  @apply w-full h-full object-cover;
}

.image-item img {
  @apply w-full h-full object-cover;
}

/* 任务2: 增强图片拖拽排序动画效果 */
/* 拖拽状态样式 - 更自然流畅的动画 */
.image-item {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
}

/* 被选中拖拽的元素 */
.sortable-chosen {
  @apply ring-4 ring-blue-400 ring-opacity-50 shadow-2xl;
  transform: rotate(3deg) scale(1.05);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1000;
  opacity: 0.95;
}

/* 拖拽中的幽灵元素 */
.sortable-ghost {
  @apply bg-blue-50 border-2 border-dashed border-blue-400 opacity-60;
  transform: scale(0.95);
  transition: all 0.3s ease;
  animation: ghost-pulse 1.5s ease-in-out infinite;
}

.sortable-ghost img {
  opacity: 0.3;
}

/* 正在拖拽的元素样式 */
.sortable-drag {
  @apply shadow-2xl;
  transform: scale(1.08); /* 移除旋转，只保留缩放 */
  transition: transform 0.1s ease; /* 加快过渡速度 */
  z-index: 1001;
  opacity: 0.9;
}

/* 拖拽开始时的类 */
.image-item.dragging {
  @apply z-50;
  animation: drag-start 0.3s ease-out;
}

/* 拖拽动画关键帧 */
@keyframes drag-start {
  0% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  50% {
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }
  100% {
    transform: scale(1.05) rotate(3deg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  }
}

/* 幽灵元素脉冲动画 */
@keyframes ghost-pulse {
  0%, 100% {
    background-color: rgb(239 246 255);
    border-color: rgb(96 165 250);
    transform: scale(0.95);
  }
  50% {
    background-color: rgb(219 234 254);
    border-color: rgb(59 130 246);
    transform: scale(0.98);
  }
}

/* 拖拽完成后的回弹效果 */
@keyframes bounce-back {
  0% {
    transform: scale(1.05) rotate(3deg);
  }
  30% {
    transform: scale(1.1) rotate(-1deg);
  }
  60% {
    transform: scale(0.98) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.image-item.bounce {
  animation: bounce-back 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 其他图片的避让效果 */
.image-item:not(.sortable-chosen):not(.sortable-ghost):not(.dragging) {
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.image-item:hover:not(.sortable-chosen):not(.dragging) {
  transform: translateY(-2px) scale(1.02);
  @apply shadow-lg;
}

/* 拖拽区域的视觉反馈 */
#image-grid.drag-over {
  @apply bg-blue-50 border-blue-300;
  animation: grid-highlight 0.5s ease-in-out;
}

@keyframes grid-highlight {
  0%, 100% {
    background-color: rgb(248 250 252);
  }
  50% {
    background-color: rgb(239 246 255);
  }
}

/* 磁性吸附效果 */
.image-item.magnetic-target {
  @apply ring-2 ring-green-400 ring-opacity-70;
  transform: scale(1.02);
  transition: all 0.2s ease;
}

/* 拖拽时的磁力线效果 */
.sortable-chosen::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    rgba(59, 130, 246, 0.3) 0%, 
    rgba(139, 92, 246, 0.3) 50%, 
    rgba(59, 130, 246, 0.3) 100%);
  border-radius: 0.5rem;
  z-index: -1;
  animation: magnetic-field 2s ease-in-out infinite;
}

@keyframes magnetic-field {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.02);
  }
}

.image-item .image-overlay {
  @apply absolute inset-0 bg-black bg-opacity-50 flex items-end justify-center opacity-0 hover:opacity-100 transition-opacity p-2;
}

.image-item .image-actions {
  @apply flex space-x-1;
}

.image-item .image-actions button {
  @apply bg-white text-gray-700 text-xs px-2 py-1 rounded hover:bg-gray-100 transition-colors;
}

.image-item .image-controls {
  @apply absolute top-2 left-2 right-2 flex justify-between;
}

.image-item .image-controls button {
  @apply w-6 h-6 bg-white bg-opacity-80 hover:bg-opacity-100 rounded flex items-center justify-center text-xs transition-all;
}

.image-item .image-number {
  @apply absolute bottom-2 left-2 bg-blue-500 text-white text-xs px-1 py-0.5 rounded-full leading-tight;
}

.image-item .dimension-selector {
  @apply absolute bottom-2 right-2;
}

.image-item .dimension-selector select {
  @apply text-xs bg-white bg-opacity-90 hover:bg-opacity-100 border border-gray-300 rounded px-1 py-0.5 leading-tight;
}

/* 16:9比例下的控件优化布局 */
.image-item {
  @apply relative;
}

/* 确保底部控件不重叠，在16:9比例下合理分布 */
.image-item .bottom-controls {
  @apply absolute bottom-1 left-1 right-1 flex items-center justify-between;
  height: auto;
  min-height: 20px;
}

.image-item .bottom-left {
  @apply flex items-center space-x-1;
}

.image-item .bottom-right {
  @apply flex items-center;
}

/* Sortable styles - 自然流畅的拖拽动画 */
.sortable-ghost {
  @apply opacity-30 bg-gray-100 border-2 border-dashed border-primary;
  transition: all 0.2s ease;
}

.sortable-chosen {
  @apply ring-2 ring-primary ring-opacity-75 shadow-lg;
  transition: all 0.15s ease;
  transform: rotate(2deg) scale(1.02);
}

.sortable-drag {
  @apply shadow-xl;
  transition: all 0.2s ease;
  transform: rotate(3deg) scale(1.05);
}

/* 图片项的基础过渡效果 */
.image-item {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 拖拽开始时的效果 */
.sortable-drag .image-item {
  @apply shadow-2xl;
  transform: scale(1.05);
}

/* 拖拽目标位置的指示 */
.sortable-ghost .image-item {
  @apply bg-blue-50 border-blue-300;
  transform: scale(0.95);
}

/* 拖拽完成后的回弹效果 */
.image-item:not(.sortable-chosen):not(.sortable-ghost):not(.sortable-drag) {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 拖拽中的元素样式 */
.image-item.dragging {
  @apply z-50;
  transform: scale(1.05) rotate(2deg);
  transition: transform 0.15s ease;
}

/* 弹性动画 */
@keyframes bounce-in {
  0% { transform: scale(1.05); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1.0); }
}

/* 拖拽时其他元素的让位效果 */
.image-item:not(.sortable-chosen):not(.dragging) {
  transition: all 0.2s ease;
}

/* 缩略图的拖拽效果 */
.sortable-drag.flex-shrink-0 {
  transform: scale(1.1);
  @apply shadow-lg z-40;
}

/* History scroll */
.history-scroll {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.history-scroll::-webkit-scrollbar {
  height: 6px;
}

.history-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.history-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.history-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modal Styles */
.modal {
  @apply fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50;
}

.modal-content {
  @apply bg-white rounded-lg max-w-6xl max-h-[90vh] w-[90vw] overflow-hidden;
}

.modal-header {
  @apply flex items-center justify-between p-4 border-b border-gray-200;
}

.modal-body {
  @apply p-4 flex h-[calc(90vh-120px)];
}

.modal-footer {
  @apply flex items-center justify-between p-4 border-t border-gray-200;
}

/* Annotation Modal Specific Styles */
.annotation-toolbar {
  @apply w-1/5 p-4 border-r border-gray-200 space-y-2;
}

.annotation-tool {
  @apply w-full flex items-center space-x-2 p-3 rounded-lg border border-gray-300 hover:bg-gray-50 transition-colors;
}

.annotation-tool.active {
  @apply bg-blue-50 border-blue-300 text-blue-700;
}

.annotation-canvas {
  @apply flex-1 p-4 bg-gray-50 flex items-center justify-center;
}

.annotation-canvas canvas {
  @apply border border-gray-300 rounded bg-white cursor-crosshair;
}

/* Color Picker */
.color-picker {
  @apply w-8 h-8 rounded border-2 border-gray-300 cursor-pointer;
}

.color-palette {
  @apply grid grid-cols-5 gap-1 p-2 bg-white border border-gray-300 rounded shadow-lg absolute z-10;
}

.color-option {
  @apply w-6 h-6 rounded cursor-pointer border border-gray-300;
}

/* Line Width Selector */
.line-width-selector {
  @apply flex items-center space-x-2 p-2;
}

.line-width-preview {
  @apply bg-gray-800 rounded-full;
}

/* Button Styles */
.btn-primary {
  @apply bg-primary text-white px-4 py-2 rounded-lg hover:bg-blue-600 transition-colors;
}

.btn-secondary {
  @apply bg-gray-200 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-300 transition-colors;
}

.btn-danger {
  @apply bg-red-600 text-white px-4 py-2 rounded-lg hover:bg-red-700 transition-colors;
}

.btn-success {
  @apply bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 transition-colors;
}

/* Loading States */
.loading {
  @apply animate-spin;
}

.skeleton {
  @apply animate-pulse bg-gray-200 rounded;
}

/* Responsive Design */
@media (max-width: 768px) {
  .grid-cols-12 {
    @apply grid-cols-1;
  }
  
  .col-span-7 {
    @apply col-span-1;
  }
  
  .col-span-5 {
    @apply col-span-1;
  }
  
  .modal-content {
    @apply w-full h-full rounded-none;
  }
}

/* Form Elements */
.form-input {
  @apply w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent;
}

.form-select {
  @apply w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent;
}

.form-textarea {
  @apply w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent resize-none;
}

/* Utility Classes */
.aspect-video {
  aspect-ratio: 16/9;
}

.text-primary {
  color: #3b82f6;
}

.bg-primary {
  background-color: #3b82f6;
}

/* Animation for smooth transitions */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 隐藏底部不需要的图片显示 */
main:after,
.main-content:after,
body > div:last-child:not(#app),
footer,
.bottom-images,
.footer-images,
.page-bottom,
.site-footer,
.bottom-gallery,
.bottom-showcase {
  @apply hidden !important;
}

/* 隐藏任何可能的底部图片容器 */
*[class*="bottom"]:has(img),
*[id*="bottom"]:has(img),
*[class*="footer"]:has(img),
*[id*="footer"]:has(img) {
  @apply hidden !important;
}

/* 确保main容器外没有额外内容显示 */
body > *:not(#app) {
  @apply hidden !important;
}

/* 防止任何绝对定位的底部元素显示 */
.fixed.bottom-0,
.absolute.bottom-0 {
  @apply hidden !important;
}

/* Enhanced Image preview modal - 完全重写防止溢出 */
.image-preview-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.95) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 9999 !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  animation: fadeIn 0.3s ease-out;
}

.image-preview-content {
  position: relative !important;
  max-width: calc(100vw - 40px) !important;
  max-height: calc(100vh - 40px) !important;
  width: auto !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  animation: scaleIn 0.3s ease-out;
}

.image-preview-content img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 8px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8) !important;
  background: white !important;
  /* 移除固定宽高比例，让图片自适应 */
}

.image-preview-close {
  position: absolute !important;
  top: -10px !important;
  right: -10px !important;
  width: 40px !important;
  height: 40px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #374151 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  font-size: 18px !important;
  transition: all 0.2s ease !important;
  z-index: 10000 !important;
  backdrop-filter: blur(10px) !important;
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 1) !important;
  transform: scale(1.1) !important;
}

.image-preview-info {
  position: absolute !important;
  bottom: 10px !important;
  left: 10px !important;
  right: 10px !important;
  background: rgba(0, 0, 0, 0.8) !important;
  color: white !important;
  padding: 12px 16px !important;
  border-radius: 8px !important;
  backdrop-filter: blur(10px) !important;
  font-size: 14px !important;
}

/* Preview animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to { 
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 图片悬停效果 - 移除预览提示 */
.image-item img:hover {
  @apply cursor-pointer;
}

/* 任务3: 图片预览模态框 - 统一样式防溢出 */
.image-preview-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.9) !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-preview-modal.show {
  opacity: 1 !important;
}

.image-preview-modal.closing {
  opacity: 0 !important;
  transform: scale(0.95) !important;
}

.image-preview-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  cursor: pointer !important;
}

.image-preview-content {
  position: relative !important;
  background: white !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
  overflow: hidden !important;
  max-width: calc(100vw - 40px) !important;
  max-height: calc(100vh - 40px) !important;
  width: fit-content !important;
  height: fit-content !important;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-preview-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px 24px !important;
  border-bottom: 1px solid #e5e7eb !important;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
}

.image-preview-title {
  font-size: 18px !important;
  font-weight: 600 !important;
  color: #374151 !important;
  display: flex !important;
  align-items: center !important;
}

.image-preview-title::before {
  content: '🖼️';
  margin-right: 8px !important;
}

.image-preview-close {
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #ef4444 !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  border: none !important;
}

.image-preview-close:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  transform: scale(1.1) rotate(90deg) !important;
}

.image-preview-body {
  position: relative !important;
  background: #f9fafb !important;
  min-height: 300px !important;
  max-height: calc(100vh - 160px) !important;
  overflow: hidden !important;
}

.image-preview-container {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.image-preview-img {
  max-width: calc(100% - 40px) !important;
  max-height: calc(100% - 40px) !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: white !important;
  border: 2px solid #e5e7eb !important;
}

.image-preview-loading {
  @apply absolute inset-0 flex flex-col items-center justify-center text-gray-500;
  animation: pulse 1.5s ease-in-out infinite;
}

.image-preview-loading i {
  @apply text-4xl mb-2 text-blue-500;
}

.image-preview-footer {
  @apply p-4 bg-gray-50 border-t border-gray-200;
}

.image-preview-info {
  @apply text-sm text-gray-600 text-center;
}

.image-preview-controls {
  @apply absolute top-4 right-4 flex space-x-2;
}

.preview-btn {
  @apply w-10 h-10 flex items-center justify-center rounded-full bg-black bg-opacity-50 hover:bg-opacity-70 text-white transition-all duration-200;
  backdrop-filter: blur(8px);
}

.preview-btn:hover {
  transform: scale(1.1);
}

/* 预览动画 */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 响应式预览 */
@media (max-width: 768px) {
  .image-preview-content {
    @apply w-full h-full rounded-none;
  }
  
  .image-preview-img {
    max-height: calc(100vh - 200px);
  }
}

/* 任务4: 隐藏底部的历史图片展示区域 - 精确修复版本 */
/* 移除所有可能影响右侧区域显示的规则 */

/* 精确隐藏特定的历史面板，不影响其他元素 */
/* 使用更安全的选择器，避免误伤其他内容 */

/* ====== 16:9 图片比例修复 - 关键样式 ====== */

/* 主图片区域 - 统一尺寸，一行3张 */
.image-item-16-9 {
  aspect-ratio: 16/9 !important;
  width: 100%;
  max-width: 280px; /* 确保一行可以放3张图片 */
}

.image-item {
  position: relative;
  background: #f8fafc;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden; /* 改回hidden，保持图片裁剪 */
  transition: all 0.3s ease;
  width: 100%;
  max-width: 280px;
}

/* 图片网格布局 - 确保一行3张，为外部标签增加行间距 */
#image-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px 16px !important; /* 列间距16px，行间距增加 */
  row-gap: 48px !important;   /* 行间距48px，为外部标签预留足够空间 */
  width: 100%;
}

/* 图片容器 - 确保不破坏网格布局，为外部标签留空间 */
.image-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
  margin-bottom: 32px; /* 为外部标签预留空间 */
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover !important;
  object-position: center;
  cursor: pointer;
  border-radius: 6px; /* 给图片添加圆角 */
}

/* 图片控制按钮样式恢复 - 右上角 */
.image-item .image-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.image-item:hover .image-controls {
  opacity: 1;
}

.image-item .image-controls button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 12px;
  color: #374151;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-item .image-controls button:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 图片操作按钮 - 底部对齐 */
.image-item .image-action-buttons {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 15;
}

.image-item:hover .image-action-buttons {
  opacity: 1;
}

.image-item .image-action-buttons button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #374151;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-item .image-action-buttons button:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 收藏按钮特殊样式 */
.image-item .image-action-buttons button:last-child:hover .fas.fa-heart {
  color: #ef4444 !important;
}

/* 图片标签容器 - 移动到图片外部左下方 */
.image-container .image-label-container {
  position: absolute;
  bottom: -30px; /* 移到图片下方 */
  left: 0;      /* 左对齐 */
  z-index: 20;
  width: auto;
  pointer-events: none; /* 不阻挡点击事件 */
}

.image-item .image-number,
.image-item .image-label {
  background: rgba(59, 130, 246, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  display: inline-block;
  white-space: nowrap;
}

.image-item .dimension-selector {
  position: absolute;
  bottom: -30px; /* 移到图片下方 */
  right: 0;      /* 右对齐 */
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(209, 213, 219, 0.8);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  z-index: 20;
  min-width: 80px;
}

/* 缩略图区域 - 严格16:9比例 */
.thumbnail-16-9 {
  width: 80px !important;
  height: 45px !important; /* 严格的16:9比例: 80÷16×9=45 */
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9 !important;
}

.thumbnail-16-9 img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center;
}

/* 历史记录中的16:9图片样式 */
.history-image-16-9 {
  width: 96px !important;
  height: 54px !important; /* 严格的16:9比例: 96÷16×9=54 */
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9 !important;
}

.history-image-16-9 img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center;
}

/* 历史面板和缩略图换行优化 */
.history-scroll .flex {
  flex-wrap: wrap !important;
  gap: 12px !important;
}

.history-scroll .flex-shrink-0 {
  width: 96px !important; /* 固定宽度防止变形 */
}

/* 正式生图缩略图区域换行 */
#generation-thumbnails .flex {
  flex-wrap: wrap !important;
  gap: 8px !important;
}

#generation-thumbnails .flex-shrink-0 {
  margin-bottom: 8px;
}

/* 缩略图删除按钮 */
.thumbnail-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(248, 113, 113, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.thumbnail-16-9:hover .thumbnail-delete-btn {
  opacity: 1;
}

.thumbnail-delete-btn:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

/* Module visibility controls */
.module {
  display: none;
}

.module.active {
  display: block;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

/* 新的图片标签样式 - 固定在右上角 */
.image-label {
  background: rgba(59, 130, 246, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
}

/* 图片下方的控件容器 - 左右布局 */
.image-controls-below {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-controls-below .image-label-below {
  background: rgba(59, 130, 246, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.image-controls-below .dimension-selector {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-controls-below .dimension-selector:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 移除图片放大效果，只保留投影 */
.image-item:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: none !important;
}

.image-item img:hover {
  transform: none !important;
  cursor: pointer;
}

/* 固定操作按钮样式 - 文字+图标 */
.image-item .image-action-buttons button {
  width: auto;
  min-width: 60px;
  height: 32px;
  padding: 4px 8px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
  font-size: 11px;
  color: #374151;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-item .image-action-buttons button:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 为按钮添加文字标签 */
.image-item .image-action-buttons button[title="标注"]:after {
  content: "标注";
  margin-left: 2px;
}

.image-item .image-action-buttons button[title="抠图"]:after {
  content: "抠图";
  margin-left: 2px;
}

.image-item .image-action-buttons button[title="收藏"]:after {
  content: "收藏";
  margin-left: 2px;
}

/* 确保参考图网格布局正确 */
#reference-images-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px !important;
}

/* ====== 标注弹窗样式 ====== */

/* 标注弹窗遮罩和容器 - 完全重新设计 */
.annotation-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(6px) !important;
  padding: 0 !important;
  margin: 0 !important;
}

.annotation-modal.hidden {
  display: none !important;
}

.annotation-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
}

.annotation-modal-content {
  position: relative !important;
  width: 95vw !important;
  height: 90vh !important;
  min-width: 800px !important;
  min-height: 600px !important;
  max-width: 1200px !important;
  max-height: 800px !important;
  background: white !important;
  border-radius: 8px !important;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 顶部状态栏 */
.annotation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  flex-shrink: 0;
}

.annotation-title {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin: 0;
  display: flex;
  align-items: center;
}

.annotation-close-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 16px;
}

.annotation-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.05);
}

/* 主体区域 - 确保正确的flex布局 */
.annotation-body {
  flex: 1 !important;
  display: flex !important;
  overflow: hidden !important;
  height: calc(100% - 120px) !important; /* 减去header和footer的高度 */
}

/* 左侧工具栏 - 完全重新设计 */
.annotation-toolbar {
  width: 240px !important;
  min-width: 240px !important;
  max-width: 240px !important;
  background: #f8fafc !important;
  border-right: 1px solid #e5e7eb !important;
  padding: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  flex-shrink: 0 !important;
  height: 100% !important;
  box-sizing: border-box !important;
}

/* 工具按钮区域 - 紧凑设计 */
.annotation-tools {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.annotation-tool {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 12px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 6px !important;
  background: white !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-size: 13px !important;
  color: #374151 !important;
  height: 36px !important;
  min-height: 36px !important;
}

.annotation-tool:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateX(2px);
}

.annotation-tool.active {
  border-color: #3b82f6;
  background: #3b82f6;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.annotation-tool i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.annotation-tool span {
  font-weight: 500;
}

/* 颜色选择器 - 紧凑设计 */
.annotation-color-section,
.annotation-linewidth-section {
  border-top: 1px solid #e5e7eb !important;
  padding-top: 12px !important;
  margin-top: 12px !important;
}

.annotation-label {
  display: block !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #6b7280 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  margin-bottom: 6px !important;
}

.color-picker-container,
.linewidth-container {
  position: relative;
}

.current-color {
  width: 100%;
  height: 40px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.current-color:hover {
  border-color: #3b82f6;
  transform: scale(1.02);
}

.color-palette {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 10;
  margin-top: 4px;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.color-option:hover {
  border-color: #3b82f6;
  transform: scale(1.1);
}

/* 线宽调整器 */
.current-linewidth {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.current-linewidth:hover {
  border-color: #3b82f6;
}

.linewidth-preview {
  width: 40px;
  border-radius: 2px;
}

.linewidth-value {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  margin-left: auto;
}

.linewidth-slider {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 10;
  margin-top: 4px;
}

.slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 操作按钮 - 紧凑设计 */
.annotation-actions {
  border-top: 1px solid #e5e7eb !important;
  padding-top: 12px !important;
  margin-top: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.annotation-action-btn {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 10px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 4px !important;
  background: white !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-size: 12px !important;
  color: #374151 !important;
  height: 32px !important;
  min-height: 32px !important;
}

.annotation-action-btn:hover:not(:disabled) {
  border-color: #3b82f6;
  background: #eff6ff;
}

.annotation-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f9fafb;
}

.annotation-action-btn i {
  font-size: 14px;
}

/* 右侧画布工作区 */
.annotation-canvas-area {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  background: #f9fafb !important;
  overflow: hidden !important;
  height: 100% !important;
}

.canvas-container {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.annotation-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
}

.canvas-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #6b7280;
  font-size: 14px;
}

.canvas-loading i {
  font-size: 24px;
  color: #3b82f6;
}

/* 底部操作栏 */
.annotation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
  flex-shrink: 0;
}

.annotation-footer-btn {
  padding: 12px 24px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-cancel {
  background: white;
  color: #6b7280;
}

.btn-cancel:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
}

.btn-export {
  background: white;
  color: #3b82f6;
}

.btn-export:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.btn-complete {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.btn-complete:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .annotation-modal-content {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100vh - 20px) !important;
  }
  
  .annotation-toolbar {
    width: 240px !important;
    min-width: 200px !important;
  }
}

@media (max-width: 768px) {
  .annotation-modal-content {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  
  .annotation-body {
    flex-direction: column !important;
  }
  
  .annotation-toolbar {
    width: 100% !important;
    max-height: 200px !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    padding: 12px !important;
    min-width: unset !important;
  }
  
  .annotation-tools {
    flex-direction: row !important;
    min-width: max-content !important;
  }
  
  .annotation-canvas-area {
    flex: 1 !important;
    padding: 12px !important;
  }
}
  
  .annotation-body {
    flex-direction: column;
  }
  
  .annotation-toolbar {
    width: 100%;
    max-height: 200px;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
  }
  
  .annotation-tools {
    flex-direction: row;
    min-width: max-content;
  }
  
  .annotation-canvas-area {
    flex: 1;
    padding: 12px;
  }
}