/* ================================================================
   TechTools — 周报生成器 (Weekly Report Generator) Styles
   Indigo accent: --cat-study (#6366F1)
   ================================================================ */

/* ------------------------------------------------------------
   1. Template Tabs
   ------------------------------------------------------------ */
.wr-template-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.wr-template-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  white-space: nowrap;
}
.wr-template-tab .wr-tab-icon {
  font-size: 16px;
  transition: transform 0.35s ease;
}
.wr-template-tab:hover {
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}
.wr-template-tab:hover .wr-tab-icon {
  transform: scale(1.2);
}
.wr-template-tab.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.55);
  color: var(--cat-study);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.25), 0 0 48px rgba(99, 102, 241, 0.1), 0 4px 16px rgba(0, 0, 0, 0.2);
  transform: scale(1.04);
}

/* ------------------------------------------------------------
   2. Layout — Side-by-side form + preview
   ------------------------------------------------------------ */
.wr-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 48px;
}

/* ------------------------------------------------------------
   3. Form Panel
   ------------------------------------------------------------ */
.wr-form-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px;
}

.wr-form-row {
  margin-bottom: 20px;
}

.wr-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.wr-label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
}

.wr-input {
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.wr-input::placeholder {
  color: var(--text-muted);
}
.wr-input:focus {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15), 0 0 40px rgba(99, 102, 241, 0.06);
  background: rgba(99, 102, 241, 0.04);
}

/* Date row */
.wr-date-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wr-date {
  flex: 1;
  color-scheme: dark;
}
.wr-date::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.6;
}
.wr-date-sep {
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

/* Textarea */
.wr-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.wr-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}
.wr-textarea:focus {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15), 0 0 40px rgba(99, 102, 241, 0.06);
  background: rgba(99, 102, 241, 0.04);
}

/* Action row */
.wr-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
  padding-top: 4px;
}

.wr-btn-clear {
  padding: 6px 16px;
  font-size: 13px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--text-muted);
  transition: all 0.25s ease;
  font-family: var(--font-body);
}
.wr-btn-clear:hover {
  color: var(--accent-rose);
  border-color: rgba(255, 77, 109, 0.4);
  background: rgba(255, 77, 109, 0.06);
}

/* ------------------------------------------------------------
   4. Preview Panel
   ------------------------------------------------------------ */
.wr-preview-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 16px;
  overflow: hidden;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.wr-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(99, 102, 241, 0.06);
}
.wr-preview-header h3 {
  font-family: var(--font-hero);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.wr-template-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--cat-study);
  border: 1px solid rgba(99, 102, 241, 0.3);
  white-space: nowrap;
}

.wr-preview-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  max-height: 620px;
}

.wr-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--text-muted);
  text-align: center;
}
.wr-preview-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.wr-preview-empty p {
  font-size: 14px;
  line-height: 1.7;
  font-family: var(--font-body);
}

/* ------------------------------------------------------------
   5. History Section
   ------------------------------------------------------------ */
.wr-history-section {
  margin-bottom: 32px;
}

.wr-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.wr-history-header h3 {
  font-family: var(--font-hero);
  font-size: 18px;
  font-weight: 600;
}
.wr-history-count {
  font-size: 13px;
  color: var(--text-muted);
}

.wr-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wr-history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.3s ease;
  gap: 16px;
}
.wr-history-item:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.wr-history-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.wr-history-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--cat-study);
  white-space: nowrap;
}
.wr-history-template-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--cat-study);
  white-space: nowrap;
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.wr-history-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.wr-history-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.wr-history-btn {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.25s ease;
}
.wr-history-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--cat-study);
}
.wr-history-btn.wr-history-delete:hover {
  background: rgba(255, 77, 109, 0.1);
  border-color: rgba(255, 77, 109, 0.3);
  color: var(--accent-rose);
}

/* ------------------------------------------------------------
   6. Responsive
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
  .wr-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .wr-preview-body {
    max-height: 400px;
  }
}

@media (max-width: 768px) {
  .wr-form-panel {
    padding: 20px;
  }
  .wr-preview-body {
    padding: 18px;
    font-size: 13px;
    max-height: 350px;
  }
  .wr-template-tab {
    padding: 8px 16px;
    font-size: 13px;
    gap: 4px;
  }
  .wr-history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .wr-history-preview {
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .wr-template-tabs {
    gap: 6px;
  }
  .wr-template-tab {
    padding: 7px 14px;
    font-size: 12px;
  }
  .wr-date-row {
    flex-direction: column;
    gap: 8px;
  }
  .wr-date-sep {
    display: none;
  }
  .wr-action-row {
    flex-direction: column;
    gap: 8px;
  }
  .wr-action-row .btn-primary,
  .wr-action-row .btn-sm,
  .wr-btn-clear {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .wr-history-meta {
    flex-wrap: wrap;
    gap: 8px;
  }
}
