/* WeChat Chat Generator Styles */

.wechat-editor {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.phone-preview-container {
  flex: 0 0 375px;
  position: sticky;
  top: 20px;
}

.phone-preview-container .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.phone-frame {
  width: 375px;
  height: 800px;
  background: #000;
  border-radius: 40px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3), inset 0 0 0 2px #333;
  position: relative;
  overflow: hidden;
}

.phone-notch {
  display: none;
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: #ededed;
  border-radius: 30px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* WeChat Status Bar */
.wechat-status-bar {
  height: 44px;
  padding: 10px 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f7f7f7;
  position: relative;
  z-index: 5;
}

.status-left {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal-icon {
  width: 16px;
  height: 16px;
}

.wifi-icon {
  width: 16px;
  height: 16px;
}

.battery-icon {
  display: flex;
  align-items: center;
  gap: 1px;
}

.battery-body {
  width: 22px;
  height: 11px;
  border: 1.5px solid #333;
  border-radius: 3px;
  padding: 1.5px;
  position: relative;
}

.battery-level {
  height: 100%;
  background: #333;
  border-radius: 1px;
  transition: width 0.3s;
}

.battery-cap {
  width: 2px;
  height: 5px;
  background: #333;
  border-radius: 0 1px 1px 0;
}

.battery-text {
  font-size: 11px;
  color: #333;
  margin-left: 4px;
}

/* WeChat Header */
.wechat-header {
  height: 44px;
  background: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.wechat-header-left {
  width: 40px;
}

.wechat-back-icon {
  width: 24px;
  height: 24px;
}

.wechat-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wechat-title {
  font-size: 16px;
  font-weight: 500;
  color: #333;
}

.wechat-member-count {
  font-size: 11px;
  color: #999;
}

.wechat-header-right {
  width: 40px;
  display: flex;
  justify-content: flex-end;
}

.wechat-more-icon {
  width: 24px;
  height: 24px;
}

/* WeChat Messages */
.wechat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  background: #ededed;
}

.messages-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message enter animation (replay playback) */
.msg-enter {
  animation: msgEnter 0.3s ease both;
}

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

.message-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.message-item.self {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: #ddd;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-avatar svg {
  width: 100%;
  height: 100%;
  padding: 8px;
}

.message-content {
  max-width: 65%;
}

.message-bubble {
  background: white;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 15px;
  line-height: 1.4;
  color: #111;
  position: relative;
  word-break: break-word;
}

.message-item:not(.self) .message-bubble {
  background: white;
}

.message-item:not(.self) .message-bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 12px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid white;
}

.message-item.self .message-bubble {
  background: #95ec69;
}

.message-item.self .message-bubble::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 12px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid #95ec69;
}

.time-divider {
  text-align: center;
  padding: 8px 0;
}

.time-label {
  background: #c8c8c8;
  color: white;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
}

/* WeChat Input Bar */
.wechat-input-bar {
  height: 50px;
  background: #f7f7f7;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 10px;
}

.input-voice-icon,
.input-emoji-icon,
.input-add-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.input-box {
  flex: 1;
  height: 36px;
  background: white;
  border-radius: 4px;
  border: 1px solid #ddd;
}

/* Controls Container */
.controls-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-section {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.control-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}

.avatar-controls {
  display: flex;
  gap: 24px;
}

.avatar-upload {
  flex: 1;
}

.avatar-preview-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: var(--gray-100);
  border: 2px dashed var(--gray-300);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.avatar-preview:hover {
  border-color: var(--primary);
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-preview svg {
  width: 40px;
  height: 40px;
}

.control-group {
  margin-bottom: 16px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.control-label .hint {
  font-weight: 400;
  color: var(--gray-400);
  font-size: 0.85rem;
}

.text-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--gray-800);
  background: #fff;
  transition: all 0.15s;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.control-row {
  display: flex;
  gap: 16px;
}

.control-row .control-group {
  flex: 1;
}

.battery-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.battery-input-wrapper .range-slider {
  flex: 1;
}

.battery-input-wrapper span {
  font-size: 0.9rem;
  color: var(--gray-600);
  min-width: 40px;
  text-align: right;
}

.range-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--gray-200);
  border-radius: 3px;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.chat-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--gray-800);
  background: #fff;
  resize: vertical;
  min-height: 200px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  line-height: 1.6;
  transition: all 0.15s;
}

.chat-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.format-hint {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 14px;
  margin-top: 12px;
}

.format-hint p {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 6px;
  line-height: 1.5;
}

.format-hint p:last-child {
  margin-bottom: 0;
}

.format-hint code {
  background: var(--gray-200);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--primary);
}

.template-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Preview toolbar (replay + GIF export) */
.preview-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.speed-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.speed-select {
  padding: 6px 8px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--gray-700);
  background: #fff;
  cursor: pointer;
}

.speed-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-lg);
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Info Section */
.info-section {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 24px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}

.info-section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.info-item {
  padding: 16px;
  background: var(--gray-50);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

.info-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.info-item p {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.5;
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
  .wechat-editor {
    flex-direction: column;
  }

  .phone-preview-container {
    position: static;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .phone-frame {
    max-width: 375px;
    width: 100%;
  }

  .avatar-controls {
    flex-direction: column;
  }

  .control-row {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 20px 16px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .phone-frame {
    height: 600px;
    border-radius: 30px;
    padding: 8px;
  }

  .wechat-title {
    font-size: 14px;
  }

  .message-bubble {
    font-size: 14px;
  }

  .message-avatar {
    width: 36px;
    height: 36px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .links-grid {
    grid-template-columns: 1fr;
  }
}