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

/* -------------------------------------------------------------------
 * Brand tokens. Purple-500 (#a855f7), the Instagram-family color for
 * the Bio Generator (Bio = purple, Name = pink, Caption = yellow).
 * Distinct from SR indigo-600 / RDC violet-600.
 * ------------------------------------------------------------------- */
:root {
    --ibg-brand:      #a855f7;
    --ibg-brand-fade: #9333ea;
    --ibg-brand-tint: #f5ecfe;

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

    /* Instagram link blue used in the profile mock. */
    --ibg-ig-blue: #00376b;
}

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

/* Per [[text-input-flex-basis-height]]: shared .text-input
 * `flex: 1 1 320px` collapses to a 320px HEIGHT inside column-flex and
 * to a narrow default inside block parents. Force full width here. */
.ibg-field-row .text-input,
.ibg-niche-input,
.ibg-input-line {
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
}
.ibg-niche-input {
    min-height: 58px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* -------------------------------------------------------------------
 * Goal-chip picker (4-col desktop, 2-col mobile)
 * ------------------------------------------------------------------- */
.ibg-goal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.ibg-goal-chip {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
    padding: 9px 11px;
    background: #fff;
    border: 1.5px solid var(--ink-200);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
    font: inherit;
    color: var(--ink-800);
}
.ibg-goal-chip:hover {
    border-color: var(--ibg-brand);
    background: var(--ibg-brand-tint);
}
.ibg-goal-chip:focus-visible {
    outline: none;
    border-color: var(--ibg-brand);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18);
}
.ibg-goal-chip.is-selected {
    border-color: var(--ibg-brand);
    background: var(--ibg-brand-tint);
    box-shadow: 0 0 0 1px var(--ibg-brand) inset;
}
.ibg-goal-chip-label {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--ink-900);
}
.ibg-goal-chip-desc {
    font-size: 0.7rem;
    color: var(--ink-500);
    line-height: 1.35;
}

/* -------------------------------------------------------------------
 * Two-column options strip (brand + link)
 * ------------------------------------------------------------------- */
.ibg-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: 14px;
}
.ibg-option-cell {
    flex: 1 1 240px;
    min-width: 0;
}
.ibg-option-cell .text-input {
    width: 100%;
    box-sizing: border-box;
}
.ibg-link-error {
    margin: 6px 0 0 0;
    font-size: 0.75rem;
    color: #dc2626;
    line-height: 1.4;
}
.ibg-link-error[hidden] { display: none; }

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

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

/* -------------------------------------------------------------------
 * Results region. Shared .results-region has no inner padding, so we
 * add per-tool padding for the card-stack content here
 * (per [[results-region-card-stack-inner-padding]]).
 * ------------------------------------------------------------------- */
.ibg-results-body {
    padding: 18px 22px 4px 22px;
}
.ibg-results-body > *:last-child { margin-bottom: 18px; }

