/* =========================================================
   Mobile apps (v2) of the producer and the buyer. Mobile first, as Figma (360px frames);
   on wider screens the content keeps the width of a phone column, centred.
   Load after main.css and form.css (and choices.min.css when the page has selects).
   ========================================================= */

@import url("../components/mobile-header/mobile-header.css");
@import url("../components/lot-card/lot-card.css");
@import url("../components/lot-section/lot-section.css");
@import url("../components/lot-detail/lot-detail.css");

/* Unlike .page of the admin, the whole page scrolls. */
.mobile-page {
    font-family: var(--token-font-family);
    min-height: 100vh;
    color: var(--font-color-mobile);
    background-color: var(--background-page-mobile);
    display: flex;
    flex-direction: column;
}

.mobile-page--detail {
    background-color: var(--background-page-mobile-detail);
}

/* display: flex would override the hidden attribute (the purchase summary while redirecting to the TPV, US-COM-17.1). */
.mobile-page__content[hidden] {
    display: none;
}

/* 328px column of Figma inside 16px margins. */
.mobile-page__content {
    width: 100%;
    max-width: calc(600px + 2 * var(--token-space-3));
    margin: 0 auto;
    padding: var(--token-space-3);
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--token-space-3);
}

/* Forms and «Crear nuevo lote»: 40px above and below, 24px between blocks. */
.mobile-page__content--form {
    padding: var(--token-space-5) var(--token-space-3);
    gap: var(--token-space-6);
}

/* =========================================================
   Titles, descriptions and dividers
   ========================================================= */

.mobile-title {
    font-size: var(--token-font-size-h2);
    font-weight: var(--token-font-weight-bold);
    letter-spacing: -0.18px;
}

.mobile-hint {
    font-size: var(--token-font-size-xs);
    font-style: italic;
    letter-spacing: -0.24px;
}

.mobile-section {
    display: flex;
    flex-direction: column;
    gap: var(--token-space-6);
}

/* display: flex would override the hidden attribute. */
.mobile-section[hidden] {
    display: none;
}

.mobile-section__header {
    display: flex;
    flex-direction: column;
    gap: var(--token-space-2);
}

.mobile-section__title {
    font-size: 20px;
    font-weight: var(--token-font-weight-bold);
    line-height: 28px;
}

.mobile-section__description {
    font-size: var(--token-font-size-s);
    line-height: 21px;
    color: var(--font-color-mobile-description);
}

.divider {
    width: 100%;
    height: 0;
    border: none;
    border-top: 1px solid var(--border-divider);
}

/* =========================================================
   Chips (modality, type) and status badge
   ========================================================= */

.chip {
    font-size: 13px;
    font-weight: var(--token-font-weight-bold);
    letter-spacing: -0.13px;
    color: var(--font-color-chip);
    border: 1px solid var(--border-chip);
    border-radius: var(--token-radius-s);
    padding: var(--token-space-1) 9px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* display: inline-flex would override the hidden attribute. */
.chip[hidden] {
    display: none;
}

/* Colors of the status catalog, set by the page as --status-color and --status-background. */
.status-badge {
    font-size: 13px;
    font-weight: var(--token-font-weight-bold);
    letter-spacing: -0.13px;
    color: var(--status-color, var(--font-color-mobile));
    background-color: var(--status-background, transparent);
    border-radius: var(--token-radius-s);
    padding: var(--token-space-1);
    display: inline-flex;
    white-space: nowrap;
}

/* display: inline-flex would override the hidden attribute. */
.status-badge[hidden] {
    display: none;
}

.status-badge--small {
    font-size: var(--token-font-size-xs);
    letter-spacing: -0.12px;
}

/* «Calidad Verificada» of the buyer: lot cards (COM-09) and lot detail (COM-10). */
.verified-badge {
    font-size: 13px;
    font-weight: var(--token-font-weight-bold);
    letter-spacing: -0.13px;
    color: var(--font-color-verified-badge);
    background-color: var(--background-verified-badge);
    border-radius: var(--token-radius-pill);
    padding: var(--token-space-1) var(--token-space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--token-space-1);
    white-space: nowrap;
}

/* display: inline-flex would override the hidden attribute. */
.verified-badge[hidden] {
    display: none;
}

/* Row of chips and badges under a title (lot form and decision of the producer): wraps when they do not fit. */
.mobile-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--token-space-2);
}

/* =========================================================
   Large buttons (56px, 16px text), full width
   ========================================================= */

.button--large {
    font-size: 16px;
    letter-spacing: -0.32px;
    width: 100%;
    height: 56px;
    border-width: 2px;
}

/* Hover of Figma («Estados botón Crear lote»): dark green with a thin border. */
.button--primary.button--large:hover,
.button--primary.button--large:focus-visible {
    border-width: 1px;
}

/* Disabled state of Figma: grey, no border, at full opacity. */
.button--primary.button--large:disabled,
.button--primary.button--large:disabled:hover {
    color: var(--font-color-button-disabled);
    background-color: var(--background-button-disabled);
    border-color: var(--background-button-disabled);
    opacity: 1;
}

