/* ============================================================
   Trimble Career Form — Bricks element
   ============================================================
   Custom properties (set inline on .trm-career by CareerForm.php):
     --trm-cf-bg           — card background
     --trm-cf-border       — card border
     --trm-cf-field-bg     — input/file-button background
     --trm-cf-accent       — focus colour, submit button bg
     --trm-cf-accent-hover — submit hover
     --trm-cf-text         — body text
     --trm-cf-muted        — muted / placeholder text
   ============================================================ */

/* === Card === */
.trm-career,
.trm-career * {
    box-sizing: border-box;
}

.trm-career {
    background: var(--trm-cf-bg, #FAFAF9);
    border-radius: 8px;
    color: var(--trm-cf-text, #0F1B2E);
    font-family: inherit;
}

.trm-career__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
    color: var(--trm-cf-text, #0F1B2E);
}

.trm-career__desc {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--trm-cf-muted, #7B8A9F);
    line-height: 1.55;
}

/* === Honeypot — visually & spatially hidden, but available to bots === */
.trm-career__hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* === Form layout === */
.trm-career__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.trm-career .form-group {
    margin: 0;
}

/* === Inputs === */
.trm-career input[type="text"],
.trm-career input[type="email"],
.trm-career input[type="tel"],
.trm-career input[type="number"],
.trm-career select,
.trm-career textarea {
    width: 100%;
    background: var(--trm-cf-field-bg, #F5F8FC);
    border: 0.5px solid var(--trm-cf-border, #E2E8F0);
    border-radius: 6px;
    padding: 11px 13px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--trm-cf-text, #0F1B2E);
    font-family: inherit;
    box-shadow: none;
    outline: none;
    transition: border-color .15s ease, background .15s ease;
}

.trm-career input::placeholder,
.trm-career textarea::placeholder {
    color: var(--trm-cf-muted, #7B8A9F);
}

.trm-career input:focus,
.trm-career select:focus,
.trm-career textarea:focus {
    border-color: var(--trm-cf-accent, #1E40AF);
    background: #FFFFFF;
}

.trm-career input[aria-invalid="true"] {
    border-color: #DC2626;
    background: #FEF2F2;
}

/* === File upload === */
.trm-career .form-group.file {
    position: relative;
}

.trm-career .form-group.file input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.trm-career .choose-files {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--trm-cf-field-bg, #F5F8FC);
    border: 0.5px dashed #BFD4FB;
    border-radius: 6px;
    padding: 14px;
    color: #4A5B72;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.trm-career .choose-files:hover {
    border-color: var(--trm-cf-accent, #1E40AF);
    background: #EFF6FF;
}

/* Paperclip icon (Tabler) */
.trm-career .choose-files::before {
    content: "";
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%231E40AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5"/></svg>') center/contain no-repeat;
}

/* Pseudo "Choose file" button on the right */
.trm-career .choose-files::after {
    content: "Choose file";
    margin-left: auto;
    background: var(--trm-cf-bg, #FAFAF9);
    border: 0.5px solid var(--trm-cf-border, #E2E8F0);
    border-radius: 4px;
    padding: 5px 10px;
    color: var(--trm-cf-accent-hover, #1E3A8A);
    font-weight: 500;
}

/* Hide the dashed picker when a file is selected (JS toggles .has-file). */
.trm-career .form-group.file.has-file .choose-files {
    display: none;
}

/* === Selected file pill === */
.trm-career .file-result {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #EFF6FF;
    border: 0.5px solid #DBEAFE;
    border-radius: 6px;
    font-size: 12px;
    color: var(--trm-cf-accent-hover, #1E3A8A);
}

.trm-career .form-group.file.has-file .file-result {
    display: flex;
}

.trm-career .file-result .text {
    flex: 1;
    word-break: break-all;
}

.trm-career .file-result .remove {
    background: transparent;
    border: 0;
    color: #DC2626;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    width: auto;
}

.trm-career .file-result .remove:hover {
    background: transparent;
    color: #B91C1C;
}

.trm-career .file-result svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* === Submit === */
.trm-career .submit-button-wrapper {
    margin-top: 6px;
}

.trm-career .bricks-button {
    width: 100%;
    background: var(--trm-cf-accent, #1E40AF);
    color: #FAFAF9;
    padding: 12px;
    border: 0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background .15s ease, transform .05s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.trm-career .bricks-button:hover {
    background: var(--trm-cf-accent-hover, #1E3A8A);
}

.trm-career .bricks-button:active {
    transform: translateY(1px);
}

.trm-career .bricks-button:disabled,
.trm-career .bricks-button[aria-busy="true"] {
    opacity: 0.7;
    cursor: progress;
}

.trm-career .bricks-button .loading {
    display: none;
    align-items: center;
    margin-left: 4px;
}

.trm-career .bricks-button .loading svg {
    width: 14px;
    height: 14px;
    animation: trm-cf-spin 0.9s linear infinite;
}

.trm-career .bricks-button[aria-busy="true"] .loading {
    display: inline-flex;
}

@keyframes trm-cf-spin {
    to { transform: rotate(360deg); }
}

/* === Status messages === */
.trm-career__status {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    min-height: 0;
}

.trm-career__status:empty {
    display: none;
}

.trm-career__status[data-state="error"] {
    background: #FEF2F2;
    border: 0.5px solid #FECACA;
    color: #B91C1C;
    padding: 11px 13px;
    border-radius: 6px;
}

.trm-career__status[data-state="success"] {
    background: #EFF6FF;
    border: 0.5px solid #DBEAFE;
    color: var(--trm-cf-accent-hover, #1E3A8A);
    padding: 14px;
    border-radius: 6px;
    text-align: center;
}

/* When the form has been successfully submitted, hide the form so only
   the success message remains. */
.trm-career.is-submitted .trm-career__form {
    display: none;
}

/* === Fallback text === */
.trm-career__fallback {
    margin-top: 8px;
    font-size: 11px;
    color: var(--trm-cf-muted, #7B8A9F);
    text-align: center;
}

.trm-career__fallback a {
    color: var(--trm-cf-accent, #1E40AF);
    text-decoration: none;
}

.trm-career__fallback a:hover {
    text-decoration: underline;
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    .trm-career input,
    .trm-career .choose-files,
    .trm-career .bricks-button {
        transition: none !important;
    }
    .trm-career .bricks-button .loading svg {
        animation: none !important;
    }
}
