/* =============================================================================
   recipes.css - ScrapeChef: the recipes list, the builder, a recipe's page
   and the usage meter. Linked in index.html after theme.css.
   ============================================================================= */

/* Text for screen readers only (a column header, a heading the page title
   already shows) */
.recipes-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.recipes-list-actions {
    margin-bottom: 16px;
}

/* The recipes list: on a phone, the page and the uses step aside so the
   name, when it was updated and the row's actions fit without scrolling
   sideways; the name wraps instead of widening the table */
.recipes-list-table .recipes-col-wide {
    display: none;
}

.recipes-list-table .recipes-col-name {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (min-width: 768px) {
    .recipes-list-table .recipes-col-wide {
        display: table-cell;
    }
}

/* An account with no recipe yet: what a recipe takes, and one example */
.recipes-first > h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.25rem;
}

.recipes-first-example {
    padding: 12px 16px;
    border-inline-start: 4px solid var(--brand);
    border-radius: var(--radius);
    background: var(--light);
    overflow-wrap: anywhere;
}

.recipes-first-url {
    display: block;
    font-weight: 600;
}

.recipes-first-request {
    display: block;
    color: var(--gray);
}

/* A section's heading inside its panel: a step below the page title */
.recipes-panel > h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.25rem;
}

/* A recipe's page: "More options" folds everything but the data and its
   link away; its summary reads as a section heading with a marker */
.recipes-more > summary,
.recipes-advanced > summary {
    cursor: pointer;
    font-weight: 600;
}

.recipes-more > summary {
    font-size: 1.25rem;
}

.recipes-more[open] > summary {
    margin-bottom: 8px;
}

.recipes-advanced {
    margin: 16px 0 0 0;
}

.recipes-advanced[open] > summary {
    margin-bottom: 8px;
}

/* "This page needs a login": numbered steps, the file, the text, the
   owner's confirmation; on the recipe page, the saved login above them */
.recipes-login-steps {
    margin: 0 0 16px 0;
    padding-inline-start: 24px;
}

.recipes-login-steps li {
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.recipes-login input[type="file"] {
    max-width: 100%;
}

.recipes-check-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
}

.recipes-check-row input {
    flex: 0 0 auto;
    margin: 4px 0 0 0;
}

.recipes-check-row label {
    min-width: 0;
    margin: 0 0 0 8px;
}

