/* Paragraph Generator - tool-specific overrides on shared tools.css. */

/* -------------------------------------------------------------------
 * Brand tokens (forest green; differentiates from ATG teal, SR indigo,
 * AISUM orange, AGC blue, DG / TLC red).
 * ------------------------------------------------------------------- */
:root {
    --pg-brand:      #15803d;
    --pg-brand-fade: #166534;
    --pg-brand-tint: #dcfce7;

    /* Drive the shared .tone-pill picker. */
    --tone-brand:      var(--pg-brand);
    --tone-brand-fade: var(--pg-brand-fade);
    --tone-brand-tint: var(--pg-brand-tint);
}

/* -------------------------------------------------------------------
 * Form card.
 * ------------------------------------------------------------------- */
.tool-form-card#pg-form-card {
    padding-top: 18px;
    padding-bottom: 14px;
}

/* Mode toggle: 3 tabs, so override the pill position rules.
 * The shared .mode-toggle::before { transform: translateX(100%) } rule
 * is hardcoded for 2-tab (data-mode="bulk"). We need 3 positions. */
.pg-mode-toggle {
    margin-bottom: 14px;
}
.pg-mode-toggle .mode-btn {
    min-width: 110px;
    text-align: center;
}
.pg-mode-toggle::before {
    width: calc(33.333% - 6px) !important;
}
.pg-mode-toggle[data-mode="topic"]::before {
    transform: translateX(0) !important;
}
.pg-mode-toggle[data-mode="outline"]::before {
    transform: translateX(100%) !important;
}
.pg-mode-toggle[data-mode="continuation"]::before {
    transform: translateX(200%) !important;
}

.pg-field-row {
    margin-bottom: 12px;
}
.pg-field-label {
    display: block;
    font-weight: 600;
    color: var(--ink-800);
    margin-bottom: 4px;
    font-size: 0.88rem;
}
.pg-field-label .pg-optional {
    font-weight: 400;
    color: var(--ink-500);
    font-size: 0.85em;
    margin-left: 4px;
}
.pg-char-count {
    font-size: 0.75rem;
    color: var(--ink-500);
    float: right;
    margin-top: 4px;
}
.pg-char-count.is-warning { color: #d97706; }
.pg-char-count.is-danger  { color: #dc2626; }

/* Shared .text-input { flex: 1 1 320px } gotcha; force full width in a
 * block / column parent. See [[text-input-flex-basis-height]]. */
.pg-field-row .text-input,
.pg-field-row textarea,
.pg-field-row select {
    width: 100%;
    box-sizing: border-box;
}

.pg-input-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}
.pg-input-textarea.is-continuation {
    min-height: 100px;
}

/* Preset + keyword row */
.pg-options {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: var(--ink-50);
    border-radius: 10px;
    border: 1px solid var(--ink-100);
    margin-bottom: 12px;
}
.pg-option-cell { flex: 1 1 240px; min-width: 0; }
.pg-option-cell .text-input,
.pg-option-cell select {
    width: 100%;
    box-sizing: border-box;
}

/* Preset dropdown */
.pg-preset-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--ink-200);
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ink-800);
    background: #fff;
    cursor: pointer;
}
.pg-preset-select:focus {
    outline: none;
    border-color: var(--pg-brand);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}

/* Live KE keyword preview card under the focus keyword input. */
.pg-kw-preview {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--ink-100);
    border-radius: 8px;
    font-size: 0.8125rem;
    color: var(--ink-700);
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
}
.pg-kw-preview.is-loading { opacity: 0.65; }
.pg-kw-preview.is-empty { display: none; }
.pg-kw-preview-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink-500);
    text-transform: uppercase;
}
.pg-kw-stat strong {
    color: var(--ink-900);
    font-weight: 700;
}
.pg-kw-stat-muted {
    color: var(--ink-500);
    font-style: italic;
}

/* Submit row */
.pg-submit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* -------------------------------------------------------------------
 * Quota chip [hidden] override (see [[hidden-attribute-with-flex]]).
 * ------------------------------------------------------------------- */
.quota-chip[hidden] { display: none; }

/* -------------------------------------------------------------------
 * Progress region
 * ------------------------------------------------------------------- */
.progress-region#pg-progress {
    scroll-margin-top: 16px;
}
.pg-progress-bar-track {
    height: 6px;
    background: var(--ink-100);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}
.pg-progress-bar-fill {
    height: 100%;
    background: var(--pg-brand);
    border-radius: 999px;
    transition: width 0.4s ease;
    width: 10%;
}
.pg-whimsy-msg {
    font-size: 0.875rem;
    color: var(--ink-600);
    min-height: 1.4em;
    text-align: center;
}

