/*
Form system for every web page (docs/web-typography-forms-plan.md, phase 5).
Loaded through templates/components/font_links.html.

One look for labels, controls, help and errors:
- .fc-field-label   13px / 600 label, 6px above the control
- .fc-form-control  44px input and select, 96px+ textarea, 12px radius
- .fc-form-control--sm  36px compact control for filters and toolbars
- .fc-help-text / .fc-field-error  12px help and error lines
.fc-input, .fc-auth-input and .fc-tint-input share this base; the tinted and
auth variants only change colors. Do not size controls with Tailwind utilities.
*/

:root {
    --control-height: 44px;
    --control-height-sm: 36px;
    --control-radius: 12px;
    --control-border: #d6dce6;
}

html.dark {
    --control-border: var(--fc-border-strong, #3a4a58);
}

.fc-form-control,
.fc-input,
.fc-auth-input,
.fc-tint-input {
    box-sizing: border-box;
    width: 100%;
    min-height: var(--control-height);
    padding: 0 14px;
    border: 1px solid var(--control-border);
    border-radius: var(--control-radius);
    background-color: var(--fc-surface-solid, #ffffff);
    color: var(--fc-text, #0b1220);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: var(--weight-regular);
    line-height: 1.4;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

textarea.fc-form-control,
textarea.fc-input,
textarea.fc-auth-input,
textarea.fc-tint-input {
    min-height: 96px;
    padding: 10px 14px;
    resize: vertical;
}

select.fc-form-control,
select.fc-input,
select.fc-auth-input,
select.fc-tint-input {
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    text-overflow: ellipsis;
}

.fc-form-control:focus,
.fc-input:focus,
.fc-auth-input:focus,
.fc-tint-input:focus {
    border-color: var(--fc-brand, #183b56);
    box-shadow: var(--fc-shadow-focus, 0 0 0 3px rgba(53, 126, 168, 0.22));
    outline: none;
}

.fc-form-control::placeholder,
.fc-input::placeholder,
.fc-auth-input::placeholder,
.fc-tint-input::placeholder {
    color: var(--fc-muted, #5b6475);
    font-weight: var(--weight-regular);
    opacity: 1;
}

.fc-form-control[aria-invalid="true"],
.fc-input[aria-invalid="true"],
.fc-auth-input[aria-invalid="true"],
.fc-tint-input[aria-invalid="true"] {
    border-color: var(--fc-danger, #be123c);
}

.fc-form-control:disabled,
.fc-input:disabled,
.fc-auth-input:disabled,
.fc-tint-input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Compact: filters and toolbars only */
.fc-form-control--sm {
    min-height: var(--control-height-sm);
    padding-left: 12px;
    padding-right: 12px;
    font-size: 13px;
}

select.fc-form-control--sm {
    padding-right: 34px;
    background-position: right 10px center;
}

/* Checkbox */
.fc-checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 1px solid var(--control-border);
    border-radius: 6px;
    accent-color: var(--fc-brand-action, #183b56);
}

/* Label, help and error */
.fc-field-label,
.fc-auth-label,
.fc-tint-label {
    font-size: var(--type-small-size);
    font-weight: var(--weight-semibold);
    line-height: 1.35;
}

.fc-field-label {
    display: block;
    margin-bottom: 6px;
}

.fc-help-text,
.fc-field-error {
    margin-top: 6px;
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-lh);
}

.fc-help-text {
    font-weight: var(--weight-medium);
}

.fc-field-error {
    margin-bottom: 0;
    color: var(--fc-danger, #be123c);
    font-weight: var(--weight-medium);
}

@media (max-width: 767px) {
    /* 16px stops iOS from zooming the page when a field gets focus */
    .fc-form-control,
    .fc-input,
    .fc-auth-input,
    .fc-tint-input {
        font-size: 16px;
    }
}

/* File inputs: give the native "Choose file" button a fixed height and room
   inside the 44px control, so it sits centered instead of touching the border. */
input[type="file"].fc-form-control {
    padding: 6px;
    line-height: normal;
}

input[type="file"].fc-form-control::file-selector-button {
    height: 30px;
    margin-right: 12px;
    padding: 0 14px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--fc-surface-solid, #ffffff);
    color: var(--fc-text, #0b1220);
    font: inherit;
    font-weight: var(--weight-semibold, 600);
    cursor: pointer;
}

/* Password show/hide button, added by static/js/password-toggle.js. */
.fc-password-field {
    position: relative;
}

.fc-password-field > input {
    padding-right: 44px;
}

.fc-password-field > input::-ms-reveal {
    display: none;
}

.fc-password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 100%;
    border: 0;
    border-radius: var(--control-radius);
    background: none;
    color: var(--fc-text-muted, #64748b);
    cursor: pointer;
}

.fc-password-toggle:hover {
    color: var(--fc-text, #0b1220);
}

.fc-password-toggle:focus-visible {
    outline: 2px solid var(--fc-brand, #2563eb);
    outline-offset: -2px;
}