.recipes-login-current {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.recipes-login-facts {
    margin: 0 0 12px 0;
    padding-inline-start: 0;
    list-style: none;
}

.recipes-login-facts li {
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.recipes-login-facts li:first-child {
    font-weight: 600;
}

.recipes-data-view {
    margin-top: 16px;
}

/* One source: a block of its own, set apart from the next by a rule */
.recipes-source {
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.recipes-source:first-child {
    border-top: 0;
    padding-top: 0;
}

.recipes-set-link-hint {
    display: block;
    margin-top: 12px;
}

.recipes-source-name {
    margin: 0 0 4px 0;
    font-size: 1.125rem;
}

.recipes-source .recipes-page-url {
    margin-bottom: 4px;
}

.recipes-add-source {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.recipes-add-source > .recipes-link-heading {
    margin-top: 0;
}

.recipes-data-view .table-wrapper {
    margin-bottom: 8px;
}

/* The preview: compact rows, every cell on one line. A long value (a
   link, a description) is cut with "..." at 240px and shown whole in its
   tooltip; a picture shows small; more columns than fit scroll sideways
   inside the table's own box */
.recipes-data-view th,
.recipes-data-view td {
    padding: 8px 12px;
    white-space: nowrap;
    vertical-align: middle;
}

.recipes-data-view td {
    font-size: .875rem;
}

.recipes-data-view .recipes-cell-text {
    display: inline-block;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

@media (min-width: 1024px) {
    .recipes-data-view .recipes-cell-text {
        max-width: 320px;
    }
}

.recipes-data-view .recipes-cell-image {
    display: block;
    width: auto;
    max-width: 64px;
    height: 24px;
    object-fit: contain;
}

/* A recipe or a set paused by a smaller plan: a small pill next to its
   name, and a notice that says why and what to do */
.recipes-paused-badge {
    display: inline-block;
    margin-inline-start: 4px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(var(--brand-rgb), .12);
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 600;
}

.recipes-paused-notice {
    margin-bottom: 16px;
    border-inline-start: 4px solid var(--brand);
}

.recipes-turn-on-choice {
    display: block;
    margin: 8px 0;
}

/* The order of the sets: a label and a small select on one line */
.recipes-order {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}

.recipes-order label {
    margin: 0 8px 0 0;
}

.recipes-order select {
    width: auto;
    margin: 0;
}

/* "Custom...": "New data at most every", then [N] [unit] side by side,
   the number a few digits wide */
.recipes-keep-custom {
    margin-top: 16px;
}

.recipes-keep-every {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

#recipes-keep-count {
    flex: 0 0 96px;
    width: 96px;
    margin: 0 8px 0 0;
}

#recipes-keep-unit {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
}

/* A short hint under a form field */
.recipes-field-hint {
    display: block;
    margin-bottom: 16px;
}

/* A list with more pages being read: "Reading page 3 of 10" and its bar,
   then how the refresh went */
.recipes-run-progress {
    margin-bottom: 12px;
}

.recipes-run-progress:empty {
    display: none;
}

/* The tabs of the saved results wrap onto more lines on a small screen
   rather than scrolling sideways */
.recipes-set-tabs {
    margin-top: 8px;
}

.recipes-set-tabs .button-alt {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#recipes-add-panel .recipes-add-source {
    padding-top: 0;
    border-top: 0;
}

/* -----------------------------------------------------------------------------
   Usage meter
   -------------------------------------------------------------------------- */

.recipes-meter {
    margin-bottom: 24px;
}

.recipes-meter-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.recipes-meter-head h2 {
    margin: 0 16px 8px 0;
    font-size: 1.125rem;
}

.recipes-meter-upgrade {
    margin-bottom: 8px;
}

.recipes-meter-row {
    margin-bottom: 12px;
}

.recipes-meter-label {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.recipes-meter-label span:first-child {
    margin-inline-end: 8px;
    font-weight: 600;
}

.recipes-meter-bar {
    display: block;
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: var(--radius);
    background: var(--silver);
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
}

.recipes-meter-bar::-webkit-progress-bar {
    background: var(--silver);
    border-radius: var(--radius);
}

.recipes-meter-bar::-webkit-progress-value {
    background: var(--brand);
    border-radius: var(--radius);
}

.recipes-meter-bar::-moz-progress-bar {
    background: var(--brand);
    border-radius: var(--radius);
}

.recipes-meter-row.is-full .recipes-meter-bar::-webkit-progress-value {
    background: var(--error-text);
}

.recipes-meter-row.is-full .recipes-meter-bar::-moz-progress-bar {
    background: var(--error-text);
}

.recipes-meter-note {
    margin: 0;
    color: var(--gray);
    font-size: 0.875rem;
}

/* -----------------------------------------------------------------------------
   Builder: the conversation beside the result, stacked on small screens
   -------------------------------------------------------------------------- */

.recipes-builder {
    display: flex;
    flex-wrap: wrap;
    margin: 16px -8px 0 -8px;
}

.recipes-builder > .custom-column {
    display: flex;
    flex: 0 0 100%;
    min-width: 0;
}

.recipes-builder > .custom-column > .inner-column {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px;
}

.recipes-builder > .custom-column > .inner-column > .panel {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
}

@media (min-width: 1024px) {
    .recipes-builder > .custom-column {
        flex-basis: 50%;
    }
}

.recipes-page-url {
    margin-top: 0;
    color: var(--gray);
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.recipes-chat-log {
    max-height: 420px;
    margin-bottom: 16px;
    overflow-y: auto;
}

.recipes-message {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--light);
}

.recipes-message-user {
    margin-left: 32px;
    background: rgba(var(--brand-rgb), .08);
}

.recipes-message-chef {
    margin-right: 32px;
}

.recipes-message-error {
    margin-right: 32px;
    border: 1px solid var(--error-text);
    background: transparent;
    color: var(--error-text);
}

.recipes-message p {
    margin: 0;
    overflow-wrap: anywhere;
}

.recipes-message-label {
    margin-bottom: 4px;
    color: var(--gray);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.recipes-message .recipes-message-label {
    margin-bottom: 4px;
}

.recipes-message-text {
    white-space: pre-wrap;
}

.recipes-message .recipes-message-detail {
    margin-top: 8px;
    color: var(--gray);
    font-size: 0.875rem;
}

.recipes-options {
    display: flex;
    flex-wrap: wrap;
    margin-top: 8px;
}

.recipes-options .recipes-option {
    margin: 0 8px 8px 0;
}

.recipes-turns {
    margin: 8px 0 0 0;
    color: var(--gray);
    font-size: 0.875rem;
}

.recipes-turns:empty {
    display: none;
}

/* The tabs of a recipe's pages */
.recipes-tabs {
    margin-bottom: 12px;
}

.recipes-tabs .button-alt.is-active {
    border-color: var(--brand);
    color: var(--brand);
}

.recipes-summary {
    margin: 0 0 8px 0;
    color: var(--gray);
    font-size: 0.875rem;
}

.recipes-summary:empty {
    display: none;
}

/* Extracted data and rules: a code block that scrolls inside itself */
.recipes-code {
    max-height: 420px;
    margin: 0 0 16px 0;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--black);
    font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: auto;
}

.recipes-save-form,
.recipes-saved-note {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* The builder's result: "Read the page again" under the main button, then
   Advanced (the data as JSON and the rules) */
.recipes-output .recipes-data-view {
    margin-top: 8px;
}

.recipes-preview-row {
    margin-top: 16px;
}

/* -----------------------------------------------------------------------------
   A recipe's page
   -------------------------------------------------------------------------- */

.recipes-link-block {
    margin-bottom: 16px;
}

/* What the link's choice costs, then the updates left this month */
.recipes-link-block small {
    display: block;
}

.recipes-updates-left {
    margin-top: 4px;
    font-weight: 600;
}

/* "Page used for this recipe" and "Use this recipe on another page" */
.recipes-link-heading {
    margin: 24px 0 8px 0;
    font-size: 1rem;
}

/* The text area a plain http page copies through: off the screen */
.recipes-copy-area {
    position: fixed;
    top: 0;
    left: -9999px;
    opacity: 0;
}

/* A link and its Copy button: the boilerplate's .inline-form row as it is,
   so the input and the button share one height and one line */
.recipes-link-row {
    margin-bottom: 8px;
}

/* From 768px the link takes the room its Copy button leaves, so the two
   stay on one line in a narrow panel too */
@media (min-width: 768px) {
    .recipes-link-row input:not([type="checkbox"]):not([type="radio"]) {
        flex: 1 1 auto;
    }
}

/* The choice of what the links give: a size smaller, so its longer
   choices read whole on a phone */
#recipes-keep {
    font-size: 0.875rem;
}

.recipes-rules-editor {
    font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
    font-size: 0.75rem;
}

#recipes-fix-builder .recipes-builder {
    margin-top: 0;
}

/* -----------------------------------------------------------------------------
   The manual (help.js): each task a row that opens on its title, its steps
   numbered under it
   -------------------------------------------------------------------------- */

.help-topic h2 {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: 1.25rem;
}

.help-task {
    padding-block: 12px;
    border-bottom: 1px solid var(--border);
}

.help-task:last-child {
    border-bottom: 0;
}

.help-task summary {
    font-weight: 600;
    cursor: pointer;
}

.help-task ol {
    margin: 12px 0 4px;
    padding-inline-start: 24px;
}

.help-task p {
    margin: 12px 0 4px;
}

.help-task li + li {
    margin-top: 8px;
}

/* An example's "Try it" buttons, under its steps */
.help-try {
    margin: 12px 0 4px;
}

/* -----------------------------------------------------------------------------
   The Plans page (bigger-plan.js): the plan chosen on a landing page, the
   "Need a bigger plan?" box under the plans, and the form's field that only
   robots fill in, kept off screen
   -------------------------------------------------------------------------- */

.card-grid > .custom-column > .inner-column > .card.plan-chosen {
    border-color: var(--brand);
}

.plan-chosen-tag {
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 8px;
    padding: 0 8px;
    line-height: 20px;
    border-radius: var(--radius);
    background: rgba(var(--brand-rgb), .12);
    color: var(--brand);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.bigger-plan-box {
    margin-top: 24px;
}

.bigger-plan-box h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.bigger-plan-trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* -----------------------------------------------------------------------------
   Privacy and terms (privacy.js): each section a panel with its sentences as
   a list, and the register page's line under the form
   -------------------------------------------------------------------------- */

.privacy-page {
    max-width: 800px;
}

.privacy-section h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.privacy-section ul {
    margin: 0;
    padding-inline-start: 24px;
}

.privacy-section li + li {
    margin-top: 8px;
}

.privacy-register-note {
    margin: 12px 0 0 0;
    color: var(--gray);
    font-size: .875rem;
}

/* -----------------------------------------------------------------------------
   Costs (costs.js, admins): the month's numbers as small cards, each day's
   cost as a bar, and the custom plan calculator
   -------------------------------------------------------------------------- */

.costs-month {
    margin-bottom: 24px;
}

.costs-stats {
    margin-bottom: 8px;
}

.costs-stat {
    display: flex;
    flex-direction: column;
}

.costs-stat-label {
    color: var(--gray);
    font-size: 0.875rem;
}

.costs-stat-value {
    margin-top: 4px;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.costs-stat-detail {
    margin-top: 4px;
    color: var(--gray);
    font-size: 0.8125rem;
}

.costs-note {
    color: var(--gray);
    font-size: 0.875rem;
}

.costs-section {
    margin-top: 32px;
}

.costs-section h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.costs-bar-cell {
    white-space: nowrap;
}

.costs-bar {
    display: inline-block;
    width: 120px;
    height: 8px;
    margin-inline-end: 8px;
    border-radius: var(--radius);
    background: var(--silver);
    overflow: hidden;
    vertical-align: middle;
}

.costs-bar span {
    display: block;
    height: 100%;
    border-radius: var(--radius);
    background: var(--brand);
}

.costs-calc-fields {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.costs-calc-fields > div {
    flex: 1 1 200px;
    min-width: 0;
    padding: 0 8px;
}

/* The calculator's results: a label and its value on each row, the label
   a third of the row on a wide screen */
.costs-calc-table td:first-child {
    width: 45%;
    color: var(--gray);
}

/* On a phone the detail goes under its value */
.costs-calc-table td span {
    display: block;
    color: var(--gray);
    font-size: 0.8125rem;
}

@media (min-width: 768px) {
    .costs-calc-table td:first-child {
        width: 34%;
    }

    .costs-calc-table td span {
        display: inline;
        margin-inline-start: 8px;
    }
}
/* The buttons of a row wrap rather than push the table wide */
.costs-actions button {
    margin: 2px 8px 2px 0;
}

/* Save sits on the fields' line: the fields keep 16px under them, so the
   button does too, at their height */
.costs-hard-actions {
    flex: 0 0 auto;
    align-self: flex-end;
    margin: 0 0 16px;
}

.costs-hard-actions button {
    height: 44px;
}

/* A hard site said under the address of a new recipe */
.recipes-hard-site {
    font-weight: 600;
}
/* A measured price that suggests another weight, and a plan without limits */
.costs-hint {
    color: var(--error-text);
    font-weight: 600;
}

.costs-changes {
    margin: 0 0 16px;
    padding-inline-start: 20px;
    font-size: 0.875rem;
}

/* Plan limits: one block per plan */
.costs-plan {
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.costs-plan h3 {
    margin: 0 0 4px;
}
