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

/* -------------------------------------------------------------------
 * Brand tokens. Amber for AI Idea Generator - "ideas, spark, lightbulb".
 * Distinct from existing palette: AGC blue / SCC green / SR indigo /
 * ATG teal / AISUM orange / TLC/DG red / RDC violet / PG forest-green /
 * HG fuchsia / CG sky-blue.
 * ------------------------------------------------------------------- */
:root {
    --aig-brand:      #d97706;
    --aig-brand-fade: #b45309;
    --aig-brand-tint: #fef3c7;

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

/* -------------------------------------------------------------------
 * Mode toggle - 2 tabs (topic / url). Shared CSS hardcodes the pill
 * slide for data-mode="bulk"; we override for our 2 tabs and add the
 * `flex: 1 1 0` rule per [[mode-toggle-pill-data-mode]] so labels
 * share width equally.
 * ------------------------------------------------------------------- */
.aig-mode-toggle { margin-bottom: 14px; }
.aig-mode-toggle::before {
    width: calc(50% - 6px) !important;
}
.aig-mode-toggle[data-mode="topic"]::before { transform: translateX(0%) !important; }
.aig-mode-toggle[data-mode="url"]::before   { transform: translateX(100%) !important; }
.aig-mode-toggle .mode-btn {
    flex: 1 1 0;
    text-align: center;
    min-width: 0;
}

/* -------------------------------------------------------------------
 * Form card
 * ------------------------------------------------------------------- */
.tool-form-card#aig-form-card {
    padding-top: 18px;
    padding-bottom: 14px;
}
.aig-field-row {
    margin-bottom: 12px;
}
.aig-field-label {
    display: block;
    font-weight: 600;
    color: var(--ink-800);
    margin-bottom: 4px;
    font-size: 0.88rem;
}
.aig-field-label .aig-optional {
    font-weight: 400;
    color: var(--ink-500);
    font-size: 0.85em;
    margin-left: 4px;
}
.aig-input-counter {
    font-size: 0.75rem;
    color: var(--ink-500);
    float: right;
    margin-top: 4px;
}
.aig-input-counter.is-warning { color: #d97706; }
.aig-input-counter.is-danger  { color: #dc2626; }

/* Per [[text-input-flex-basis-height]]. */
.aig-field-row .text-input,
.aig-field-row textarea,
.aig-field-row select,
.aig-option-cell .text-input,
.aig-option-cell select,
.aig-input-text,
.aig-input-line {
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
}
.aig-input-text {
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}
#aig-form-card[data-mode="url"] .aig-input-text {
    min-height: 48px;
}

/* Two-column options strip */
.aig-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;
}
.aig-option-cell {
    flex: 1 1 240px;
    min-width: 0;
}
.aig-option-cell-wide {
    flex: 1 1 100%;
}
.aig-select {
    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;
}
.aig-select:focus {
    outline: none;
    border-color: var(--aig-brand);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

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

/* -------------------------------------------------------------------
 * Idea-type checkbox grid
 * ------------------------------------------------------------------- */
.aig-types-picker {
    border: 0;
    margin: 0 0 12px 0;
    padding: 0;
}
.aig-types-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.aig-type-pill {
    display: inline-flex;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    font-size: 0.85rem;
    color: var(--ink-700);
}
.aig-type-pill:hover {
    border-color: var(--aig-brand);
    background: var(--aig-brand-tint);
}
.aig-type-pill input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0; height: 0;
}
.aig-type-pill.is-selected {
    background: var(--aig-brand);
    border-color: var(--aig-brand);
    color: #fff;
}
.aig-type-pill.is-selected:hover { background: var(--aig-brand-fade); }
.aig-type-pill-label { line-height: 1.15; }

.aig-submit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.aig-submit-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--ink-500);
    line-height: 1.4;
}

/* -------------------------------------------------------------------
 * Quota chip [hidden] override.
 * ------------------------------------------------------------------- */
.quota-chip[hidden] { display: none; }

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

/* -------------------------------------------------------------------
 * Results region.
 * Per [[results-region-card-stack-inner-padding]].
 * ------------------------------------------------------------------- */
