/* Chip compacto estilo Claude/ChatGPT: solo preview o ícono; el nombre vive
   en el title (hover) y la × flota en la esquina del chip. */
.ai-attachment-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 56px;
    height: 56px;
    background: var(--ai-soft);
    border: 1px solid color-mix(in srgb, var(--ai-line) 80%, transparent);
    border-radius: 12px;
    font-size: 13px;
    color: var(--ai-ink);
    overflow: visible;
}
.ai-attachment-chip > i {
    font-size: 20px;
    color: var(--ai-main);
}
.ai-attachment-ext {
    position: absolute;
    bottom: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--ai-muted);
}
.ai-attachment-thumb {
    width: 100%;
    height: 100%;
    border-radius: 11px;
    object-fit: cover;
    background: color-mix(in srgb, var(--ai-ink) 8%, transparent);
}
.ai-attachment-chip button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ai-panel);
    border: 1px solid var(--ai-line);
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    color: var(--ai-muted);
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.ai-attachment-chip button:hover {
    color: #fff;
    background: var(--ai-danger);
    border-color: var(--ai-danger);
}
.ai-icon-btn {
    border: 1px solid var(--ai-line);
    background: var(--ai-panel);
    color: var(--ai-ink);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ai-credit-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--ai-line);
    border-radius: 999px;
    padding: 8px 14px;
    background: var(--ai-panel);
    font-size: 12px;
    color: var(--ai-muted);
}
.ai-credit-pill b {
    color: var(--ai-main-dark);
}
/* Outer button that wraps avatar + caret */
.ai-avatar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 999px;
}
.ai-avatar-btn:focus-visible {
    outline: 2px solid var(--ai-main);
    outline-offset: 2px;
}
.ai-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: var(--ai-main);
    color: #fff;
    font-weight: 800;
    padding: 0;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ai-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    object-fit: cover;
    display: block;
}
.ai-avatar-caret {
    font-size: 11px;
    color: var(--ai-muted);
    transition: transform 0.2s ease;
    line-height: 1;
}
.ai-kicker {
    display: inline-block;
    color: var(--ai-main);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 800;
    margin-bottom: 8px;
}
.ai-btn {
    border: 1px solid var(--ai-line);
    border-radius: 8px;
    padding: 12px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
    cursor: pointer;
}
.ai-btn-primary {
    background: var(--ai-main);
    color: #fff;
    border-color: var(--ai-main);
}
.ai-btn-soft {
    background: var(--ai-soft);
    color: var(--ai-ink);
}
.ai-btn-danger {
    background: color-mix(in srgb, var(--ai-danger) 12%, transparent);
    color: var(--ai-danger);
    border-color: color-mix(in srgb, var(--ai-danger) 35%, transparent);
}
.ai-btn.full {
    width: 100%;
}
.ai-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ai-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--ai-soft);
    color: var(--ai-ink);
    font-size: 12px;
    font-weight: 800;
}
.ai-pill.good {
    background: color-mix(in srgb, var(--ai-good) 14%, transparent);
    color: var(--ai-good);
}
.ai-url {
    font-weight: 800;
    background: var(--ai-soft);
    padding: 12px;
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .ai-credit-pill {
        display: none;
    }
    .ai-icon-btn {
        width: 38px;
        height: 38px;
        border-radius: 8px;
        flex-shrink: 0;
    }
    .ai-avatar {
        width: 36px;
        height: 36px;
    }
    .ai-avatar-caret {
        display: none;
    }
    .ai-url {
        max-width: 100%;
        overflow: visible;
        overflow-wrap: anywhere;
        text-overflow: clip;
        word-break: break-word;
    }
    .ai-btn {
        min-width: 0;
        white-space: normal;
        text-align: center;
    }
    .ai-pill {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

.ai-input {
    width: 100%;
    border: 1px solid var(--ai-line);
    border-radius: 8px;
    background: var(--ai-panel);
    color: var(--ai-ink);
    padding: 12px 14px;
    outline: 0;
}
textarea.ai-input {
    min-height: 110px;
    resize: vertical;
}
/* Dark-theme spinners for plain number inputs (not stepper) */
input[type="number"].ai-input {
    color-scheme: dark;
}

/* ── x-atoms.number-input stepper ──────────────────────────────────────────── */
/* Reuses .ai-pages-stepper / .ai-pages-btn from organisms.css for the pill.    */

/* Buttons always show a dim circle so they're discoverable at rest,
   and light up solid blue only for the ONE button under the cursor.
   Scoped to .ai-num-stepper — does NOT affect the Career Forge pages stepper. */
.ai-num-stepper .ai-pages-btn {
    background: color-mix(in srgb, var(--ai-main) 12%, transparent);
    color: var(--ai-muted);
    outline: none;
}
.ai-num-stepper .ai-pages-btn:hover {
    background: var(--ai-main);
    color: #fff;
}
.ai-num-stepper .ai-pages-btn:active {
    background: color-mix(in srgb, var(--ai-main) 78%, #000);
    color: #fff;
}
.ai-num-stepper .ai-pages-btn:focus-visible {
    outline: 2px solid var(--ai-main);
    outline-offset: 1px;
}

.ai-num-stepper-center {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 6px;
}
.ai-num-stepper-prefix {
    font-size: 12.5px;
    color: var(--ai-muted);
    line-height: 1;
}
.ai-num-stepper-input {
    border: 0;
    background: transparent;
    color: var(--ai-ink);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    min-width: 2ch;
    outline: none;
    color-scheme: dark;
    -moz-appearance: textfield;
}
.ai-num-stepper-input::-webkit-inner-spin-button,
.ai-num-stepper-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.ai-num-stepper-input:focus {
    color: var(--ai-main);
}
.ai-select {
    margin-bottom: 12px;
}

/* Search input with embedded icon */
.ai-search-input {
    position: relative;
}
.ai-search-input .ai-input {
    padding-right: 2.5rem;
}
.ai-search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--ai-muted);
    font-size: 0.95rem;
}

/* Inline spinner for buttons in a loading state (composer Save/Send, etc). */
.ai-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: ai-spin 0.7s linear infinite;
}
button[data-ai-loading="true"] {
    cursor: progress;
    opacity: 0.85;
}

/* ── Pre-execute cost badge under the composer ──────────────────── */
.ai-cost-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin: 8px 0 6px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--ai-line);
    background: color-mix(in srgb, var(--ai-main) 6%, transparent);
    color: var(--ai-ink);
}
.ai-cost-badge.is-warn {
    border-color: var(--ai-warn);
    background: color-mix(in srgb, var(--ai-warn) 8%, transparent);
    color: var(--ai-warn);
}
.ai-cost-badge.is-error {
    border-color: var(--ai-danger);
    background: color-mix(in srgb, var(--ai-danger) 8%, transparent);
    color: var(--ai-danger);
}
.ai-cost-badge.is-ok {
    border-color: var(--ai-good);
    background: color-mix(in srgb, var(--ai-good) 8%, transparent);
    color: var(--ai-good);
}
.ai-cost-badge i {
    font-size: 14px;
}
.ai-cost-badge strong {
    color: inherit;
}
.ai-btn.is-disabled,
.ai-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Form success message (atoms/form-success) — green confirmation line shown
   after a successful submit. Previously an unstyled <p class="ai-form-success">. */
.ai-form-success {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.75rem 0 0;
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--ai-good) 40%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--ai-good) 10%, transparent);
    color: var(--ai-good);
    font-weight: 700;
    font-size: 0.9rem;
}
