/* ══════════════════════════════════════════
   Parts Form — CSS Variables & Base
   ══════════════════════════════════════════ */
:root {
    /* ── Colors ── */
    --pf-primary: #5F3F4D;
    --pf-heading: #000000;
    --pf-text: #383948;
    --pf-bg: #FFFFFF;
    --pf-bg-body: hsl(0, 0%, 96%);

    --pf-border: hsl(0, 0%, 85%);
    --pf-border-hover: hsl(0, 0%, 59%);
    --pf-border-focus: #5F3F4D;

    --pf-btn: #5F3F4D;
    --pf-btn-hover: #7a4d60;
    --pf-btn-active: #5F3F4D;

    --pf-success: #22C55E;
    --pf-error: #DC2626;

    /* ── Layout ── */
    --pf-radius: .5rem;
    --pf-radius-input: .375rem;
    --pf-shadow: none;
    --pf-transition: 0.2s ease;

    /* ── Typography ── */
    --pf-font: "Source Sans 3", sans-serif;
    --pf-font-title: "Raleway", sans-serif;
    --pf-font-size: .9375rem;
    --pf-line-height: 160%;
}

#parts-form {
    font-family: var(--pf-font);
    color: var(--pf-text);
    max-width: 60rem;
    margin: 0 auto;
    padding: 2.5rem 5rem 4.75rem;
    background: white;
    /* min-height: 100vh; */
    box-sizing: border-box;
    line-height: var(--pf-line-height);
}

#parts-form *,
#parts-form *::before,
#parts-form *::after {
    box-sizing: border-box;
}

#parts-form :focus-visible {
    outline: none;
    box-shadow: 0 0 0 .1875rem var(--pf-border);
}

#parts-form * {
    text-wrap: pretty;
}

body {
    margin: 0;
    padding: 0;
    background: var(--pf-bg-body);
}

/* ── Header ── */
.pf-header {
    text-align: center;
    margin-bottom: 2rem;
}

.pf-logo {
    margin-bottom: 2.5rem;
}

.pf-logo img {
    height: 3rem;
    width: auto;
    max-width: 100%;
}

.pf-header h1 {
    font-family: var(--pf-font-title);
    font-size: 1.6875rem;
    font-weight: 700;
    color: var(--pf-heading);
    margin: 0 0 .75rem;
    letter-spacing: -.02rem;
}

.pf-subtitle {
    font-size: var(--pf-font-size);
    color: var(--pf-border-hover);
    margin: 0;
    line-height: var(--pf-line-height);
}

/* ── Language switch ── */
.pf-lang-switch {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .25rem;
    margin-bottom: .75rem;
}

.pf-lang-btn {
    display: inline-block;
    padding: .25rem .75rem;
    font-size: .8125rem;
    font-weight: 500;
    font-family: var(--pf-font-title);
    color: var(--pf-border-hover);
    text-decoration: none;
    border-radius: 1.25rem;
    transition: color var(--pf-transition), background var(--pf-transition);
}

.pf-lang-btn:hover {
    color: var(--pf-primary);
    background: var(--pf-bg-body);
}

.pf-lang-btn.is-active {
    color: #fff;
    background: var(--pf-primary);
    pointer-events: none;
}

.pf-lang-sep {
    color: var(--pf-border);
    font-size: .8125rem;
    user-select: none;
}

/* ── Sections ── */
.pf-section {
    background: var(--pf-bg);
    border-radius: var(--pf-radius);
    box-shadow: var(--pf-shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    /* border: .0625rem solid var(--pf-border); */
}

.pf-section-header {
    background: var(--pf-bg-body);
    padding: 1.25rem 1.5rem 1rem;
    /* border-bottom: .0625rem solid var(--pf-border); */
}

.pf-section-header h2 {
    font-family: var(--pf-font-title);
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--pf-heading);
    margin: 0 0 .25rem;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
}

.pf-section-header p {
    font-size: var(--pf-font-size);
    color: var(--pf-border-hover);
    margin: 0;
    line-height: var(--pf-line-height);
}

.pf-icon svg {
    height: 1.0625rem;
    color: var(--pf-primary);
    transform: translateY(.125rem);
}