/* Figma of the mobile apps: dark green text, not the light green of the admin outline buttons. */
.button--outline.button--large {
    color: var(--font-color-button-outline-strong);
}

/* «Eliminar Lote»: red text and the cancel icon, no box. */
.button--text-danger {
    color: var(--font-color-button-text-danger);
    background: none;
    border: none;
}

.button--text-danger:hover,
.button--text-danger:focus-visible {
    text-decoration: underline;
}

/* Bar fixed at the bottom of a list with its main action («Crear nuevo lote»). */
.action-bar {
    background-color: var(--background-action-bar);
    border-top: 1px solid var(--border-action-bar);
    padding: var(--token-space-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--token-space-3);
    position: sticky;
    bottom: 0;
}

/* display: flex would override the hidden attribute. */
.action-bar[hidden] {
    display: none;
}

.action-bar__content {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: var(--token-space-3);
}

.action-bar__notice {
    font-size: var(--token-font-size-s);
    line-height: 1.25;
    color: var(--font-color-mobile-muted);
    text-align: center;
}

/* =========================================================
   Fields: label above a 48px field
   ========================================================= */

.mobile-field {
    display: flex;
    flex-direction: column;
    gap: var(--token-space-2);
}

/* display: flex would override the hidden attribute (the province field that does not apply to the country). */
.mobile-field[hidden] {
    display: none;
}

.mobile-field__label {
    font-size: 16px;
    font-weight: var(--token-font-weight-medium);
    line-height: 21px;
}

.input--large {
    font-size: 16px;
    height: 48px;
    color: var(--font-color-mobile);
    padding: 0 10px;
}

.input--large::placeholder {
    color: var(--font-color-input-placeholder-mobile);
}

.mobile-field .field-error {
    width: auto;
    max-width: none;
    margin-top: 0;
}

/* Radio buttons and checkboxes: 24px, 16px label, one option per row. */
.mobile-choices {
    border: none;
    margin: 0;
    padding: 0;
    min-inline-size: 0;
    display: flex;
    flex-direction: column;
    gap: var(--token-space-3);
}

.mobile-choices > legend {
    font-size: 16px;
    font-weight: var(--token-font-weight-medium);
    line-height: 1.5;
    /* A legend sits on the fieldset border by default; floated, it becomes the first flex row, as in Figma. */
    float: left;
    width: 100%;
    padding: 0;
}

.radio--large,
.checkbox--large {
    font-size: 16px;
    font-weight: var(--token-font-weight-medium);
    line-height: 21px;
    color: var(--font-color-mobile);
    align-items: center;
    /* Long labels («Mostrar precio a los compradores») wrap on narrow phones. */
    white-space: normal;
}

.radio--large .radio__input,
.checkbox--large .checkbox__input {
    width: 24px;
    height: 24px;
    background-color: var(--background-radio);
    border: 1px solid var(--border-input);
    flex-shrink: 0;
}

.radio--large .radio__input:checked {
    background: url("../assets/icons/icon-radio-checked-large.svg") center / 25px 25px no-repeat;
    border-color: transparent;
}

.checkbox--large .checkbox__input {
    background-color: var(--background-choice);
    border-radius: var(--token-radius-s);
}

.checkbox--large .checkbox__input:checked {
    background: url("../assets/icons/icon-checkbox-checked-large.svg") center / 25px 25px no-repeat;
    border-color: transparent;
}

/* Option with a description under its label («Crear nuevo lote»): the radio aligns with the label. */
.radio--described {
    align-items: flex-start;
}

.radio__text {
    display: flex;
    flex-direction: column;
    white-space: normal;
}

.radio__description {
    font-size: var(--token-font-size-s);
    line-height: 1.5;
    color: var(--font-color-mobile-description);
}

/* =========================================================
   Choices.js in mobile fields (overrides of choices.min.css)
   ========================================================= */

.mobile-field .choices {
    font-size: 16px;
    font-weight: var(--token-font-weight-medium);
    margin-bottom: 0;
}

.mobile-field .choices__inner {
    font-size: 16px;
    min-height: 48px;
    color: var(--font-color-mobile);
    background-color: var(--background-input);
    border: 1px solid var(--border-input);
    border-radius: var(--token-radius-m);
    padding: 0 var(--token-space-3);
    display: flex;
    align-items: center;
}

.mobile-field .choices[data-type*="select-one"] .choices__inner {
    padding-bottom: 0;
}

.mobile-field .choices__placeholder {
    color: var(--font-color-input-placeholder-mobile);
    opacity: 1;
}

.mobile-field .choices.is-focused .choices__inner,
.mobile-field .choices.is-open .choices__inner {
    border-color: var(--border-input-focus);
    border-radius: var(--token-radius-m);
}

.mobile-field .choices.is-disabled .choices__inner {
    background-color: var(--background-input-readonly);
}

.mobile-field .choices.input--error .choices__inner {
    border-color: var(--border-input-error);
}

.mobile-field .choices__list--single {
    padding: 0 var(--token-space-5) 0 0;
}

