.tenxiu-uploader {
    --tenxiu-text: #1f2937;
    --tenxiu-muted: #6b7280;
    --tenxiu-border: #e5e7eb;
    --tenxiu-soft: #fafafa;
    --tenxiu-accent: #111827;
    width: 100%;
    box-sizing: border-box;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--tenxiu-border);
    border-radius: 10px;
    background: #fff;
    color: var(--tenxiu-text);
    box-shadow: none;
}

.tenxiu-uploader *,
.tenxiu-uploader *::before,
.tenxiu-uploader *::after {
    box-sizing: border-box;
}

.tenxiu-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.tenxiu-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--tenxiu-text);
}

.tenxiu-subtitle {
    margin: 2px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--tenxiu-muted);
}

.tenxiu-required {
    display: inline-flex;
    padding: 2px 5px;
    border-radius: 999px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.tenxiu-count {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid var(--tenxiu-border);
    border-radius: 999px;
    background: #fff;
    color: var(--tenxiu-muted);
    font-size: 10px;
    font-weight: 600;
}

.tenxiu-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 118px;
    padding: 12px 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: var(--tenxiu-soft);
    text-align: center;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease;
}

.tenxiu-dropzone:hover,
.tenxiu-dropzone.is-dragging {
    border-color: #64748b;
    background: #f8fafc;
    box-shadow: none;
}

.tenxiu-dropzone.is-dragging {
    transform: none;
}

.tenxiu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-bottom: 4px;
    border-radius: 7px;
    background: #f1f5f9;
    color: #475569;
}

.tenxiu-icon svg {
    width: 18px;
    height: 18px;
}

.tenxiu-dropzone-title {
    font-size: 12px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--tenxiu-text);
}

.tenxiu-or {
    margin: 2px 0;
    font-size: 9px;
    line-height: 1.2;
    color: #9ca3af;
}

.tenxiu-browse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    margin-bottom: 5px;
    border-radius: 6px;
    background: var(--tenxiu-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.tenxiu-help {
    max-width: 100%;
    font-size: 9.5px;
    line-height: 1.35;
    color: #7c8592;
}

.tenxiu-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.tenxiu-error {
    display: none;
    margin-top: 7px;
    padding: 7px 9px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fffafa;
    color: #b91c1c;
    font-size: 10px;
    line-height: 1.35;
}

.tenxiu-error.is-visible {
    display: block;
}

.tenxiu-file-list {
    display: grid;
    gap: 5px;
    margin-top: 7px;
}

.tenxiu-file-list:empty {
    display: none;
}

.tenxiu-file-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 26px;
    align-items: center;
    gap: 7px;
    padding: 5px 6px;
    border: 1px solid var(--tenxiu-border);
    border-radius: 7px;
    background: #fff;
}

.tenxiu-file-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    overflow: hidden;
    border-radius: 5px;
    background: #f3f4f6;
    color: #64748b;
    font-size: 7px;
    font-weight: 700;
    letter-spacing: .02em;
}

.tenxiu-file-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tenxiu-file-info {
    min-width: 0;
}

.tenxiu-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--tenxiu-text);
}

.tenxiu-file-size {
    margin-top: 1px;
    font-size: 9px;
    line-height: 1.2;
    color: var(--tenxiu-muted);
}

.tenxiu-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.tenxiu-remove:hover {
    background: #fef2f2;
    color: #b91c1c;
}

@media (max-width: 640px) {
    .tenxiu-uploader {
        margin: 10px 0;
        padding: 10px;
        border-radius: 8px;
    }

    .tenxiu-heading-row {
        gap: 8px;
        margin-bottom: 7px;
    }

    .tenxiu-dropzone {
        min-height: 108px;
        padding: 10px 12px;
    }

    .tenxiu-subtitle {
        max-width: 240px;
    }
}

/* Sticky add-to-cart compatibility: the theme may render/clone the WooCommerce
   add-to-cart form a second time. JS marks that copy so it never enlarges the
   sticky bar on desktop or covers the mobile screen. */
.tenxiu-uploader.tenxiu-sticky-duplicate {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
}
