/**
 * Fill PDF Forms tool-specific styles.
 *
 * v2.0.4 adds export polish and regression hardening.
 */

.localpdf-edit-fill-pdf-forms-tool [data-localpdf-edit-start-icon="fill-pdf-forms"] .localpdf-start-illustration-pdf {
    letter-spacing: 0.04em;
}

.localpdf-edit-fill-pdf-forms-tool [data-localpdf-edit-start-icon="fill-pdf-forms"] .localpdf-edit-illustration-number {
    font-size: 0;
}

.localpdf-edit-fill-pdf-forms-tool [data-localpdf-edit-start-icon="fill-pdf-forms"] .localpdf-edit-illustration-number::after {
    content: 'FF';
    font-size: 13px;
    letter-spacing: 0.08em;
}

.localpdf-edit-fill-pdf-forms-tool .localpdf-process-export-button.is-disabled,
.localpdf-edit-fill-pdf-forms-tool .localpdf-process-export-button[disabled] {
    cursor: not-allowed;
    opacity: .72;
    box-shadow: none;
}

.localpdf-edit-fill-pdf-forms-tool.is-fill-forms-reading .localpdf-dropzone {
    pointer-events: none;
    opacity: 0.78;
}

.localpdf-fill-forms-settings {
    display: grid;
    gap: 16px;
}

.localpdf-fill-forms-detection-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.localpdf-fill-forms-detection-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
}

