/* Citation Generator - tool-specific styles. */

:root {
    --cg-accent: #4f46e5;
    --cg-accent-dark: #4338ca;
    --cg-accent-tint: #eef2ff;
}

.page-hero h1 .cg-hero-mark {
    width: 1em;
    height: 1em;
    vertical-align: -0.1em;
    margin-right: 0.4rem;
    color: var(--cg-accent);
}

.cg-field-label { display: block; font-weight: 600; font-size: 0.88rem; color: #333; margin-bottom: 5px; }
.cg-optional { color: #94a3b8; font-weight: 400; font-size: 0.82em; }

/* ---- URL auto-fill ---- */
.cg-url-controls { display: flex; gap: 8px; }
.cg-url-controls .text-input { flex: 1 1 auto; width: 100%; box-sizing: border-box; }
.cg-url-controls .primary-btn { flex: 0 0 auto; white-space: nowrap; }
.cg-url-hint { display: block; margin-top: 6px; font-size: 0.8rem; color: #94a3b8; }

.cg-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #b6bcc6;
    font-size: 0.8rem;
    margin: 18px 0 4px;
    gap: 12px;
}
.cg-divider::before, .cg-divider::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: #e6e8eb;
}

/* ---- Controls + dynamic fields ---- */
.cg-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 14px 0 4px;
}
.cg-select {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 0.92rem;
    padding: 9px 30px 9px 12px;
    border: 1px solid #d7dbe0;
    border-radius: 8px;
    background-color: #fff;
    color: #1f2937;
    cursor: pointer;
}
.cg-select:focus { outline: 2px solid var(--cg-accent); border-color: var(--cg-accent); }

.cg-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 14px;
}
.cg-field { min-width: 0; display: flex; flex-direction: column; }
.cg-field--wide { grid-column: 1 / -1; }
/* flex: 0 0 auto neutralises the shared .text-input { flex: 1 1 320px },
 * whose 320px flex-basis would otherwise become a 320px HEIGHT inside this
 * column-flex field (making single-line inputs look like big textareas). */
.cg-input { width: 100%; box-sizing: border-box; flex: 0 0 auto; }
textarea.cg-input { resize: vertical; line-height: 1.5; }
.cg-fields .cg-select { width: 100%; }
.cg-field-help { margin-top: 4px; font-size: 0.76rem; color: #94a3b8; }

/* ---- Output ---- */
.cg-results-body { padding: 16px 22px 18px; }
.cg-results-sub { color: #64748b; font-size: 0.85rem; }
.cg-out-block { margin-bottom: 16px; }
.cg-out-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.cg-out-label { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--cg-accent-dark); }
.cg-ref {
    background: #fafbff;
    border: 1px solid #e6e8eb;
    border-radius: 8px;
    padding: 14px 16px;
    line-height: 1.7;
    color: #1f2937;
    font-size: 0.98rem;
    /* Hanging indent, the academic convention for reference lists. */
    padding-left: 38px;
    text-indent: -22px;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.cg-ref i { font-style: italic; }
.cg-intext {
    background: #fafbff;
    border: 1px solid #e6e8eb;
    border-radius: 8px;
    padding: 10px 14px;
    color: #1f2937;
    font-size: 0.95rem;
}
.cg-empty { color: #b6bcc6; }
.cg-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; }
.cg-add-hint { font-size: 0.82rem; color: #94a3b8; }

/* ---- Bibliography ---- */
.cg-biblio { margin-top: 22px; }
.cg-biblio-list { list-style: decimal; margin: 0; padding: 14px 22px 18px 44px; }
.cg-biblio-item {
    position: relative;
    line-height: 1.65;
    color: #1f2937;
    padding: 8px 30px 8px 0;
    border-bottom: 1px solid #f1f5f9;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.cg-biblio-item:last-child { border-bottom: 0; }
.cg-biblio-text i { font-style: italic; }
.cg-biblio-remove {
    position: absolute;
    top: 6px;
    right: 0;
    border: 0;
    background: transparent;
    color: #b6bcc6;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
}
.cg-biblio-remove:hover { color: #dc2626; }

@media (max-width: 640px) {
    .cg-controls { grid-template-columns: 1fr; }
    .cg-fields { grid-template-columns: 1fr; }
    .cg-url-controls { flex-direction: column; }
    .cg-url-controls .primary-btn { width: 100%; }
}
