/* chat-czapple · Phase 3 frontend styles
   Theme: light workplace, WeChat green accent (#07C160) as czapple brand. */

:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-dim: #9ca3af;
  --accent: #07C160;
  --accent-soft: #e7f8f0;
  --accent-dark: #059248;
  --error: #ef4444;
  --error-soft: #fef2f2;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ========== Header ========== */
.hdr {
  text-align: center;
  padding: 16px 0 8px;
}
.hdr-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hdr-sub {
  color: var(--text-sub);
  margin-top: 4px;
  font-size: 14px;
}
.hdr-brand {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 10px;
}
.hdr-brand a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.hdr-brand a:hover {
  text-decoration: underline;
}

/* ========== Beta notice ========== */
.beta-notice {
  background: var(--warning-soft);
  color: #92400e;
  border-left: 3px solid var(--warning);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin: 16px 0 20px;
}
.beta-notice strong {
  font-weight: 600;
}

/* ========== Panel + sections ========== */
.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sec {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.sec-h {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

/* ========== Input tabs ========== */
.input-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.tab {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}
.tab:hover:not(.tab-active) {
  color: var(--text);
}
.tab-active {
  background: white;
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ========== Textarea ========== */
#text-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
  background: white;
  color: var(--text);
}
#text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ========== Upload zone ========== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  padding: 36px 20px;
  position: relative;
  transition: all 0.2s;
}
.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-zone label {
  display: block;
  cursor: pointer;
}
.upload-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.upload-title {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.upload-hint {
  color: var(--text-sub);
  font-size: 12px;
  margin-top: 6px;
}
/* Multi-image preview grid */
#images-preview {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
#images-preview .img-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  aspect-ratio: 3 / 4;
}
#images-preview .img-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#images-preview .img-ord {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
#images-preview .img-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
#images-preview .img-remove:hover {
  background: var(--error);
}
#images-preview .img-meta {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}

/* ========== Style grid (6 buttons) ========== */
.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 560px) {
  .style-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.style-btn {
  padding: 14px 8px;
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  font-family: inherit;
}
.style-btn:hover {
  background: white;
  box-shadow: var(--shadow);
}
.style-btn.selected {
  background: white;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.style-emoji {
  font-size: 26px;
  margin-bottom: 4px;
}
.style-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.style-desc {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

/* ========== Generate button ========== */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}
.btn-primary:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}
.btn-spinner {
  display: inline-block;
  letter-spacing: 2px;
  animation: pulse 0.9s ease-in-out infinite;
  margin-left: 6px;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ========== Results ========== */
.analysis-box {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.analysis-row {
  margin: 4px 0;
  line-height: 1.6;
}
.analysis-label {
  color: var(--text-sub);
  margin-right: 6px;
  font-weight: 500;
}

.reply-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
  transition: box-shadow 0.15s;
}
.reply-card:hover {
  box-shadow: var(--shadow-hover);
}
.reply-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  padding-right: 70px;
}
.reply-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.reply-tone {
  background: var(--bg);
  color: var(--text-sub);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
}
.reply-rationale {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 8px;
  line-height: 1.5;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-sub);
  font-family: inherit;
  transition: all 0.15s;
}
.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.copy-btn.copied {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.error-box {
  background: var(--error-soft);
  border-left: 3px solid var(--error);
  color: var(--error);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 14px;
}
.meta-footer {
  color: var(--text-dim);
  font-size: 11px;
  text-align: right;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ========== Footer ========== */
.ftr {
  text-align: center;
  color: var(--text-sub);
  font-size: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.ftr-links {
  margin-top: 8px;
}
.ftr-links a {
  color: var(--accent);
  text-decoration: none;
  padding: 0 2px;
}
.ftr-links a:hover {
  text-decoration: underline;
}
.ftr-links .dot {
  color: var(--text-dim);
  margin: 0 4px;
}

/* ========== Utilities ========== */
.hidden {
  display: none !important;
}
.btn-sm {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-sub);
  font-family: inherit;
}
.btn-sm:hover {
  border-color: var(--error);
  color: var(--error);
}