/* -------------------------------------------------------------------
 * Results region. The shared .results-region has no inner padding (sticky-
 * header dependency); add per-tool padding for the card-stack content.
 * See [[results-region-card-stack-inner-padding]].
 * ------------------------------------------------------------------- */
.pg-results-body {
    padding: 18px 22px 4px 22px;
}
.pg-results-body > *:last-child { margin-bottom: 18px; }

.pg-input-subhead {
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--ink-50);
    border-left: 4px solid var(--pg-brand);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--ink-700);
    line-height: 1.5;
}
.pg-input-subhead-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink-500);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.pg-input-subhead-meta {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--ink-500);
}
.pg-input-subhead-meta strong {
    color: var(--ink-700);
    font-weight: 600;
}

/* Single full-width paragraph card */
.pg-card-host {
    display: block;
}

.pg-variant-card {
    background: linear-gradient(180deg, var(--pg-brand-tint, #dcfce7) 0%, #ffffff 100%);
    border: 1.5px solid var(--pg-brand);
    border-radius: 12px;
    padding: 18px 22px 20px 22px;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.12);
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: pg-card-appear 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.pg-variant-card:hover {
    border-color: var(--pg-brand);
    box-shadow: 0 6px 18px rgba(21, 128, 61, 0.18);
    transform: translateY(-1px);
}
.pg-variant-card.is-regenerating { opacity: 0.55; pointer-events: none; }
@keyframes pg-card-appear {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Card header: structure badge + tone badge + mode badge + actions */
.pg-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.pg-card-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.pg-card-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink-700);
    background: var(--ink-50);
    border: 1px solid var(--ink-200);
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.pg-card-badge.pg-card-badge-structure {
    background: var(--pg-brand-tint);
    border-color: #bbf7d0;
    color: var(--pg-brand-fade);
}
.pg-card-header-actions {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}
.pg-icon-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 4px 10px;
    border: 1px solid var(--ink-200);
    border-radius: 6px;
    background: #fff;
    color: var(--ink-700);
    cursor: pointer;
    transition: all 0.12s ease;
}
.pg-icon-btn:hover {
    background: var(--ink-50);
    border-color: var(--ink-300);
    color: var(--ink-900);
}
.pg-icon-btn.is-loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}
.pg-icon-btn.is-copied {
    background: #dcfce7;
    border-color: #86efac;
    color: var(--pg-brand);
}

.pg-card-textarea {
    flex: 1 1 auto;
    width: 100%;
    box-sizing: border-box;
    min-height: 160px;
    resize: vertical;
    border: 1px solid var(--ink-200);
    border-radius: 8px;
    padding: 12px 14px;
    font: inherit;
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--ink-900);
    background: #fff;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.pg-card-textarea:focus {
    outline: none;
    border-color: var(--pg-brand);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}

/* Card meta line (word count, char count, sentence count, Flesch, keyword pill) */
.pg-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: center;
    font-size: 0.75rem;
    color: var(--ink-500);
}
.pg-meta-item strong {
    color: var(--ink-700);
    font-weight: 600;
}

/* Word-counter color states (against the preset's min/max words) */
.pg-meta-words { transition: color 0.12s ease; }
.pg-meta-words.is-good   { color: var(--pg-brand); font-weight: 600; }
.pg-meta-words.is-short  { color: #b45309; font-weight: 600; }
.pg-meta-words.is-long   { color: #b91c1c; font-weight: 700; }

/* Keyword-match pill */
.pg-kw-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.pg-kw-pill.is-yes {
    background: #dcfce7;
    color: var(--pg-brand);
}
.pg-kw-pill.is-no {
    background: #fee2e2;
    color: #b91c1c;
}

/* -------------------------------------------------------------------
 * Honest framing block (open by default; same idiom SR/ATG/SCC/SMG use)
 * ------------------------------------------------------------------- */
.pg-caveat {
    margin: 14px 22px 18px 22px;
    padding: 10px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #78350f;
    line-height: 1.55;
}
.pg-caveat summary {
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 4px;
}
.pg-caveat p {
    margin: 6px 0 0 0;
}

/* -------------------------------------------------------------------
 * Recent searches: PG-specific tweaks
 * ------------------------------------------------------------------- */
.history-item .pg-history-preset {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--pg-brand-tint);
    color: var(--pg-brand-fade);
    padding: 1px 7px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-right: 6px;
}

/* -------------------------------------------------------------------
 * Responsive tweaks
 * ------------------------------------------------------------------- */
@media (max-width: 680px) {
    .pg-results-body {
        padding: 14px 14px 4px 14px;
    }
    .pg-variant-card {
        padding: 12px 14px 14px 14px;
    }
    .pg-options {
        padding: 8px 10px;
    }
    .pg-caveat {
        margin: 12px 14px 16px 14px;
    }
    .pg-mode-toggle .mode-btn {
        min-width: 0;
    }
}