.localpdf-fill-forms-detection-card span {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.localpdf-fill-forms-detection-card strong {
    display: block;
    overflow: hidden;
    color: #0f172a;
    font-size: 16px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.localpdf-fill-forms-note,
.localpdf-fill-forms-control-note {
    margin: 12px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

.localpdf-fill-forms-field-list {
    display: grid;
    max-height: 300px;
    overflow: auto;
    gap: 8px;
    padding-right: 2px;
}

.localpdf-fill-forms-empty {
    padding: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.5);
    border-radius: 16px;
    color: #64748b;
    background: rgba(248, 250, 252, 0.68);
    font-size: 14px;
    line-height: 1.5;
}

.localpdf-fill-forms-field-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "badge name"
        "badge meta";
    gap: 4px 10px;
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    text-align: left;
    cursor: pointer;
}

.localpdf-fill-forms-field-item:hover,
.localpdf-fill-forms-field-item:focus-visible {
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
    outline: none;
}

.localpdf-fill-forms-field-item.is-active {
    border-color: rgba(37, 99, 235, 0.68);
    background: rgba(239, 246, 255, 0.92);
}

.localpdf-fill-forms-field-item em {
    grid-area: badge;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.localpdf-fill-forms-field-item strong {
    grid-area: name;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.localpdf-fill-forms-field-item span {
    grid-area: meta;
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.localpdf-fill-forms-field-detail dl {
    display: grid;
    gap: 8px;
    margin: 0;
}

.localpdf-fill-forms-field-detail dl > div {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.localpdf-fill-forms-field-detail dl > div:last-child {
    border-bottom: 0;
}

.localpdf-fill-forms-field-detail dt {
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.localpdf-fill-forms-field-detail dd {
    overflow-wrap: anywhere;
    margin: 0;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

.localpdf-edit-fill-pdf-forms-tool .localpdf-page-chip.has-form-fields {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(239, 246, 255, 0.92);
}

.localpdf-edit-fill-pdf-forms-tool .localpdf-page-chip.has-selected-form-field {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.localpdf-fill-forms-page-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.localpdf-edit-fill-pdf-forms-tool .localpdf-page-chip {
    position: relative;
}

@media (max-width: 760px) {
    .localpdf-fill-forms-detection-grid {
        grid-template-columns: 1fr;
    }

    .localpdf-fill-forms-field-detail dl > div {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* Field editing controls and field list UX. */
.localpdf-fill-forms-filterbar {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, .9fr) minmax(0, .9fr) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

.localpdf-fill-forms-filter-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.localpdf-fill-forms-filter-field span {
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.localpdf-fill-forms-filter-field input,
.localpdf-fill-forms-filter-field select,
.localpdf-fill-forms-editor-card textarea,
.localpdf-fill-forms-editor-card select {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    color: #0f172a;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    outline: none;
    padding: 10px 12px;
}

.localpdf-fill-forms-filter-field input:focus,
.localpdf-fill-forms-filter-field select:focus,
.localpdf-fill-forms-editor-card textarea:focus,
.localpdf-fill-forms-editor-card select:focus {
    border-color: rgba(37, 99, 235, 0.7);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.localpdf-fill-forms-filter-reset,
.localpdf-fill-forms-actions .localpdf-secondary-action {
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 14px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
    padding: 10px 13px;
}

.localpdf-fill-forms-filter-reset:hover,
.localpdf-fill-forms-filter-reset:focus-visible,
.localpdf-fill-forms-actions .localpdf-secondary-action:hover,
.localpdf-fill-forms-actions .localpdf-secondary-action:focus-visible {
    border-color: rgba(37, 99, 235, 0.58);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
    outline: none;
}

.localpdf-fill-forms-actions .localpdf-secondary-action[disabled],
.localpdf-fill-forms-actions .localpdf-secondary-action.is-disabled {
    cursor: not-allowed;
    opacity: .56;
    box-shadow: none;
}

.localpdf-fill-forms-list-meta {
    margin: 0 0 10px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.localpdf-fill-forms-field-item {
    position: relative;
    grid-template-areas:
        "badge name"
        "badge meta"
        "badge value";
}

.localpdf-fill-forms-field-item small {
    grid-area: value;
    overflow: hidden;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.localpdf-fill-forms-field-item.is-edited {
    border-color: rgba(217, 119, 6, 0.55);
    background: rgba(255, 251, 235, 0.92);
}

.localpdf-fill-forms-field-item.is-readonly {
    opacity: .82;
}

.localpdf-fill-forms-edited-dot {
    position: absolute;
    top: 9px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(217, 119, 6, 0.13);
    color: #92400e;
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}

.localpdf-fill-forms-editor {
    margin-top: 14px;
}

.localpdf-fill-forms-editor-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.88);
}

.localpdf-fill-forms-editor-label {
    display: grid;
    gap: 8px;
}

.localpdf-fill-forms-editor-label > span {
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.localpdf-fill-forms-editor-card textarea {
    min-height: 104px;
    resize: vertical;
}

.localpdf-fill-forms-editor-card select[multiple] {
    min-height: 120px;
}

.localpdf-fill-forms-editor-preview,
.localpdf-fill-forms-editor-hint {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.55;
}

.localpdf-fill-forms-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.localpdf-edit-fill-pdf-forms-tool.has-edited-form-fields .localpdf-fill-forms-detection-card:nth-child(3) {
    border-color: rgba(217, 119, 6, 0.42);
    background: rgba(255, 251, 235, 0.92);
}

@media (max-width: 980px) {
    .localpdf-fill-forms-filterbar {
        grid-template-columns: 1fr 1fr;
    }

    .localpdf-fill-forms-filter-reset {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .localpdf-fill-forms-filterbar {
        grid-template-columns: 1fr;
    }
}

/* v2.0.4 export polish + regression hardening. */
.localpdf-settings-section--fill-forms-export {
    border-color: rgba(59, 130, 246, 0.2);
}

.localpdf-fill-forms-check-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.72);
    cursor: pointer;
}

.localpdf-fill-forms-check-option input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: #2563eb;
}

.localpdf-fill-forms-check-option span {
    display: grid;
    gap: 4px;
}

.localpdf-fill-forms-check-option strong {
    color: #0f172a;
    font-size: 0.94rem;
}

.localpdf-fill-forms-check-option em,
.localpdf-fill-forms-export-note {
    color: #64748b;
    font-style: normal;
    font-size: 0.82rem;
    line-height: 1.45;
}

.localpdf-fill-forms-export-note {
    margin: 10px 0 0;
}