/* Chevron of Figma instead of the Choices.js triangle. */
.mobile-field .choices[data-type*="select-one"]::after {
    width: 15px;
    height: 15px;
    background: url("../assets/icons/icon-chevron-down.svg") no-repeat center / 15px 15px;
    border: none;
    margin: 0;
    transform: translateY(-50%) rotate(90deg);
    right: var(--token-space-3);
    top: 50%;
}

.mobile-field .choices[data-type*="select-one"].is-open::after {
    margin: 0;
    transform: translateY(-50%) rotate(-90deg);
}

.mobile-field .choices__list--dropdown {
    font-size: 16px;
    border-color: var(--border-input);
    z-index: 10;
}

.mobile-field .choices__list--dropdown .choices__item {
    font-size: 16px;
}

.mobile-field .choices__input {
    font-size: 16px;
    background-color: var(--background-input);
}

/* =========================================================
   «Volver» link above the content (lot form and decision of the producer; the lot detail keeps
   .lot-detail__back of its component, with the same look)
   ========================================================= */

.mobile-back {
    font-size: 16px;
    font-weight: var(--token-font-weight-bold);
    line-height: 22px;
    color: var(--font-color-mobile);
    display: inline-flex;
    align-items: center;
    gap: var(--token-space-2);
    text-decoration: none;
}

.mobile-back:hover,
.mobile-back:focus-visible {
    text-decoration: underline;
}

/* =========================================================
   Utilities
   ========================================================= */

/* Read by screen readers, not shown: the page title of screens whose Figma has none. */
.visually-hidden {
    width: 1px;
    height: 1px;
    margin: -1px;
    position: absolute;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* «Has realizado una oferta …» of the buyer (COM-12): green check badge and the text, in the lot card of the
   Mercado, the lot detail and the offer form. */
.bid-notice {
    font-size: var(--token-font-size-s);
    font-weight: var(--token-font-weight-medium);
    line-height: 1.25;
    color: var(--font-color-bid-notice);
    display: flex;
    align-items: center;
    /* 3px in Figma, rounded to the 4px of the grid. */
    gap: var(--token-space-1);
}

/* display: flex would override the hidden attribute. */
.bid-notice[hidden] {
    display: none;
}

.bid-notice > img {
    flex-shrink: 0;
}

/* Warning in orange, as the payment notices of Figma: a card payment being confirmed (US-COM-17.1). */
.bid-notice--warning {
    font-weight: var(--token-font-weight-bold);
    color: var(--font-color-payment-warning);
}

/* Under «Modificar mi Oferta» of the lot detail, centred as the bar. */
.action-bar .bid-notice {
    align-self: center;
}

/* Result of a bid of the buyer, as coloured text without a box (COM-20 to COM-23): «Ganadora», «No Ganadora»
   and «Cancelado», in the cards of «Mis Ofertas» and the detail of the bid. */
.bid-result {
    font-size: 13px;
    font-weight: var(--token-font-weight-bold);
    line-height: 21px;
}

.bid-result--won {
    color: var(--font-color-bid-won);
}

.bid-result--lost {
    color: var(--font-color-bid-lost);
}

.bid-result--cancelled {
    letter-spacing: -0.13px;
    color: var(--font-color-bid-cancelled);
}

/* «Las ofertas se realizarán hasta las HH:MM del dd/mm/aa» of the buyer, under «Realizar Oferta» of the
   lot detail (COM-10) and of the offer form (COM-11). */
.offer-deadline {
    font-size: var(--token-font-size-s);
    line-height: 1.5;
    color: var(--font-color-mobile);
    text-align: center;
}

/* =========================================================
   Result screen after an action: grey page, icon, message and what happens next. Decision of the producer
   (PRO-15, «01.4 / 01.5 MENSAJE CONFIRMACIÓN») and offer of the buyer (COM-11, «01.4 HACER
   OFERTA_Confirmación»). The page adds .mobile-page--result to <body> when it shows it.
   ========================================================= */

.mobile-page--result {
    background-color: var(--background-page-mobile-detail);
}

/* display: flex would override the hidden attribute. */
.result-screen[hidden] {
    display: none;
}

.result-screen {
    text-align: center;
    padding-top: var(--token-space-7);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--token-space-3);
}

.result-screen__title {
    font-size: var(--token-font-size-h1);
    font-weight: var(--token-font-weight-bold);
    letter-spacing: -0.48px;
}

/* Longer text of the producer, 24px under the title. */
.result-screen__text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--font-color-mobile-description);
    margin-top: var(--token-space-6);
}

/* Short lines of the buyer, right under the title. */
.result-screen__note {
    font-size: 16px;
    line-height: 1.25;
    color: var(--font-color-mobile-description);
}

.result-screen__note--strong {
    font-weight: var(--token-font-weight-bold);
    color: var(--font-color-mobile);
}

.result-screen__link {
    font-size: var(--token-font-size-h2);
    font-weight: var(--token-font-weight-semibold);
    letter-spacing: -0.36px;
    color: var(--font-color-result-link);
}

.result-screen__link:hover,
.result-screen__link:focus-visible {
    color: var(--font-color-mobile);
}

/* =========================================================
   Errors of the whole form, right-aligned as in every form of the v2
   ========================================================= */

.mobile-form-error {
    text-align: right;
}
