/* 主样式文件 - 简化版本 */
:root {
  --primary-color: #3f51b5;
  --primary-hover: #303f9f;
  --gradient-start: #5c6bc0;
  --gradient-end: #26c6da;
  --text-color: #333;
  --text-light: #fff;
  --border-radius: 12px;
  --box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  --transition-speed: 0.3s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  margin: 0;
  padding: 0;
  color: var(--text-color);
}

header {
  width: 100%;
  text-align: center;
  padding: 30px 0;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  padding: 0 20px;
}

footer {
  width: 100%;
  text-align: center;
  padding: 20px 0;
  background-color: rgba(0, 0, 0, 0.1);
  color: var(--text-light);
  margin-top: 40px;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.app-title {
  margin-bottom: 30px;
  color: var(--text-light);
  text-align: center;
  font-weight: 600;
  font-size: 2.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  letter-spacing: 1px;
}

.app-title i {
  margin-right: 10px;
}

.section-title {
  color: var(--text-light);
  margin: 30px 0 20px;
  font-weight: 500;
  font-size: 1.5rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.section-title i {
  margin-right: 10px;
}

.container {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 30px;
  flex-wrap: wrap;
  max-width: 1200px;
  width: 100%;
}

.image-display, .message-display {
  text-align: left;
  border: none;
  border-radius: var(--border-radius);
  width: 512px;
  height: 512px;
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: var(--box-shadow);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.image-display:hover, .message-display:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.image-display::before, .message-display::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  color: rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 1;
  font-weight: 500;
}

.image-display img, .message-display-content {
  position: relative;
  width: 100%;
  height: auto;
  z-index: 2;
}

.message-display {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 20px;
}

.message-display-content {
  width: 100%;
  overflow-wrap: break-word;
}

.button-group {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin: 30px 0;
  width: 100%;
  max-width: 600px;
}

.file-input-wrapper {
  position: relative;
  display: inline-block;
  overflow: visible;
  background: transparent;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  font-size: 100px;
  opacity: 0;
  right: 0;
  top: 0;
  cursor: pointer;
  height: 100%;
  width: 100%;
  z-index: 2;
}

.btn {
  padding: 14px 24px;
  background-color: var(--primary-color);
  color: var(--text-light);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all var(--transition-speed);
  text-align: center;
  display: inline-block;
  min-width: 160px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
}

.btn i {
  margin-right: 8px;
}

.btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.example-images {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 30px;
  width: 100%;
}

.example-images img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-speed);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.example-images img:hover {
  transform: scale(1.05) translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: var(--text-light);
  padding: 20px 30px;
  border-radius: var(--border-radius);
  display: none;
  align-items: center;
  gap: 15px;
  z-index: 1000;
  box-shadow: var(--box-shadow);
}

.loading-indicator span {
  font-size: 16px;
  font-weight: 500;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid var(--text-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

pre {
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .container {
    flex-direction: column;
    align-items: center;
  }
  .image-display, .message-display {
    width: 100%;
    max-width: 512px;
  }
  .app-title {
    font-size: 2rem;
  }
  .section-title {
    font-size: 1.3rem;
  }
}

.file-input-wrapper:hover .btn {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* 分析结果样式 */
.analysis-result {
  line-height: 1.6;
}

.analysis-result h4 {
  color: #28a745;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.analysis-result h4 i {
  margin-right: 8px;
}

.objects-list {
  margin-top: 15px;
}

.object-item {
  background-color: #f8f9fa;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.object-item h5 {
  color: var(--primary-color);
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.object-item p {
  margin-bottom: 5px;
  font-size: 14px;
}

/* 处理过程图片样式 */
.process-images-section {
  width: 100%;
  max-width: 1200px;
  margin: 40px 0;
  padding: 0 20px;
}

.process-images-container {
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: var(--box-shadow);
}

.process-image-group {
  margin-bottom: 40px;
}

.process-image-group:last-child {
  margin-bottom: 0;
}

.process-image-title {
  color: var(--primary-color);
  font-size: 1.3rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.process-image-title i {
  font-size: 1.1rem;
}

.process-image-title small {
  font-size: 0.9rem;
  color: #666;
  font-weight: 400;
  margin-left: 10px;
}

.process-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.process-image-item {
  text-align: center;
  background-color: #fff;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.process-image-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.process-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform var(--transition-speed);
}

.process-image:hover {
  transform: scale(1.05);
}

.process-image-caption {
  margin-top: 10px;
  font-size: 12px;
  color: #666;
  word-break: break-all;
}

/* 图片模态框样式 */
.image-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
}

.image-modal-content {
  position: relative;
  margin: auto;
  padding: 0;
  width: 90%;
  max-width: 1200px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
}

.image-modal-close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2001;
}

.image-modal-close:hover,
.image-modal-close:focus {
  color: #bbb;
}

.image-modal-img {
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.image-modal-caption {
  margin: 15px 0;
  color: #ccc;
  font-size: 16px;
  text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .process-image-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
  }
  
  .process-image {
    height: 120px;
  }
  
  .process-images-container {
    padding: 20px;
  }
  
  .process-image-title {
    font-size: 1.1rem;
  }
  
  .image-modal-content {
    width: 95%;
  }
  
  .image-modal-close {
    top: 10px;
    right: 25px;
    font-size: 30px;
  }
}

/* 日志显示样式 */
.analysis-logs {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.4;
  max-height: 500px;
  overflow-y: auto;
  overflow-anchor: none; /* 防止自动滚动被打断 */
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  scroll-behavior: smooth; /* 平滑滚动 */
}

.log-entry {
  margin-bottom: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.log-time {
  color: #6c757d;
  font-size: 11px;
  white-space: nowrap;
  min-width: 70px;
}

.log-message {
  flex: 1;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.log-info {
  background-color: #e3f2fd;
  border-left: 3px solid #2196f3;
}

.log-error {
  background-color: #ffebee;
  border-left: 3px solid #f44336;
  color: #c62828;
}

.log-warning {
  background-color: #fff3e0;
  border-left: 3px solid #ff9800;
  color: #ef6c00;
}

.log-success {
  background-color: #e8f5e8;
  border-left: 3px solid #4caf50;
  color: #2e7d32;
}

/* 滚动条样式 */
.analysis-logs::-webkit-scrollbar {
  width: 6px;
}

.analysis-logs::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.analysis-logs::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.analysis-logs::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}