/* Citation Generator — tool.css */

/* ===== SELECTORS ROW ===== */
.cg-selectors {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.cg-selectors select {
  width: 100%;
}

/* ===== FORM SECTIONS ===== */
.cg-form .form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.cg-form .section-title {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Author row */
.cg-author-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: flex-end;
}
.cg-author-row .input-group {
  flex: 1;
  min-width: 0;
}
.cg-author-row input {
  width: 100%;
}
.cg-author-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--red);
  cursor: pointer;
  padding: 8px 10px;
  font-size: .88rem;
  line-height: 1;
  flex-shrink: 0;
  align-self: flex-end;
  min-height: 38px;
  display: flex;
  align-items: center;
}
.cg-author-remove:hover {
  background: rgba(239, 68, 68, .1);
  border-color: var(--red);
}

/* Dynamic fields grid */
.cg-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cg-fields-grid .input-group input,
.cg-fields-grid .input-group select {
  width: 100%;
}
.cg-field-full {
  grid-column: 1 / -1;
}

/* ===== ACTIONS ===== */
.cg-actions {
  margin-bottom: 20px;
}

/* ===== OUTPUT ===== */
.cg-output {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.cg-output .section-title {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.cg-citation-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  font-size: .92rem;
  line-height: 1.7;
  word-break: break-word;
  /* Hanging indent for all styles */
  padding-left: 40px;
  text-indent: -24px;
}
.cg-citation-box em {
  font-style: italic;
}
.cg-output-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ===== IN-TEXT CITATION ===== */
.cg-intext {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.cg-intext h4 {
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-dim);
}
.cg-intext-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.cg-intext-item {
  flex: 1;
  min-width: 180px;
}
.cg-intext-label {
  display: block;
  font-size: .78rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 500;
}
.cg-intext-item code {
  display: block;
  padding: 8px 12px;
  font-size: .85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s;
  border: 1px solid var(--border);
}
.cg-intext-item code:hover {
  border-color: var(--primary);
}

/* ===== BIBLIOGRAPHY ===== */
.cg-bibliography {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.cg-bib-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.cg-bib-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cg-bib-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: bib-counter;
}
.cg-bib-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  background: var(--bg-input);
  counter-increment: bib-counter;
}
.cg-bib-entry::before {
  content: counter(bib-counter) ".";
  font-weight: 600;
  color: var(--text-dim);
  flex-shrink: 0;
  padding-top: 1px;
  min-width: 22px;
}
.cg-bib-text {
  flex: 1;
  font-size: .88rem;
  line-height: 1.6;
  word-break: break-word;
  /* Hanging indent within bib entry */
  padding-left: 24px;
  text-indent: -24px;
}
.cg-bib-text em {
  font-style: italic;
}
.cg-bib-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}
.cg-bib-remove:hover {
  color: var(--red);
  background: rgba(239, 68, 68, .1);
}

/* ===== FAQ ===== */
.faq { margin-top: 32px; }
.faq h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 12px; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.faq-item summary {
  padding: 14px 16px;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  display: inline-block;
  width: 20px;
  font-weight: 700;
  color: var(--primary);
}
.faq-item[open] summary::before { content: "−"; }
.faq-item p {
  padding: 0 16px 14px 36px;
  font-size: .9rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .cg-selectors {
    flex-direction: column;
  }
  .cg-fields-grid {
    grid-template-columns: 1fr;
  }
  .cg-author-row {
    flex-wrap: wrap;
  }
  .cg-author-row .input-group {
    min-width: calc(50% - 20px);
  }
  .cg-bib-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .cg-intext-row {
    flex-direction: column;
  }
  .cg-output-actions {
    flex-direction: column;
  }
  .cg-output-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 480px) {
  .cg-author-row .input-group {
    min-width: 100%;
  }
}