/* Bio card stack - vertical, one card per style */
.ibg-bio-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}
.ibg-bio-card {
    background: linear-gradient(180deg, var(--ibg-brand-tint, #f5ecfe) 0%, #ffffff 60%);
    border: 1.5px solid var(--ibg-brand);
    border-radius: 14px;
    padding: 16px 18px 18px 18px;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 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: ibg-card-appear 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ibg-bio-card:hover {
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.18);
    transform: translateY(-1px);
}
.ibg-bio-card.is-regenerating { opacity: 0.55; pointer-events: none; }
@keyframes ibg-card-appear {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.ibg-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.ibg-card-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Style badge */
.ibg-style-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: var(--ibg-brand);
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* 150-char meter */
.ibg-char-counter {
    font-size: 0.75rem;
    font-weight: 600;
}
.ibg-char-counter.is-good   { color: #15803d; }
.ibg-char-counter.is-warn   { color: #b45309; }
.ibg-char-counter.is-danger { color: #dc2626; }
.ibg-char-counter-budget { color: var(--ink-500); font-weight: 400; }

/* Per-card actions: Copy + Regenerate */
.ibg-card-header-actions {
    display: flex;
    gap: 6px;
}
.ibg-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;
}
.ibg-icon-btn:hover {
    background: var(--ibg-brand-tint);
    border-color: var(--ibg-brand);
    color: var(--ibg-brand-fade);
}
.ibg-icon-btn svg { width: 14px; height: 14px; }
.ibg-icon-btn.is-busy { pointer-events: none; opacity: 0.5; }
.ibg-icon-btn.is-copied {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

/* -------------------------------------------------------------------
 * Live Instagram profile mock
 * ------------------------------------------------------------------- */
.ibg-profile-mock {
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 12px;
    padding: 16px 16px 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.ibg-mock-top {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.ibg-mock-avatar {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    /* Instagram gradient ring around a neutral disc. */
    background:
        radial-gradient(circle at center, #efefef 0 56%, transparent 57%),
        conic-gradient(from 30deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-400);
}
.ibg-mock-avatar svg { width: 30px; height: 30px; }
.ibg-mock-stats {
    display: flex;
    gap: 18px;
    padding-top: 8px;
    flex-wrap: wrap;
}
.ibg-mock-stat {
    text-align: center;
    line-height: 1.2;
}
.ibg-mock-stat b {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink-900);
}
.ibg-mock-stat span {
    font-size: 0.72rem;
    color: var(--ink-600);
}
.ibg-mock-body {
    margin-top: 10px;
}
.ibg-mock-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #262626;
    margin-bottom: 2px;
}
/* The bio text. white-space: pre-wrap preserves the model's \n line
 * breaks exactly as Instagram does. */
.ibg-mock-bio {
    font-size: 0.875rem;
    line-height: 1.45;
    color: #262626;
    white-space: pre-wrap;
    word-break: break-word;
}
.ibg-mock-bio.is-over .ibg-mock-truncation { color: #dc2626; }
.ibg-mock-truncation {
    color: var(--ink-500);
    font-weight: 600;
}
.ibg-mock-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ibg-ig-blue);
    word-break: break-all;
}
.ibg-mock-link svg {
    width: 12px;
    height: 12px;
    vertical-align: -1px;
    margin-right: 3px;
}
/* Mock chrome: a faux "Edit profile" button row to read as IG. */
.ibg-mock-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.ibg-mock-btn {
    flex: 1 1 auto;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: #262626;
    background: #efefef;
    border-radius: 8px;
    padding: 6px 0;
}

/* -------------------------------------------------------------------
 * Editable section breakdown (collapsible)
 * ------------------------------------------------------------------- */
.ibg-breakdown {
    border: 1px solid var(--ink-100);
    border-radius: 10px;
    background: var(--ink-50);
    overflow: hidden;
}
.ibg-breakdown > summary {
    cursor: pointer;
    list-style: none;
    padding: 9px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-700);
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.ibg-breakdown > summary::-webkit-details-marker { display: none; }
.ibg-breakdown > summary::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--ink-500);
    border-bottom: 2px solid var(--ink-500);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    display: inline-block;
}
.ibg-breakdown[open] > summary::before {
    transform: rotate(45deg);
}
.ibg-breakdown-body {
    padding: 4px 14px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ibg-section-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.ibg-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ibg-brand-fade);
}
.ibg-section-input {
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
    border: 1px solid var(--ink-200);
    border-radius: 8px;
    padding: 7px 10px;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--ink-900);
    background: #fff;
    resize: vertical;
    min-height: 36px;
    white-space: pre-wrap;
}
.ibg-section-input:focus {
    outline: none;
    border-color: var(--ibg-brand);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.10);
}
.ibg-section-hint {
    font-size: 0.72rem;
    color: var(--ink-500);
    line-height: 1.4;
    margin: 2px 0 0 0;
}

/* -------------------------------------------------------------------
 * Honest framing block
 * ------------------------------------------------------------------- */
.ibg-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;
}
.ibg-caveat summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-800);
    margin-bottom: 6px;
}
.ibg-caveat p {
    margin: 6px 0 0 0;
}

/* -------------------------------------------------------------------
 * Mobile
 * ------------------------------------------------------------------- */
@media (max-width: 640px) {
    .ibg-goal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ibg-results-body {
        padding: 14px 14px 4px 14px;
    }
    .ibg-mock-top {
        gap: 12px;
    }
    .ibg-mock-stats {
        gap: 12px;
    }
}
