/* 全局基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 0;
}

.app-container {
  width: 100%;
  max-width: 1300px;
  padding: 15px;
  box-sizing: border-box;
}

/* 单行组件样式 */
.string-concat-line {
  display: block;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.line-layout {
  display: flex;
  width: 100%;
  gap: 0; /* 列间距为0，靠分隔线分隔 */
}

.col {
  display: flex;
  align-items: center;
}

.col-a {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.col-b {
  flex: 0 0 200px;
  padding: 0 8px;
}

.col-c {
  flex: 0 0 150px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 列分隔线 */
.col-divider {
  width: 1px;
  height: 70%;
  background: linear-gradient(to bottom, transparent, rgba(102, 126, 234, 0.3), transparent);
  align-self: center;
}

/* 输入框样式 */
.text-input {
  font-size: 14px;
  font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border: none;
  background-color: transparent;
  padding: 8px;
  flex: 1;
  resize: none;
  outline: none;
  line-height: 1.6;
  color: #333;
  /* 重置textarea默认高度 */
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  rows: 1;
  /* 隐藏滚动条 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.text-input::placeholder {
  color: #aaa;
}

.text-input::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* 按钮组 */
.btn-group {
  display: flex;
  flex-direction: row;
  gap: 6px;
  margin-left: 0;
  align-items: center;
}

/* 按钮样式 */
.btn, .prompt-btn {
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  min-width: 50px;
}

.btn:active, .prompt-btn:active {
  transform: scale(0.95);
}

.clear-btn {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
  color: #fff;
}

.clear-btn:hover {
  background: linear-gradient(135deg, #F57C00 0%, #EF6C00 100%);
  box-shadow: 0 4px 8px rgba(255, 152, 0, 0.3);
}

.copy-btn {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: #fff;
}

.prompt-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 8px 16px;
}

.prompt-btn:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 行分隔线 */
.horizontal-line-container {
  width: 100%;
  margin: 8px auto;
  display: flex;
  justify-content: center;
}

.horizontal-line {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
}

/* Toast提示 */
.toast {
  position: fixed;
  z-index: 9999;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: #ffffff;
  padding: 16px 32px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  pointer-events: none;
  display: none;
  backdrop-filter: blur(10px);
  animation: toastIn 0.3s ease-out;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.toast.show {
  opacity: 1;
}

@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* 移动端适配 */
@media (max-width: 768px) {
  body {
    padding: 4px 0;
    min-height: 100vh;
  }

  .app-container {
    width: 100%;
    padding: 4px 8px;
    overflow-y: auto;
  }

  .string-concat-line {
    display: flex !important;
    flex-direction: column !important;
    padding: 4px 6px;
    margin-bottom: 6px;
    border-radius: 8px;
  }

  .line-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 4px !important;
  }

  /* 每一列（A、B、C）单独占一行 */
  .col-a, .col-b, .col-c {
    width: 100% !important;
    flex: none !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    padding: 0 !important;
    gap: 6px;
    margin-bottom: 2px;
  }

  .col-a .text-input,
  .col-b .text-input {
    flex: 1;
    padding: 5px 8px;
    font-size: 13px;
    width: auto !important;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    height: 30px !important;
    min-height: 30px !important;
    line-height: 1.1;
    overflow: hidden;
  }

  .col-a .text-input:focus,
  .col-b .text-input:focus {
    border-color: #667eea;
    background: #fff;
  }

  .btn-group {
    flex-direction: row;
    margin-left: 0;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
  }

  .btn {
    padding: 4px 8px;
    font-size: 12px;
    min-width: 38px;
    height: 30px;
    border-radius: 4px;
  }

  /* C列（复制prompt按钮）全宽显示 */
  .col-c {
    margin-top: 2px;
    margin-bottom: 0;
  }

  .prompt-btn {
    width: 100%;
    font-size: 13px;
    padding: 6px 10px;
    height: 34px;
    border-radius: 6px;
  }

  /* 隐藏移动端的分隔线 */
  .col-divider {
    display: none;
  }

  .horizontal-line-container {
    margin: 4px auto;
  }
}

/* 平板设备适配 */
@media (min-width: 769px) and (max-width: 1024px) {
  .app-container {
    padding: 15px;
  }

  .string-concat-line {
    padding: 10px;
  }

  .col-a {
    flex: 1;
  }

  .col-b {
    flex: 0 0 160px;
  }

  .col-c {
    flex: 0 0 120px;
  }
}

/* 大屏幕优化 */
@media (min-width: 1300px) {
  .app-container {
    max-width: 1400px;
  }

  .string-concat-line {
    min-height: 90px;
  }

  .text-input {
    font-size: 14px;
  }
}
