/* ====== TEXT FIELDS ======
   The one box every text field in the customer app is drawn with (docs/design-discipline.md,
   "Text fields"). A page puts `text-field` on the element around its input or textarea and adds
   the modifier for its look; it states no border, fill, height, text size or focus cue of its
   own. Colour and shape come from the --field-* values in ui-theme.css, size from "FIELD SIZE".

   text-field                     the form field: one line, 45px, text 14 medium
   text-field text-field-money    the same with the value in bold (an amount)
   text-field text-field-multi    a textarea; grows with its rows, the block corner, room for a footer
   text-field text-field-search   the search inside a card: 40px, text 13
   text-field text-field-bar      the search on the coloured top bar: see-through white

   The input is usually rendered by the shared <TextField>, a child component, which a page's
   scoped stylesheet cannot reach; this file is global, so it reaches it directly.

   What stays its own component and look: SelectField, the date and time pickers, CodeInput,
   CountryCodePicker and the chat box. They read the same --field-* values. */

.text-field {
    display: flex;
    align-items: center;
    gap: 8px;
    /* A field shares a row with a prefix or a picker (price, duration, amount); without this its
       input's natural width stops it shrinking and pushes the neighbour off the edge. */
    min-width: 0;
    box-sizing: border-box;
    min-height: var(--field-height);
    padding: 0 14px;
    border: 1.5px solid var(--field-border-color, var(--border));
    border-radius: var(--field-radius, 10px);
    background: var(--field-fill, var(--bg-white));
    /* The colour of an icon inside the field. */
    color: var(--text-muted);
    transition:
        border-color 0.2s,
        box-shadow 0.2s,
        background 0.2s;
}

.text-field:focus-within {
    border-color: var(--field-focus-border-color, var(--blue-primary));
    background: var(--field-focus-fill, var(--bg-white));
    box-shadow: var(--field-focus-shadow, 0 0 0 3px rgba(21, 101, 192, 0.1));
}
/* Mouse hover mirrors the focus cue, guarded so a touch tap does not leave it lit
   (docs/interaction-states.md 4.1). */
@media (hover: hover) {
    .text-field:hover {
        border-color: var(--field-focus-border-color, var(--blue-primary));
        background: var(--field-focus-fill, var(--bg-white));
        box-shadow: var(--field-focus-shadow, 0 0 0 3px rgba(21, 101, 192, 0.1));
    }
}

.text-field > svg,
.text-field > .ic {
    flex-shrink: 0;
}

.text-field input,
.text-field textarea {
    flex: 1;
    /* Without it a long value pushes a button beside the input off the field. */
    min-width: 0;
    align-self: stretch;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    /* Follows the field's curve, so the browser's autofill fill does too (base.css). */
    border-radius: inherit;
    background: transparent;
    font-family: inherit;
    font-size: var(--field-text-size);
    font-weight: var(--field-text-weight);
    color: var(--text-primary);
    text-overflow: ellipsis;
}

/* The browser's autofill paint (base.css) follows the field into the fill it takes when anything
   inside it has focus or the pointer is over it, not only when the input itself has focus. */
.text-field:focus-within input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--field-focus-fill, var(--bg-white)) inset;
    box-shadow: 0 0 0 1000px var(--field-focus-fill, var(--bg-white)) inset;
}
@media (hover: hover) {
    .text-field:hover input:-webkit-autofill {
        -webkit-box-shadow: 0 0 0 1000px var(--field-focus-fill, var(--bg-white)) inset;
        box-shadow: 0 0 0 1000px var(--field-focus-fill, var(--bg-white)) inset;
    }
}

.text-field input::placeholder,
.text-field textarea::placeholder {
    color: var(--field-placeholder);
}

/* Only the app's own show-and-hide button, never the browser's. */
.text-field input::-ms-reveal,
.text-field input::-webkit-credentials-auto-fill-button {
    display: none;
}

/* An icon button inside the field, such as the show-and-hide password button (pass
   ToggleClass="text-field-btn" to <TextField>): an icon only, in the field's icon colour, lit on
   hover and keyboard focus. Opt-in by class, because the date and time pickers are buttons too. */
.text-field-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* A 44px touch target although the icon is 18px; at the end of the field it reaches the
       field's edge, so the icon sits 22px from it. */
    min-width: 44px;
    align-self: stretch;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
}

.text-field-btn:last-child {
    margin-right: -14px;
}

.text-field-btn:focus-visible {
    outline: none;
    color: var(--blue-primary);
}
@media (hover: hover) {
    .text-field-btn:hover {
        color: var(--blue-primary);
    }
}

/* An amount reads first; its "0" placeholder does not. */
.text-field.text-field-money input {
    font-weight: 700;
}

.text-field.text-field-money input::placeholder {
    font-weight: var(--field-text-weight);
}

/* A textarea: no fixed height, the block corner, and the text inset; a counter footer may sit
   under it inside the same box. */
.text-field.text-field-multi {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-height: 0;
    padding: 0;
    border-radius: var(--field-radius-block, 12px);
    overflow: hidden;
}

/* Posting's values, the form that came first (docs/design-discipline.md section 6). A page sets
   the textarea's min-height for the size of answer it expects. */
.text-field.text-field-multi textarea {
    padding: 14px;
    line-height: 1.6;
    resize: none;
}

/* The strip under the text: a hint on the left, the character count on the right. */
.text-field-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    border-top: var(--field-footer-edge, 1px solid var(--border));
    background: var(--field-footer-fill, var(--bg-page));
}

.text-field-count {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Over nine tenths of the limit. */
.text-field-count.warn {
    color: #ea580c;
}

.text-field.text-field-search {
    min-height: var(--field-search-height);
}

.text-field.text-field-search input {
    font-size: var(--field-search-text-size);
}

/* On the coloured top bar: see-through white, white text. */
.text-field.text-field-bar {
    min-height: var(--field-bar-height);
    border-color: rgba(255, 255, 255, 0.18);
    border-radius: var(--header-field-radius, 999px);
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.6);
}

.text-field.text-field-bar:focus-within {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.22);
    box-shadow: none;
}
@media (hover: hover) {
    .text-field.text-field-bar:hover {
        border-color: rgba(255, 255, 255, 0.35);
        background: rgba(255, 255, 255, 0.22);
        box-shadow: none;
    }
}

.text-field.text-field-bar input {
    color: #fff;
}

.text-field.text-field-bar input::placeholder {
    color: var(--field-bar-placeholder);
}

/* ====== CHOICE CARDS ======
   A pick-one card drawn as a <button aria-pressed> (design-discipline section 2): the chosen one
   has a blue edge and a pale fill. Wallet's balance choice and the "Laporkan" reasons, which
   until 2026-11-18 each carried a copy; how the card lays out its content stays with the page. */
.choice-card {
    padding: 12px;
    text-align: left;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.choice-card.selected {
    border-color: var(--blue-primary);
    background: var(--blue-pale);
}

.choice-card:focus-visible,
.choice-card:active {
    outline: none;
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(var(--blue-primary-rgb), 0.18);
}

@media (hover: hover) {
    .choice-card:hover {
        border-color: var(--blue-primary);
    }
}