.pf-section-body {
    padding: 2.5rem;
    background: #fcfcfc;
}

/* ── Grid ── */
.pf-grid {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.pf-grid:last-child {
    margin-bottom: 0;
}

.pf-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.pf-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

/* ── Fields ── */
.pf-field {
    margin-bottom: 1rem;
}

.pf-field:last-child {
    margin-bottom: 0;
}

.pf-grid .pf-field {
    margin-bottom: 0;
}

.pf-field label {
    display: block;
    font-size: .95rem;
    font-weight: 500;
    color: var(--pf-text);
    margin-bottom: .75rem;
    letter-spacing: -.02rem;
    line-height: 140%;
    position: relative;
}

/* ── Required indicator (red dot) ── */
.pf-field label[for]>.pf-required-dot,
.pf-field label:has(+ [required])::after {
    content: '';
    display: inline-block;
    width: .3125rem;
    height: .3125rem;
    background: var(--pf-error);
    border-radius: 50%;
    margin: 0 0 0 .25rem;
    transform: translateY(-.375rem);
}

/* ── Inputs, selects, textareas ── */
.pf-field input[type="text"],
.pf-field input[type="email"],
.pf-field input[type="tel"],
.pf-field input[type="number"],
.pf-field input[type="search"],
.pf-field input[type="password"],
.pf-field select,
.pf-field textarea {
    width: 100%;
    padding: .875rem 1.25rem;
    font-size: var(--pf-font-size);
    font-family: var(--pf-font);
    font-weight: 400;
    color: var(--pf-text);
    background: var(--pf-bg);
    border: .0625rem solid var(--pf-border);
    border-radius: var(--pf-radius-input);
    outline: none;
    appearance: none;
    box-shadow: none;
    line-height: var(--pf-line-height);
    transition: border-color var(--pf-transition), box-shadow var(--pf-transition);
}

.pf-field input::placeholder,
.pf-field textarea::placeholder {
    color: var(--pf-border-hover);
    font-weight: 350;
    opacity: 1;
}

.pf-field input:hover,
.pf-field select:hover,
.pf-field textarea:hover {
    border-color: var(--pf-border-hover);
}

.pf-field input:focus,
.pf-field select:focus,
.pf-field textarea:focus {
    border-color: var(--pf-border-focus);
    box-shadow: 0 0 0 .1875rem var(--pf-border);
}

.pf-field input:disabled,
.pf-field select:disabled,
.pf-field textarea:disabled {
    border-color: var(--pf-border);
    box-shadow: none;
    background: var(--pf-bg-body);
    cursor: not-allowed;
}

/* ── Select dropdown ── */
.pf-field select {
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.25rem center;
    background-size: .625rem;
    padding-right: 2.75rem;
}

/* ── Textarea ── */
.pf-field textarea {
    resize: vertical;
    min-height: 5rem;
}

/* ── Upload area ── */
.pf-upload-area {
    position: relative;
    border: .0625rem solid var(--pf-border);
    border-radius: var(--pf-radius);
    padding: 2rem 1.5rem;
    text-align: center;
    background: repeating-linear-gradient(-45deg,
            #fcfcfc,
            #fcfcfc .25rem,
            white .25rem,
            white .5rem), var(--pf-bg-body);
    transition: border-color var(--pf-transition), background var(--pf-transition);
    cursor: pointer;
}

.pf-upload-area.dragover {
    border-color: var(--pf-primary);
    background: var(--pf-bg-body);
}

.pf-upload-icon svg {
    width: 1.5rem;
    margin-bottom: .5rem;
    color: var(--pf-border-hover);
}

.pf-upload-area p {
    font-size: var(--pf-font-size);
    color: var(--pf-border-hover);
    margin: 0 0 1rem;
    line-height: var(--pf-line-height);
}

.pf-upload-btn {
    display: inline-block;
    padding: .75rem 1.5rem;
    font-family: var(--pf-font);
    font-size: var(--pf-font-size);
    font-weight: 500;
    color: var(--pf-text) !important;
    background: var(--pf-bg);
    border: .0625rem solid var(--pf-border);
    border-radius: var(--pf-radius-input);
    cursor: pointer;
    transition: background var(--pf-transition);
    line-height: var(--pf-line-height);
}

.pf-upload-btn:hover {
    background: var(--pf-bg-body);
}

.pf-file-input {
    position: absolute;
    width: .0625rem;
    height: .0625rem;
    padding: 0;
    margin: -0.0625rem;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pf-file-hint {
    display: block;
    font-size: .75rem;
    color: var(--pf-border-hover);
    margin-top: .5rem;
}

/* ── File error notification ── */
.pf-file-error {
    position: relative;
    background: var(--pf-error);
    color: #fff;
    padding: .875rem 1.25rem .7813rem;
    border-radius: var(--pf-radius-input);
    margin-top: .75rem;
    font-size: var(--pf-font-size);
    font-weight: 400;
    line-height: 120%;
    letter-spacing: 0;
}

/* .pf-file-error::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: -.4375rem;
    width: 0;
    height: 0;
    border-left: .625rem solid transparent;
    border-right: .625rem solid transparent;
    border-bottom: .625rem solid var(--pf-error);
    clear: both;
} */

/* ── File list ── */
.pf-file-list {
    margin-top: .5rem;
}

.pf-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem .75rem;
    background: var(--pf-bg-body);
    border-radius: var(--pf-radius-input);
    margin-bottom: .25rem;
    font-size: var(--pf-font-size);
    gap: .5rem;
}

.pf-file-item.is-oversized {
    background: var(--pf-bg-body);
    border: .0625rem solid var(--pf-error);
}

.pf-file-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-file-item-size {
    color: var(--pf-border-hover);
    font-size: .75rem;
    white-space: nowrap;
}

.pf-file-item-flag {
    color: var(--pf-error);
    font-size: .6875rem;
    font-weight: 600;
    white-space: nowrap;
}

.pf-file-item-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    border: none;
    background: transparent;
    color: var(--pf-border-hover);
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    font-size: .875rem;
    line-height: 1;
    transition: background var(--pf-transition), color var(--pf-transition);
    flex-shrink: 0;
}

