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

/* -------------------------------------------------------------------
 * Brand tokens (teal/cyan for ATG, distinct from SR's indigo so the two
 * sister tools read as distinct at a glance).
 * ------------------------------------------------------------------- */
:root {
    --atg-text-brand:      #0d9488;
    --atg-text-brand-fade: #0f766e;
    --atg-text-brand-tint: #ccfbf1;

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

/* -------------------------------------------------------------------
 * Form card. Tightened so the Submit button stays above the fold.
 * ------------------------------------------------------------------- */
.tool-form-card#atg-text-form-card {
    padding-top: 18px;
    padding-bottom: 14px;
}

.atg-text-field-row {
    margin-bottom: 12px;
}
.atg-text-field-label {
    display: block;
    font-weight: 600;
    color: var(--ink-800);
    margin-bottom: 4px;
    font-size: 0.88rem;
}
.atg-text-field-label .atg-text-optional {
    font-weight: 400;
    color: var(--ink-500);
    font-size: 0.85em;
    margin-left: 4px;
}
.atg-text-char-count {
    font-size: 0.75rem;
    color: var(--ink-500);
    float: right;
    margin-top: 4px;
}
.atg-text-char-count.is-warning { color: #d97706; }
.atg-text-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]]. */
.atg-text-field-row .text-input,
.atg-text-field-row textarea,
.atg-text-field-row select {
    width: 100%;
    box-sizing: border-box;
}

.atg-text-input-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* Format + tone row */
.atg-text-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;
}
.atg-text-option-cell { flex: 1 1 220px; min-width: 0; }
.atg-text-option-cell .text-input,
.atg-text-option-cell select {
    width: 100%;
    box-sizing: border-box;
}

/* Format dropdown */
.atg-text-format-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;
}
.atg-text-format-select:focus {
    outline: none;
    border-color: var(--atg-text-brand);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* Live KE keyword preview card under the focus keyword input. */
.atg-text-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;
}
.atg-text-kw-preview.is-loading { opacity: 0.65; }
.atg-text-kw-preview.is-empty { display: none; }
.atg-text-kw-preview-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink-500);
    text-transform: uppercase;
}
.atg-text-kw-stat strong {
    color: var(--ink-900);
    font-weight: 700;
}
.atg-text-kw-stat-muted {
    color: var(--ink-500);
    font-style: italic;
}

/* Submit row */
.atg-text-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#atg-text-progress {
    scroll-margin-top: 16px;
}
.atg-text-progress-bar-track {
    height: 6px;
    background: var(--ink-100);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}
.atg-text-progress-bar-fill {
    height: 100%;
    background: var(--atg-text-brand);
    border-radius: 999px;
    transition: width 0.4s ease;
    width: 10%;
}
.atg-text-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); we add per-tool padding for the card-stack content.
 * See [[results-region-card-stack-inner-padding]].
 * ------------------------------------------------------------------- */
.atg-text-results-body {
    padding: 18px 22px 4px 22px;
}
.atg-text-results-body > *:last-child { margin-bottom: 18px; }

.atg-text-prompt-subhead {
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--ink-50);
    border-left: 4px solid var(--atg-text-brand);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--ink-700);
    line-height: 1.5;
}
.atg-text-prompt-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;
}
.atg-text-prompt-subhead-meta {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--ink-500);
}
.atg-text-prompt-subhead-meta strong {
    color: var(--ink-700);
    font-weight: 600;
}

/* Single full-width variant card. With one output per submission, the
 * card takes the full width of the results region instead of being
 * boxed into a 3-column grid. Per-card Regenerate covers the
 * "I want a different angle" case without re-submitting. */
.atg-text-cards-grid {
    display: block;
}

/* Variant card. Visually emphasized: brand-tinted gradient bg, brand-colored
 * 1.5px border, brand-tinted drop shadow, brief fade-up entry animation.
 * Result cards are the primary thing the user came for. */
.atg-text-variant-card {
    background: linear-gradient(180deg, var(--atg-text-brand-tint, #ccfbf1) 0%, #ffffff 100%);
    border: 1.5px solid var(--atg-text-brand);
    border-radius: 12px;
    padding: 18px 22px 20px 22px;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 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: atg-text-card-appear 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.atg-text-variant-card:hover {
    border-color: var(--atg-text-brand);
    box-shadow: 0 6px 18px rgba(13, 148, 136, 0.18);
    transform: translateY(-1px);
}
.atg-text-variant-card.is-regenerating { opacity: 0.55; pointer-events: none; }
@keyframes atg-text-card-appear {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Card header: variant index + format/tone badges + actions */
.atg-text-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.atg-text-card-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.atg-text-variant-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--atg-text-brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0 6px;
}
.atg-text-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;
}
.atg-text-card-header-actions {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}
.atg-text-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;
}
.atg-text-icon-btn:hover {
    background: var(--ink-50);
    border-color: var(--ink-300);
    color: var(--ink-900);
}
.atg-text-icon-btn.is-loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}
.atg-text-icon-btn.is-copied {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

/* Card textarea (editable). Full-width card means the textarea can
 * comfortably hold paragraph-scale output without scrolling. */
.atg-text-card-textarea {
    flex: 1 1 auto;
    width: 100%;
    box-sizing: border-box;
    min-height: 140px;
    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;
}
.atg-text-card-textarea:focus {
    outline: none;
    border-color: var(--atg-text-brand);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.atg-text-card-textarea.is-outline {
    font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

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

/* Character-counter color states (against the format's min/max/hard_limit) */
.atg-text-meta-chars { transition: color 0.12s ease; }
.atg-text-meta-chars.is-good   { color: #15803d; font-weight: 600; }
.atg-text-meta-chars.is-warn   { color: #b45309; font-weight: 600; }
.atg-text-meta-chars.is-danger { color: #b91c1c; font-weight: 700; }

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

/* -------------------------------------------------------------------
 * Honest framing block (open by default; same idiom SR/SCC/SMG use)
 * ------------------------------------------------------------------- */
.atg-text-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;
}
.atg-text-caveat summary {
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 4px;
}
.atg-text-caveat p {
    margin: 6px 0 0 0;
}

/* -------------------------------------------------------------------
 * Recent searches: ATG-specific tweaks
 * ------------------------------------------------------------------- */
.history-item .atg-text-history-format {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--ink-100);
    color: var(--ink-700);
    padding: 1px 7px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-right: 6px;
}

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