/* ============================================
   Prompt Generator — tool styles
============================================ */

#pg-app { font-family: var(--font-main); }

/* ---- Layout ---- */
.pg-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
  /* Prevent sidebar from causing layout shifts */
  grid-auto-rows: auto;
}

@media (max-width: 860px) {
  .pg-layout { grid-template-columns: 1fr; }
}

/* ---- Sidebar ---- */
.pg-sidebar {
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: var(--radius-md);
  overflow: hidden;
  /* Sticky but anchored to its own grid row height — no jump */
  position: sticky;
  top: 24px;
  /* Cap height and scroll internally so it never pushes layout */
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.pg-sidebar-search {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.pg-cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pg-cat-btn {
  padding: 4px 11px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 20px;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.15s;
  line-height: 1.4;
}

.pg-cat-btn:hover { color: var(--primary); border-color: var(--primary); }
.pg-cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pg-template-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 6px 8px 10px;
  flex: 1;
  min-height: 0;
}

.pg-template-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-main);
  transition: background 0.15s;
  width: 100%;
  flex-shrink: 0;
}

.pg-template-item:hover { background: var(--bg-body); }

.pg-template-item.active {
  background: var(--primary);
}
.pg-template-item.active .pg-tpl-name { color: #fff; }
.pg-template-item.active .pg-tpl-desc { color: rgba(255,255,255,0.65); }

.pg-tpl-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  border-radius: 6px;
}

.pg-template-item.active .pg-tpl-icon {
  background: rgba(255,255,255,0.15);
}

.pg-tpl-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.pg-tpl-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pg-tpl-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Main area ---- */
.pg-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Fields card ---- */
.pg-fields-card {
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: var(--radius-md);
  overflow: hidden;
  /* Fixed min-height so the card doesn't collapse/expand when switching templates */
  min-height: 180px;
}

.pg-fields-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: var(--bg-body);
}

.pg-fields-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.pg-clear-btn {
  padding: 4px 12px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 20px;
  background: transparent;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.15s;
}

.pg-clear-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pg-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px;
}

.pg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pg-field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pg-field-input {
  padding: 9px 12px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-main);
  color: var(--text-main);
  background: var(--bg-body);
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.pg-field-input:focus {
  outline: none;
  border-color: var(--primary);
}

.pg-field--full {
  grid-column: 1 / -1;
}

.pg-field-textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
  font-family: var(--font-main);
}

/* ---- Output card ---- */
.pg-output-card {
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pg-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: var(--bg-body);
  gap: 12px;
  flex-wrap: wrap;
}

.pg-output-title {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text-main);
}

.pg-output-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pg-char-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pg-copy-btn {
  padding: 8px 18px;
  background: var(--gradient-main);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-main);
  transition: opacity 0.2s;
  white-space: nowrap;
}

.pg-copy-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.pg-copy-btn:not(:disabled):hover { opacity: 0.85; }
.pg-copy-btn.copied { background: #059669; }

.pg-output-text {
  width: 100%;
  min-height: 280px;
  padding: 20px;
  border: none;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-main);
  background: #fafafa;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
}

/* ---- AI enhancement banner ---- */
.pg-ai-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--bg-body);
  border-top: 1px solid rgba(0,0,0,0.06);
}

.pg-ai-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.pg-ai-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.pg-ai-text strong {
  font-size: 0.88rem;
  color: var(--text-main);
}

.pg-ai-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pg-coming-soon-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