.pf-file-item-remove:hover {
    background: var(--pf-border);
    color: var(--pf-text);
}

.pf-file-item.is-oversized .pf-file-item-remove:hover {
    background: var(--pf-border);
    color: var(--pf-error);
}

/* ── Submit ── */
.pf-submit-wrapper {
    text-align: center;
    margin-top: 1.25rem;
}

.pf-submit-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 1rem 1.875rem;
    font-size: .9375rem;
    font-weight: 400;
    font-family: var(--pf-font);
    color: #fff;
    background: var(--pf-btn);
    border: none;
    border-radius: var(--pf-radius);
    cursor: pointer;
    line-height: var(--pf-line-height);
    transition: background 0.3s ease, transform var(--pf-transition);
}

.pf-submit-btn:hover {
    background: var(--pf-btn-hover);
}

.pf-submit-btn:active {
    background: var(--pf-btn-active);
    transform: translateY(.0625rem);
    transition: none;
}

.pf-submit-btn:disabled {
    background: var(--pf-border-hover);
    cursor: not-allowed;
    transform: none;
}

.pf-submit-btn:focus-visible {
    box-shadow: 0 0 0 .25rem var(--pf-border);
}

/* ── Success ── */
.pf-success {
    text-align: center;
    padding: 3.75rem 1.5rem;
    background: var(--pf-bg);
    border-radius: var(--pf-radius);
    box-shadow: var(--pf-shadow);
    /* border: .0625rem solid var(--pf-border); */
    background: #fcfcfc;
}

.pf-success-icon {
    width: 4rem;
    height: 4rem;
    line-height: 4rem;
    font-size: 2rem;
    background: var(--pf-bg-body);
    color: var(--pf-success);
    border-radius: 50%;
    margin: 0 auto 1.25rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.pf-success-icon svg {
    width: 50%;
}

.pf-success h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--pf-heading);
    margin: 0 0 .75rem;
}