.results-region#aig-results .results-header {
    align-items: center;
}
.results-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.aig-sort-label {
    font-size: 0.75rem;
    color: var(--ink-500);
    margin-right: 6px;
}
.aig-sort-btn {
    background: var(--ink-50);
    border: 1px solid var(--ink-200);
    color: var(--ink-700);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.aig-sort-btn:hover {
    border-color: var(--aig-brand);
    color: var(--aig-brand);
}
.aig-sort-btn.is-active {
    background: var(--aig-brand);
    border-color: var(--aig-brand);
    color: #fff;
}

.aig-results-body {
    padding: 18px 22px 4px 22px;
}
.aig-results-body > *:last-child { margin-bottom: 18px; }

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

/* -------------------------------------------------------------------
 * Idea card stack
 * ------------------------------------------------------------------- */
.aig-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}
.aig-card {
    background: linear-gradient(180deg, var(--aig-brand-tint, #fef3c7) 0%, #ffffff 100%);
    border: 1.5px solid var(--aig-brand);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.12);
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 6px 14px;
    animation: aig-card-appear 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.aig-card:hover {
    border-color: var(--aig-brand);
    box-shadow: 0 6px 18px rgba(217, 119, 6, 0.18);
    transform: translateY(-1px);
}
.aig-card.is-regenerating { opacity: 0.55; pointer-events: none; }
@keyframes aig-card-appear {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.aig-card-main {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.aig-card-title {
    font-size: 1.06rem;
    font-weight: 600;
    color: var(--ink-900);
    line-height: 1.3;
    margin: 0;
}
.aig-card-description {
    font-size: 0.85rem;
    color: var(--ink-600);
    line-height: 1.5;
    margin: 0;
}

.aig-card-actions {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}
.aig-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--ink-50);
    border: 1px solid var(--ink-200);
    color: var(--ink-700);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    padding: 0;
}
.aig-icon-btn:hover {
    background: var(--aig-brand-tint);
    border-color: var(--aig-brand);
    color: var(--aig-brand);
}
.aig-icon-btn svg { width: 14px; height: 14px; }
.aig-icon-btn.is-busy { pointer-events: none; opacity: 0.5; }
.aig-icon-btn.is-copied {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

/* Meta row: idea type badge + target keyword + volume tier badge */
.aig-card-meta {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 0.78rem;
    color: var(--ink-600);
}
.aig-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--aig-brand-fade);
    background: var(--aig-brand-tint);
    border: 1px solid #fcd34d;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
}
.aig-keyword-cell {
    font-family: inherit;
    color: var(--ink-800);
}
.aig-keyword-cell .cell-xlink {
    color: var(--ink-800);
    text-decoration: underline dotted;
    text-underline-offset: 2px;
    cursor: pointer;
}
.aig-keyword-cell .cell-xlink:hover {
    color: var(--aig-brand);
    text-decoration-style: solid;
}
.aig-volume-tier {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.aig-volume-tier.is-high {
    color: #15803d;
    background: #dcfce7;
    border: 1px solid #86efac;
}
.aig-volume-tier.is-medium {
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}
.aig-volume-tier.is-low {
    color: #b91c1c;
    background: #fee2e2;
    border: 1px solid #fca5a5;
}
.aig-volume-tier.is-no_data {
    color: var(--ink-600);
    background: var(--ink-100);
    border: 1px solid var(--ink-200);
}

/* KE-data row */
.aig-card-kedata {
    grid-column: 1 / 3;
    grid-row: 3 / 4;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px 14px;
    padding-top: 8px;
    border-top: 1px dashed var(--ink-100);
    font-size: 0.78rem;
}
.aig-ke-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.aig-ke-stat-label {
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-500);
    font-weight: 700;
}
.aig-ke-stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-900);
    line-height: 1.1;
}
.aig-ke-stat-value.is-muted { color: var(--ink-400); font-weight: 400; }
.aig-ke-stat-value.is-tabular { font-variant-numeric: tabular-nums; }
.aig-ke-trend {
    grid-column: 4 / 5;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.aig-ke-trend svg {
    display: block;
    width: 100%;
    height: 28px;
    overflow: visible;
}

@media (max-width: 640px) {
    .aig-card-kedata {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Honest framing block */
.aig-caveat {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--ink-50);
    border: 1px solid var(--ink-100);
    border-radius: 8px;
    font-size: 0.825rem;
    color: var(--ink-700);
    line-height: 1.55;
}
.aig-caveat summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-800);
    margin-bottom: 6px;
}
.aig-caveat p { margin: 6px 0 0 0; }

/* -------------------------------------------------------------------
 * Marketing banner / upgrade pitch
 * ------------------------------------------------------------------- */
.marketing-banner#aig-upgrade-banner {
    margin-top: 18px;
    padding: 16px 20px;
    background: var(--aig-brand-tint);
    border: 1px solid var(--aig-brand);
    border-radius: 10px;
    color: var(--ink-800);
}
.marketing-banner-title {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    color: var(--ink-900);
}
.marketing-banner-body {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--ink-700);
}
.marketing-banner-btn { display: inline-block; }
