:root {
  --primary-color: #06ad56;  /* 修改为微信绿 */
  --text-white: #fff;
  --bg-gray: #f8f8f8;
  --font-main: 'Noto Sans SC', sans-serif;
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.editor {
  width: 38%;
  padding: 20px; /* 减小padding */
  padding-bottom: 60px; /* 减小底部padding */
  background: var(--bg-gray);
  box-sizing: border-box;
  overflow-y: auto;
}

.editor input, .editor textarea {
  width: 100%;
  padding: 8px;
  margin-bottom: 8px; /* 减小margin */
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-family: var(--font-main);
}

.editor label {
  font-weight: bold;
  margin-bottom: 4px; /* 减小margin */
  display: block;
}

.editor button {
  background: var(--primary-color);
  color: var(--text-white);
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
}

.preview {
  width: 62%;
  background: #eaeaea;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cover-container {
  width: 900px;
  height: 506px; /* 16:9 比例 */
  background: linear-gradient(135deg, #06ad56 0%, #048d46 100%); /* 修改默认渐变色 */
  position: relative;
  display: flex;
  overflow: hidden;
}

.main-cover {
  flex: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  /* Added for background image and pseudo-element */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative; 
}

.main-cover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--main-cover-pseudo-bg-color, transparent); /* Fallback/solid color */
  background-image: var(--main-cover-pseudo-bg-image, none); /* For gradient overlays */
  z-index: 0; /* Behind content-wrapper */
  transition: background-color 0.3s ease, background-image 0.3s ease; /* Added transition for bg-image */
}

.content-wrapper {
  text-align: center;
  color: var(--text-white);
  /* Ensure content is above the pseudo-element */
  position: relative;
  z-index: 1;
}

.main-title {
  font-size: 48px;
  font-weight: 900;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.sub-title {
  font-size: 36px;
  opacity: 0.9;
  transition: all 0.3s ease;
}

.moment-cover {
  flex: 1;
  display: flex;
  flex-direction: column;
  /* background: rgba(0, 0, 0, 0.1); */ /* REMOVED - Will be set by JS */
  color: var(--text-white); /* Fallback text color, will be overridden by JS for placeholder */
  padding: 40px 20px;
  justify-content: center;
  align-items: center;
}

.moment-cover img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* Default will be contain */
}

.moment-cover .placeholder-text {
  /* color: #ccc; */ /* REMOVED - Will be set by JS */
  font-size: 16px;
  text-align: center;
}

.editor input[type="color"] {
  width: 80px;
  height: 32px;
  padding: 2px;
  cursor: pointer;
}

.color-group {
  display: flex;
  gap: 8px; /* 减小gap */
  margin-bottom: 8px; /* 减小margin */
  align-items: center;
}

.color-group label {
  flex: 1;
  font-size: 14px;
}

.color-group input {
  margin-bottom: 0;
}

@media (max-width: 1200px) {
  body {
    flex-direction: column;
  }
  
  .editor, .preview {
    width: 100%;
    height: auto;
    min-height: 50vh;
  }
  
  .cover-container {
    transform: scale(0.6);
    transform-origin: center center;
  }
  
  .style-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

.style-controls {
  margin-bottom: 10px; /* 减小margin */
  border: 1px solid #ddd;
  padding: 8px; /* 减小padding */
  border-radius: 6px;
  background: #fff;
}

.style-controls > label {
  font-size: 14px;
  margin-bottom: 8px;
}

.style-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 0;
}

.style-btn {
  padding: 6px;
  font-size: 14px;
}

.style-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.range-group {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-group label {
  min-width: 80px;
  font-size: 14px;
  color: #666;
  margin: 0;
}

.range-group input[type="range"] {
  flex: 1;
  margin: 0;
}

.range-value {
  font-size: 14px;
  color: #666;
  min-width: 45px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none; /* ADDED for broad compatibility */
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
}

/* 添加二维码弹窗样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 20px;
}

/* Styles for Palette Button */
.palette-btn {
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 2px 6px; /* Adjust padding to be small */
  font-size: 16px; /* Icon size */
  line-height: 1; /* Ensure button size is tight around icon */
  cursor: pointer;
  margin-left: 5px; /* Space from the color input */
  width: auto !important; /* Override general button full width if applicable */
  height: auto; /* Ensure height is also auto */
  vertical-align: middle; /* Align with color input */
}
.palette-btn:hover {
  background: #ddd;
}

/* Styles for Traditional Color Palette Modal */
/* General modal styles like .modal, .modal-content, .close-modal are already defined for qrCodeModal */
/* We will add specific overrides or new styles for the traditional color palette modal */

#traditionalColorModal .modal-content {
    max-width: 860px; /* Wider for color grid, changed from 700px */
    max-height: 85vh; /* Limit height and allow scrolling */
    display: flex; /* Use flex for better internal layout */
    flex-direction: column;
    /* Overriding existing .modal-content if it has fixed height/aspect ratio from QR modal */
    /* top, left, transform are fine from existing .modal-content */
}

#traditionalColorModal h3 {
    margin-top: 0; /* Reset margin if needed */
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    text-align: center; /* Ensure heading is centered */
}

#traditionalColorPalette {
  display: grid;
  grid-template-columns: repeat(6, 1fr); /* Responsive grid, changed from auto-fill */
  gap: 10px;
  padding: 20px; /* Changed from padding-top: 10px; */
  overflow-y: auto; /* Allow scrolling within the grid if many colors */
  flex-grow: 1; /* Allow grid to take available space within modal-content */
  border-top: 1px solid #eee; /* Added for visual separation */
}

.color-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Center content vertically */
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
  min-height: 70px; /* Ensure items have some height for name and hex */
  background-color: #fff; /* Ensure text is visible if color is too light/transparent */
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.color-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.color-item-swatch {
  width: 100%;
  height: 40px;
  border-radius: 3px;
  margin-bottom: 5px;
  border: 1px solid rgba(0,0,0,0.1); /* Subtle border for very light colors */
}

.color-item-name {
  font-size: 12px;
  font-weight: bold;
  color: #333;
  margin-bottom: 2px;
  display: block; /* Ensure it takes its own line */
}

.color-item-hex {
  font-size: 10px;
  color: #777;
  display: block; /* Ensure it takes its own line */
}

/* Style for the selected color name span */
.selected-color-name {
  margin-left: 8px;
  font-size: 12px;
  color: #555;
  white-space: nowrap; /* Prevent wrapping if name is long */
  overflow: hidden;
  text-overflow: ellipsis; /* Show ellipsis for very long names */
  width: 100px; /* Changed from max-width to fixed width */
  min-height: 1.2em; /* Ensure it takes up some vertical space even if empty */
  display: inline-block; /* To respect width and vertical alignment */
  vertical-align: middle; /* Align with input and button */
  box-sizing: border-box; /* Good practice if padding/border were added */
}
 