/* =========================================================
   Free tool pages (inc/tools.php): prompt library, earnings calculator
   ========================================================= */

.tool-section {
    margin-top: 8px;
}

.breadcrumbs__current {
    color: var(--c-text);
}

.btn-sm {
    height: 36px;
    gap: 6px;
    padding: 0 14px;
    font-size: var(--fs-sm);
}

/* ---------- Search and filter chips ---------- */

.tool-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 520px;
    height: 48px;
    padding: 0 16px;
    border-radius: var(--r-md);
    background: var(--c-surface);
    box-shadow: inset 0 0 0 1px var(--c-line);
    color: var(--c-text-muted);
    transition: box-shadow var(--ease);
}

.tool-search:focus-within {
    box-shadow: inset 0 0 0 2px var(--c-brand);
}

.tool-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: none;
    font: inherit;
    font-size: var(--fs-md);
    color: var(--c-text);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.chip {
    height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 100px;
    background: var(--c-surface);
    box-shadow: inset 0 0 0 1px var(--c-line);
    font: inherit;
    font-size: var(--fs-sm);
    line-height: 1;
    color: var(--c-text);
    cursor: pointer;
    transition: background-color var(--ease), box-shadow var(--ease), color var(--ease);
}

.chip:hover {
    background: var(--c-surface-hover);
    box-shadow: inset 0 0 0 1px var(--c-line-strong);
}

.chip[aria-pressed="true"] {
    background: var(--c-brand);
    box-shadow: none;
    color: #fff;
}

.chips--quiet .chip {
    height: 30px;
    padding: 0 12px;
    background: none;
    font-size: var(--fs-xs);
}

.chips--quiet .chip[aria-pressed="true"] {
    background: var(--c-text);
    color: var(--c-bg);
}

/* ---------- Prompt library ---------- */

.prompt-library__controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 0 auto 40px;
    max-width: 980px;
}

.prompt-library__count {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--c-text-muted);
}

.prompt-group + .prompt-group {
    margin-top: 48px;
}

.prompt-group__title {
    margin-bottom: 16px;
}

.prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: var(--gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.prompt-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    border-radius: var(--r-lg);
    background: var(--c-surface);
    transition: box-shadow var(--ease);
}

.prompt-card:hover {
    box-shadow: 0 8px 24px var(--c-shadow);
}

.prompt-card__text {
    flex: 1;
    margin: 0;
    font-size: var(--fs-md);
    line-height: var(--lh-normal);
    color: var(--c-text);
}

.prompt-card__meta {
    margin: 0;
    font-size: var(--fs-xs);
    color: var(--c-text-muted);
}

.prompt-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.prompt-library__empty {
    margin: 24px 0 0;
    text-align: center;
    color: var(--c-text-muted);
}

[data-prompt-library] [hidden] {
    display: none;
}

/* ---------- Earnings calculator ---------- */

.calc {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: var(--gap);
    max-width: 1060px;
    margin-inline: auto;
}

.calc__panel {
    padding: 28px;
    border-radius: var(--r-lg);
    background: var(--c-surface);
}

.calc__inputs {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chips--start {
    justify-content: flex-start;
}

.calc-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calc-field__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--c-text);
}

.calc-field__head input,
.calc-field__head select,
.calc-assumptions input {
    width: 110px;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--r-sm);
    background: var(--c-bg);
    box-shadow: inset 0 0 0 1px var(--c-line);
    font: inherit;
    font-size: var(--fs-md);
    font-weight: var(--fw-regular);
    color: var(--c-text);
    text-align: right;
}

.calc-field__head select {
    width: auto;
    max-width: 60%;
    text-align: left;
}

.calc-field input[type="range"] {
    width: 100%;
    accent-color: var(--c-brand);
}

.calc-assumptions summary {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--c-icon);
    cursor: pointer;
}

.calc-assumptions__intro {
    margin: 12px 0 16px;
    font-size: var(--fs-sm);
    line-height: var(--lh-normal);
    color: var(--c-text-muted);
}

.calc-assumptions__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.calc-assumptions__grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: var(--fs-xs);
    color: var(--c-text-muted);
}

.calc-assumptions input {
    width: 100%;
    text-align: left;
}

.calc__result {
    display: flex;
    flex-direction: column;
    background: var(--c-brand);
    color: #fff;
}

.calc__label {
    margin: 0;
    font-size: var(--fs-sm);
    opacity: 0.8;
}

.calc__total {
    margin: 10px 0 4px;
    font-size: var(--fs-h1);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.calc__year {
    margin: 0 0 24px;
    font-size: var(--fs-md);
    opacity: 0.8;
}

.calc__rows {
    margin: 0;
    padding: 0;
    list-style: none;
}

.calc__rows li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: var(--fs-md);
}

.calc__rows strong {
    font-weight: var(--fw-semibold);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.calc__note,
.calc__fine {
    margin: 16px 0 0;
    font-size: var(--fs-sm);
    line-height: var(--lh-normal);
    opacity: 0.85;
}

.calc__note:empty {
    display: none;
}

.calc__fine {
    margin-top: auto;
    padding-top: 16px;
    font-size: var(--fs-xs);
    opacity: 0.7;
}

.calc [hidden] {
    display: none;
}

/* Rates table */

.calc-rates {
    max-width: 1060px;
    margin: 40px auto 0;
}

.calc-rates__checked {
    margin: 8px 0 16px;
    font-size: var(--fs-sm);
    color: var(--c-text-muted);
}

.calc-rates__scroll {
    overflow-x: auto;
    border-radius: var(--r-lg);
    background: var(--c-surface);
}

.calc-rates__table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: var(--fs-sm);
    line-height: var(--lh-normal);
}

.calc-rates__table th,
.calc-rates__table td {
    padding: 14px 18px;
    border-top: 1px solid var(--c-line);
    text-align: left;
    vertical-align: top;
    color: var(--c-text);
}

.calc-rates__table thead th {
    border-top: 0;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--c-text-muted);
}

.calc-rates__table tbody th {
    font-weight: var(--fw-semibold);
    white-space: nowrap;
}

.calc-rates__source {
    display: block;
    margin-top: 4px;
    font-size: var(--fs-xs);
}

.calc-rates__source a {
    color: var(--c-icon);
}

@media (max-width: 860px) {
    .calc {
        grid-template-columns: minmax(0, 1fr);
    }

    .calc__panel {
        padding: 20px;
    }
}