.pf-success p {
    font-size: var(--pf-font-size);
    color: var(--pf-border-hover);
    max-width: 30rem;
    margin: 0 auto;
    line-height: var(--pf-line-height);
    text-wrap: balance !important;
}

.pf-success-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 1.875rem;
    margin-top: 1.75rem;
    font-size: .9375rem;
    font-weight: 400;
    font-family: var(--pf-font);
    color: #fff;
    background: var(--pf-btn);
    border: none;
    border-radius: var(--pf-radius);
    cursor: pointer;
    line-height: var(--pf-line-height);
    text-decoration: none;
    transition: background 0.3s ease, transform var(--pf-transition);
}

.pf-success-btn:hover {
    background: var(--pf-btn-hover);
    color: #fff;
}

.pf-success-btn:active {
    background: var(--pf-btn-active);
    transform: translateY(.0625rem);
    transition: none;
}

/* ── Upload overlay ── */
#pf-upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pf-overlay-content {
    background: var(--pf-bg);
    padding: 2.5rem 3.125rem;
    border-radius: var(--pf-radius);
    text-align: center;
    box-shadow: 0 .5rem 2rem rgba(0, 0, 0, 0.2);
    min-width: 18.75rem;
    font-family: var(--pf-font);
}

.pf-spinner {
    width: 2.75rem;
    height: 2.75rem;
    border: .25rem solid var(--pf-border);
    border-top-color: var(--pf-primary);
    border-radius: 50%;
    animation: pf-spin 0.8s linear infinite;
    margin: 0 auto 1.25rem;
}

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

#pf-upload-status {
    font-size: var(--pf-font-size);
    color: var(--pf-text);
    margin-bottom: 1rem;
    line-height: var(--pf-line-height);
}

.pf-progress-bar {
    width: 100%;
    height: .375rem;
    background: var(--pf-border);
    border-radius: .1875rem;
    overflow: hidden;
}

.pf-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--pf-primary);
    border-radius: .1875rem;
    transition: width 0.3s ease;
}

.pf-progress-fill.indeterminate {
    width: 30% !important;
    animation: pf-indeterminate 1.2s ease-in-out infinite;
}

@keyframes pf-indeterminate {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(400%);
    }
}

/* ── Flash messages (OctoberCMS) ── */
.jax-flash-message .flash-message {
    padding: .5rem .75rem;
    border-radius: var(--pf-radius-input);
    font-family: var(--pf-font);
    font-size: var(--pf-font-size);
    line-height: var(--pf-line-height);
}

.jax-flash-message a.flash-close {
    transform: translateX(.25rem);
}

/* ── Footer ── */
.pf-footer {
    text-align: center;
    padding: 2rem 1rem 3.5rem;
    font-family: var(--pf-font);
    font-size: .8125rem;
    color: var(--pf-border-hover);
    letter-spacing: .01rem;
}

.pf-footer p {
    margin: 0;
}

/* ══════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════ */
@media (max-width: 48rem) {
    #parts-form {
        padding: 1.5rem 1rem 3rem;
    }

    .pf-header h1 {
        font-size: 1.5rem;
    }

    .pf-grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .pf-grid-3 .pf-field:last-child {
        grid-column: span 2;
    }

    .pf-section-body {
        padding: 1.25rem;
    }

    .pf-section-header {
        padding: 1rem 1.25rem .75rem;
    }
}

@media (max-width: 30rem) {
    #parts-form {
        padding: 1rem .75rem 2.5rem;
    }

    .pf-header h1 {
        font-size: 1.375rem;
    }

    .pf-subtitle {
        font-size: .8125rem;
    }

    .pf-grid-2,
    .pf-grid-3 {
        grid-template-columns: 1fr;
    }

    .pf-grid-3 .pf-field:last-child {
        grid-column: span 1;
    }

    .pf-section-body {
        padding: 1rem;
    }

    .pf-section-header {
        padding: .875rem 1rem .625rem;
    }

    .pf-submit-btn {
        padding: .875rem 1.5rem;
    }

    .pf-upload-area {
        padding: 1.5rem 1rem;
    }

    .pf-overlay-content {
        padding: 1.875rem 1.5rem;
        min-width: auto;
        margin: 0 1rem;
    }
}